Bug 21476: Fix HTML5 media from playing in the OPAC - incorrect filters
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-memberentry.tt
index 0ea468d..3628f10 100644 (file)
@@ -1,9 +1,15 @@
+[% USE raw %]
+[% USE Asset %]
+[% USE AuthorisedValues %]
+[% USE Categories %]
 [% USE Koha %]
+[% USE Branches %]
 [% USE KohaDates %]
+[% USE Math %]
 [% SET userupdateview = 1 %]
 
 [% INCLUDE 'doc-head-open.inc' %]
-    <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; [% IF action == 'edit' %]Update your personal details[% ELSE %]Register a new account[% END %]</title>
+    <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; [% IF action == 'edit' %]Update your personal details[% ELSE %]Register a new account[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% BLOCK cssinclude %][% END %]
 </head>
@@ -19,7 +25,7 @@
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
         [% IF action == 'edit' %]
-            <li><a href="/cgi-bin/koha/opac-user.pl">[% borrower.firstname %] [% borrower.surname %]</a> <span class="divider">&rsaquo;</span></li>
+            <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
             <li><a href="#">Your personal details</a></li>
         [% ELSE %]
             <li><a href="#">Register a new account</a></li>
@@ -53,7 +59,7 @@
                     <div class="alert">You have not filled out all required fields. Please fill in all missing fields and resubmit.</div>
                 [% END %]
 
-                [%  IF invalid_form_fields %]
+                [% IF invalid_form_fields %]
                     <div class="alert alert-error"><strong>The following fields contain invalid information:</strong>
                         <ul>
                             [% FOREACH field IN invalid_form_fields %]
                                 [% IF field == "emailpro" %]<li>Contact information: <a href="#borrower_emailpro">secondary email address</a></li>[% END %]
                                 [% IF field == "B_email" %]<li>Alternate address information: <a href="#borrower_B_email">email address</a></li>[% END %]
                                 [% IF field == "password_match" %]<li>Passwords do not match! <a href="#password">password</a></li>[% END %]
-                                [% IF field == "password_invalid" %]<li>Password does not meet minimum requirements! <a href="#password">password</a></li>[% END %]
-                                [% IF field == "password_spaces" %]<li>Password contains leading and/or trailing spaces! <a href="#password">password</a></li>[% END %]
+                                [% IF field == "password_too_short" %]
+                                    <li>Password must be at least [% minPasswordLength | html %] characters long.</li>
+                                [% END %]
+                                [% IF field == "password_too_weak" %]
+                                    <li>Password must contain at least one digit, one lowercase and one uppercase.</li>
+                                [% END %]
+                                [% IF field == "password_has_whitespaces" %]
+                                    <li>Password must not contain leading or trailing whitespaces.</li>
+                                [% END %]
+                                [% IF field == "duplicate_email" %]
+                                    <li>This email address already exists in our database.</li>
+                                [% END %]
                             [% END %]
                         </ul>
-                        Please correct the errors and resubmit.
+                        <span>Please correct and resubmit.</span>
+                    </div>
+                [% END %]
+
+                [% IF cardnumber_wrong_length || cardnumber_already_exists %]
+                    <div class="alert alert-error">
+                        [% IF cardnumber_wrong_length %]
+                        <a href="#borrower_cardnumber"><strong>The entered card number is the wrong length.</strong></a>
+                        [% ELSIF cardnumber_already_exists %]
+                        <a href="#borrower_cardnumber"><strong>The entered card number is already in use.</strong></a>
+                        [% END %]
+                        <span>Please correct and resubmit.</span>
                     </div>
                 [% END %]
 
                                     <span id="update_privacy_guarantor_checkouts_message" class="alert" style="display:none"></span>
                                 </span>
                                 <span class="hint">
-                                    Your guarantor is <i>[% guarantor.firstname %] [% guarantor.surname %]</i>
+                                    Your guarantor is <i>[% guarantor.firstname | html %] [% guarantor.surname | html %]</i>
                                 </span>
                             </li>
                         </ol>
                     </fieldset>
                 [% END %]
+                [% IF ( extended_unique_id_failed_code ) %]
+                    <div class="alert" id="extended_unique_id_failed"><a href="#patron-attr-start-[% extended_unique_id_failed_code | uri %]">[% extended_unique_id_failed_description _ ': ' | html %]</a> Value is already in use ([% extended_unique_id_failed_value | html %])</div>
+                [% END %]
 
-                <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form">
+                <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form" autocomplete="off">
 
-                [% UNLESS hidden.defined('branchcode') %]
+                [%# Following on one line for translatability %]
+                [% UNLESS ( hidden.defined('cardnumber') || ( !borrower && Koha.Preference('autoMemberNum') ) ) && hidden.defined('dateexpiry') && hidden.defined('branchcode') && hidden.defined('categorycode') %]
                     <fieldset class="rows" id="memberentry_library">
 
                         <legend id="library_legend">Library</legend>
                             <ol>
-                                [% UNLESS hidden.defined('cardnumber') %]
+                                [% UNLESS hidden.defined('cardnumber') || ( !borrower && Koha.Preference('autoMemberNum') ) %]
                                 <li>
-                                    <label>Card number:</label>
-                                    [% borrower.cardnumber %]
+                                    [% IF mandatory.defined('cardnumber') %]
+                                        <label for="borrower_cardnumber" class="required">Library card number:</label>
+                                    [% ELSE %]
+                                        <label for="borrower_cardnumber">Library card number:</label>
+                                    [% END %]
+                                    [% IF borrower && !(cardnumber_wrong_length || cardnumber_already_exists) %]
+                                        [% borrower.cardnumber | html %]
+                                    [% ELSE %]
+                                        [% IF minlength_cardnumber == maxlength_cardnumber %]
+                                            <input type="text" id="borrower_cardnumber" name="borrower_cardnumber" size="20" value="[% borrower.cardnumber | html %]" minlength="[% minlength_cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
+                                            [% IF ( mandatory.defined('cardnumber') ) %]<span class="required">Required</span>[% END %]
+                                            <div class="hint">Card number must be exactly [% minlength_cardnumber | html %] characters.</div>
+                                        [% ELSIF minlength_cardnumber && maxlength_cardnumber %]
+                                            <input type="text" id="borrower_cardnumber" name="borrower_cardnumber" size="20" value="[% borrower.cardnumber | html %]" minlength="[% minlength_cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
+                                            [% IF ( mandatory.defined('cardnumber') ) %]<span class="required">Required</span>[% END %]
+                                            <div class="hint">Card number must be between [% minlength_cardnumber | html %] and [% maxlength_cardnumber | html %] characters.</div>
+                                        [% ELSIF maxlength_cardnumber %]
+                                            <input type="text" id="borrower_cardnumber" name="borrower_cardnumber" size="20" value="[% borrower.cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
+                                            [% IF ( mandatory.defined('cardnumber') ) %]<span class="required">Required</span>[% END %]
+                                            <div class="hint">Card number can be up to [% maxlength_cardnumber | html %] characters.</div>
+                                        [% ELSE %]
+                                            <input type="text" id="borrower_cardnumber" name="borrower_cardnumber" size="20" value="[% borrower.cardnumber | html %]" />
+                                            [% IF ( mandatory.defined('cardnumber') ) %]<span class="required">Required</span>[% END %]
+                                            <div class="hint">There is no minimum or maximum character length.</div>
+                                        [% END %]
+                                    [% END %]
                                 </li>
                                 [% END %]
 
                                 [% UNLESS hidden.defined('dateexpiry') %]
                                 <li>
                                     <label>Expiration date:</label>
-                                    [% borrower.dateexpiry | $KohaDates  %]
+                                    [% borrower.dateexpiry | $KohaDates | html %]
                                 </li>
                                 [% END %]
 
                                 [% UNLESS hidden.defined('branchcode') %]
                                     <li>
                                         [% IF mandatory.defined('branchcode') %]
-                                            <label for="borrower_branchcode" class="required">
+                                            <label for="borrower_branchcode" class="required">Home library:</label>
                                         [% ELSE %]
-                                            <label for="borrower_branchcode">
+                                            <label for="borrower_branchcode">Home library:</label>
                                         [% END %]
-                                        Home library:</label>
 
                                         <select id="borrower_branchcode" name="borrower_branchcode">
-                                            [% FOREACH b IN branches %]
-                                                [% IF b.value == borrower.branchcode %]
-                                                    <option value="[% b.value %]" selected="selected">[% b.branchname %]</option>
+                                            [% FOREACH l IN libraries %]
+                                                [% IF l.branchcode == borrower.branchcode %]
+                                                    <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
                                                 [% ELSE %]
-                                                    <option value="[% b.value %]">[% b.branchname %]</option>
+                                                    <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
                                                 [% END %]
                                             [% END %]
                                         </select>
                                     </li>
                                 [% END %]
+
+                                [% UNLESS hidden.defined('categorycode') %]
+                                    <li>
+                                        <label for="borrower_categorycode">
+                                        Category:</label>
+
+                                        [% IF borrower %]
+                                            [% Categories.GetName( borrower.categorycode ) | html %]
+                                            <input type="hidden" name="borrower_categorycode" value="[% borrower.categorycode | html %]" />
+                                        [% ELSE %]
+                                            <select id="borrower_categorycode" name="borrower_categorycode">
+                                                [% FOREACH c IN Categories.all() %]
+                                                    [% IF c.categorycode == Koha.Preference('PatronSelfRegistrationDefaultCategory') %]
+                                                        <option value="[% c.categorycode | html %]" selected="selected">[% c.description | html %]</option>
+                                                    [% ELSE %]
+                                                        <option value="[% c.categorycode | html %]">[% c.description | html %]</option>
+                                                    [% END %]
+                                                [% END %]
+                                            </select>
+                                        [% END %]
+                                    </li>
+                                [% END %]
                             </ol>
                         </fieldset>
                 [% END # / defined 'branchcode' %]
 
-                [% UNLESS
-                    hidden.defined('title') && hidden.defined('surname') && hidden.defined('firstname') &&
-                    hidden.defined('dateofbirth') && hidden.defined('initials') && hidden.defined('othernames') &&
-                    hidden.defined('sex')
-                %]
+                [%# Following on one line for translatability %]
+                [% UNLESS hidden.defined('title') && hidden.defined('surname') && hidden.defined('firstname') && hidden.defined('dateofbirth') && hidden.defined('initials') && hidden.defined('othernames') && hidden.defined('sex') %]
                     <div class="row-fluid">
                         [% IF ( display_patron_image ) %]
                             <div class="span8">
                                 <legend id="identity_legend">Identity</legend>
 
                                 <ol>
-                                    [% UNLESS hidden.defined('title') || !member_titles %]
+                                    [% UNLESS hidden.defined('title') || !Koha.Preference('BorrowersTitles') %]
                                         <li>
                                             [% IF mandatory.defined('title') %]
-                                                <label for="borrower_title" class="required">
+                                                <label for="borrower_title" class="required">Salutation:</label>
                                             [% ELSE %]
-                                                <label for="borrower_title">
+                                                <label for="borrower_title">Salutation:</label>
                                             [% END %]
-                                            Salutation:</label>
 
                                             <select id="borrower_title" name="borrower_title">
-                                                [% FOREACH mt IN member_titles %]
+                                                <option value=""></option>
+                                                [% FOREACH mt IN Koha.Preference('BorrowersTitles').split('\|') %]
                                                     [% IF mt == borrower.title %]
-                                                        <option value="[% mt %]" selected="selected">[% mt %]</option>
+                                                        <option value="[% mt | html %]" selected="selected">[% mt | html %]</option>
                                                     [% ELSE %]
-                                                        <option value="[% mt %]">[% mt %]</option>
+                                                        <option value="[% mt | html %]">[% mt | html %]</option>
                                                     [% END %]
                                                 [% END %]
                                             </select>
                                     [% UNLESS hidden.defined('surname') %]
                                         <li>
                                             [% IF mandatory.defined('surname') %]
-                                                <label for="borrower_surname" class="required">
+                                                <label for="borrower_surname" class="required">Surname:</label>
                                             [% ELSE %]
-                                                <label for="borrower_surname">
+                                                <label for="borrower_surname">Surname:</label>
                                             [% END %]
-                                            Surname:</label>
 
-                                            <input type="text" id="borrower_surname" name="borrower_surname" value="[% borrower.surname %]" />
+                                            <input type="text" id="borrower_surname" name="borrower_surname" value="[% borrower.surname | html %]" />
                                             [% IF mandatory.defined('surname') %]<span class="required">Required</span>[% END %]
                                         </li>
                                     [% END %]
                                     [% UNLESS hidden.defined('firstname') %]
                                         <li>
                                             [% IF mandatory.defined('firstname') %]
-                                                <label for="borrower_firstname" class="required">
+                                                <label for="borrower_firstname" class="required">First name:</label>
                                             [% ELSE %]
-                                                <label for="borrower_firstname">
+                                                <label for="borrower_firstname">First name:</label>
                                             [% END %]
-                                            First name:</label>
 
-                                            <input type="text" id="borrower_firstname" name="borrower_firstname" value="[% borrower.firstname %]" />
+                                            <input type="text" id="borrower_firstname" name="borrower_firstname" value="[% borrower.firstname | html %]" />
                                             [% IF mandatory.defined('firstname') %]<span class="required">Required</span>[% END %]
                                         </li>
                                     [% END %]
                                     [% UNLESS hidden.defined('dateofbirth') %]
                                         <li>
                                             [% IF mandatory.defined('dateofbirth') %]
-                                                <label for="borrower_dateofbirth" class="required">
+                                                <label for="borrower_dateofbirth" class="required">Date of birth:</label>
                                             [% ELSE %]
-                                                <label for="borrower_dateofbirth">
+                                                <label for="borrower_dateofbirth">Date of birth:</label>
                                             [% END %]
-                                            Date of birth:</label>
 
                                             <input type="text" id="borrower_dateofbirth" name="borrower_dateofbirth" value="[% borrower.dateofbirth | $KohaDates %]" size="10" />
 
                                             [% UNLESS action == 'edit' && !OPACPatronDetails %]
                                                 [% UNLESS ( mandatory.defined('dateofbirth') ) %]
-                                                    <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('borrower_dateofbirth').value='';return false;">Clear date</a>
+                                                    <a href="#" style="font-size:85%;text-decoration:none;" class="cleardate">Clear date</a>
                                                 [% END %]
                                             [% END %]
 
                                     [% UNLESS hidden.defined('initials') %]
                                         <li>
                                             [% IF mandatory.defined('initials') %]
-                                                <label for="borrower_initials" class="required">
+                                                <label for="borrower_initials" class="required">Initials:</label>
                                             [% ELSE %]
-                                                <label for="borrower_initials">
+                                                <label for="borrower_initials">Initials:</label>
                                             [% END %]
-                                            Initials:</label>
 
-                                            <input type="text" id="borrower_initials" name="borrower_initials" value="[% borrower.initials %]" />
+                                            <input type="text" id="borrower_initials" name="borrower_initials" value="[% borrower.initials | html %]" />
                                             [% IF mandatory.defined('initials') %]<span class="required">Required</span>[% END %]
                                         </li>
                                     [% END %]
                                     [% UNLESS hidden.defined('othernames') %]
                                         <li>
                                             [% IF mandatory.defined('othernames') %]
-                                                <label for="borrower_othernames" class="required">
+                                                <label for="borrower_othernames" class="required">Other names:</label>
                                             [% ELSE %]
-                                                <label for="borrower_othernames">
+                                                <label for="borrower_othernames">Other names:</label>
                                             [% END %]
-                                            Other names:</label>
 
-                                            <input type="text" id="borrower_othernames" name="borrower_othernames" value="[% borrower.othernames %]" />
+                                            <input type="text" id="borrower_othernames" name="borrower_othernames" value="[% borrower.othernames | html %]" />
                                             [% IF mandatory.defined('othernames') %]<span class="required">Required</span>[% END %]
                                         </li>
                                     [% END %]
                     </div>
                 [% END # /UNLESS fields hidden %]
 
-                [% UNLESS
-                    hidden.defined('streetnumber') && hidden.defined('address') && hidden.defined('address2') &&
-                    hidden.defined('city') && hidden.defined('state') && hidden.defined('zipcode') &&
-                    hidden.defined('country')
-                %]
+                [%# Following on one line for translatability %]
+                [% UNLESS hidden.defined('streetnumber') && hidden.defined('address') && hidden.defined('address2') && hidden.defined('city') && hidden.defined('state') && hidden.defined('zipcode') && hidden.defined('country') %]
                     <fieldset class="rows" id="memberentry_mainaddress">
                         <legend id="mainaddress_legend">Main address</legend>
 
                             [% UNLESS hidden.defined('streetnumber') %]
                                 <li>
                                     [% IF mandatory.defined('streetnumber') %]
-                                        <label for="borrower_streetnumber" class="required">
+                                        <label for="borrower_streetnumber" class="required">Street number:</label>
                                     [% ELSE %]
-                                        <label for="borrower_streetnumber">
+                                        <label for="borrower_streetnumber">Street number:</label>
                                     [% END %]
-                                    Street number:</label>
 
-                                    <input type="text" id="borrower_streetnumber" name="borrower_streetnumber" value="[% borrower.streetnumber %]" />
+                                    <input type="text" id="borrower_streetnumber" name="borrower_streetnumber" value="[% borrower.streetnumber | html %]" />
                                     [% IF mandatory.defined('streetnumber') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('address') %]
                                 <li>
                                     [% IF mandatory.defined('address') %]
-                                        <label for="borrower_address" class="required">
+                                        <label for="borrower_address" class="required">Address:</label>
                                     [% ELSE %]
-                                        <label for="borrower_address">
+                                        <label for="borrower_address">Address:</label>
                                     [% END %]
-                                    Address:</label>
 
-                                    <input type="text" id="borrower_address" name="borrower_address" value="[% borrower.address %]" />
+                                    <input type="text" id="borrower_address" name="borrower_address" value="[% borrower.address | html %]" />
                                     [% IF mandatory.defined('address') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('address2') %]
                                 <li>
                                     [% IF mandatory.defined('address2') %]
-                                        <label for="borrower_address2" class="required">
+                                        <label for="borrower_address2" class="required">Address 2:</label>
                                     [% ELSE %]
-                                        <label for="borrower_address2">
+                                        <label for="borrower_address2">Address 2:</label>
                                     [% END %]
-                                    Address 2:</label>
 
-                                    <input type="text" id="borrower_address2" name="borrower_address2" value="[% borrower.address2 %]" />
+                                    <input type="text" id="borrower_address2" name="borrower_address2" value="[% borrower.address2 | html %]" />
                                     [% IF mandatory.defined('address2') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('city') %]
                                 <li>
                                     [% IF mandatory.defined('city') %]
-                                        <label for="borrower_city" class="required">
+                                        <label for="borrower_city" class="required">City:</label>
                                     [% ELSE %]
-                                        <label for="borrower_city">
+                                        <label for="borrower_city">City:</label>
                                     [% END %]
-                                    City:</label>
 
-                                    <input type="text" id="borrower_city" name="borrower_city" value="[% borrower.city %]" />
+                                    <input type="text" id="borrower_city" name="borrower_city" value="[% borrower.city | html %]" />
                                     [% IF mandatory.defined('city') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('state') %]
                                 <li>
                                     [% IF mandatory.defined('state') %]
-                                        <label for="borrower_state" class="required">
+                                        <label for="borrower_state" class="required">State:</label>
                                     [% ELSE %]
-                                        <label for="borrower_state">
+                                        <label for="borrower_state">State:</label>
                                     [% END %]
-                                    State:</label>
 
-                                    <input type="text" id="borrower_state" name="borrower_state" value="[% borrower.state %]" />
+                                    <input type="text" id="borrower_state" name="borrower_state" value="[% borrower.state | html %]" />
                                     [% IF mandatory.defined('state') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('zipcode') %]
                                 <li>
                                     [% IF mandatory.defined('zipcode') %]
-                                        <label for="borrower_zipcode" class="required">
+                                        <label for="borrower_zipcode" class="required">ZIP/Postal code:</label>
                                     [% ELSE %]
-                                        <label for="borrower_zipcode">
+                                        <label for="borrower_zipcode">ZIP/Postal code:</label>
                                     [% END %]
-                                    ZIP/Postal code:</label>
 
-                                    <input type="text" id="borrower_zipcode" name="borrower_zipcode" value="[% borrower.zipcode %]" />
+                                    <input type="text" id="borrower_zipcode" name="borrower_zipcode" value="[% borrower.zipcode | html %]" />
                                     [% IF mandatory.defined('zipcode') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('country') %]
                                 <li>
                                     [% IF mandatory.defined('country') %]
-                                        <label for="borrower_country" class="required">
+                                        <label for="borrower_country" class="required">Country:</label>
                                     [% ELSE %]
-                                        <label for="borrower_country">
+                                        <label for="borrower_country">Country:</label>
                                     [% END %]
-                                    Country:</label>
 
-                                    <input type="text" id="borrower_country" name="borrower_country" value="[% borrower.country %]" />
+                                    <input type="text" id="borrower_country" name="borrower_country" value="[% borrower.country | html %]" />
                                     [% IF mandatory.defined('country') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                     </fieldset>
                 [% END %]
 
-                [% UNLESS
-                    hidden.defined('phone') && hidden.defined('phonepro') && hidden.defined('mobile') &&
-                    hidden.defined('email') && hidden.defined('emailpro') && hidden.defined('fax')
-                %]
+                [%# Following on one line for translatability %]
+                [% UNLESS hidden.defined('phone') && hidden.defined('phonepro') && hidden.defined('mobile') && hidden.defined('email') && hidden.defined('emailpro') && hidden.defined('fax') %]
                     <fieldset class="rows" id="memberentry_contact">
                         <legend id="contact_legend">Contact information</legend>
 
                             [% UNLESS hidden.defined('phone') %]
                                 <li>
                                     [% IF mandatory.defined('phone') %]
-                                        <label for="borrower_phone" class="required">
+                                        <label for="borrower_phone" class="required">Primary phone:</label>
                                     [% ELSE %]
-                                        <label for="borrower_phone">
+                                        <label for="borrower_phone">Primary phone:</label>
                                     [% END %]
-                                    Primary phone:</label>
 
-                                    <input type="text" id="borrower_phone" name="borrower_phone" value="[% borrower.phone %]" />
+                                    <input type="text" id="borrower_phone" name="borrower_phone" value="[% borrower.phone | html %]" />
                                     [% IF mandatory.defined('phone') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('phonepro') %]
                                 <li>
                                     [% IF mandatory.defined('phonepro') %]
-                                        <label for="borrower_phonepro" class="required">
+                                        <label for="borrower_phonepro" class="required">Secondary phone:</label>
                                     [% ELSE %]
-                                        <label for="borrower_phonepro">
+                                        <label for="borrower_phonepro">Secondary phone:</label>
                                     [% END %]
-                                    Secondary phone:</label>
 
-                                    <input type="text" id="borrower_phonepro" name="borrower_phonepro" value="[% borrower.phonepro %]" />
+                                    <input type="text" id="borrower_phonepro" name="borrower_phonepro" value="[% borrower.phonepro | html %]" />
                                     [% IF mandatory.defined('phonepro') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('mobile') %]
                                 <li>
                                     [% IF mandatory.defined('mobile') %]
-                                        <label for="borrower_mobile" class="required">
+                                        <label for="borrower_mobile" class="required">Other phone:</label>
                                     [% ELSE %]
-                                        <label for="borrower_mobile">
+                                        <label for="borrower_mobile">Other phone:</label>
                                     [% END %]
-                                    Other phone:</label>
 
-                                    <input type="text" id="borrower_mobile" name="borrower_mobile" value="[% borrower.mobile %]" />
+                                    <input type="text" id="borrower_mobile" name="borrower_mobile" value="[% borrower.mobile | html %]" />
                                     [% IF mandatory.defined('mobile') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('email') %]
                                 <li>
                                     [% IF mandatory.defined('email') %]
-                                        <label for="borrower_email" class="required">
+                                        <label for="borrower_email" class="required">Primary email:</label>
                                     [% ELSE %]
-                                        <label for="borrower_email">
+                                        <label for="borrower_email">Primary email:</label>
                                     [% END %]
-                                    Primary email:</label>
 
-                                    <input type="text" id="borrower_email" name="borrower_email" value="[% borrower.email %]" />
+                                    <input type="text" id="borrower_email" name="borrower_email" value="[% borrower.email | html %]" />
                                     [% IF mandatory.defined('email') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('emailpro') %]
                                 <li>
                                     [% IF mandatory.defined('emailpro') %]
-                                        <label for="borrower_emailpro" class="required">
+                                        <label for="borrower_emailpro" class="required">Secondary email:</label>
                                     [% ELSE %]
-                                        <label for="borrower_emailpro">
+                                        <label for="borrower_emailpro">Secondary email:</label>
                                     [% END %]
-                                    Secondary email:</label>
 
-                                    <input type="text" id="borrower_emailpro" name="borrower_emailpro" value="[% borrower.emailpro %]" />
+                                    <input type="text" id="borrower_emailpro" name="borrower_emailpro" value="[% borrower.emailpro | html %]" />
                                     [% IF mandatory.defined('emailpro') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('fax') %]
                                 <li>
                                     [% IF mandatory.defined('fax') %]
-                                        <label for="borrower_fax" class="required">
+                                        <label for="borrower_fax" class="required">Fax:</label>
                                     [% ELSE %]
-                                        <label for="borrower_fax">
+                                        <label for="borrower_fax">Fax:</label>
                                     [% END %]
-                                    Fax:</label>
 
-                                    <input type="text" id="borrower_fax" name="borrower_fax" value="[% borrower.fax %]" />
+                                    <input type="text" id="borrower_fax" name="borrower_fax" value="[% borrower.fax | html %]" />
                                     [% IF mandatory.defined('fax') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                     </fieldset>
                 [% END %]
 
-                [% UNLESS
-                    hidden.defined('B_address') && hidden.defined('B_address2') && hidden.defined('B_city') &&
-                    hidden.defined('B_state') && hidden.defined('B_zipcode') && hidden.defined('B_country') &&
-                    hidden.defined('B_phone') && hidden.defined('B_email') && hidden.defined('contactnote')
-                %]
+                [%# Following on one line for translatability %]
+                [% UNLESS hidden.defined('B_address') && hidden.defined('B_address2') && hidden.defined('B_city') && hidden.defined('B_state') && hidden.defined('B_zipcode') && hidden.defined('B_country') && hidden.defined('B_phone') && hidden.defined('B_email') && hidden.defined('contactnote') %]
                     <fieldset class="rows" id="memberentry_alternateaddress">
                         <legend id="alternateaddress_legend">Alternate address</legend>
 
                             [% UNLESS hidden.defined('B_address') %]
                                 <li>
                                     [% IF mandatory.defined('B_address') %]
-                                        <label for="borrower_B_address" class="required">
+                                        <label for="borrower_B_address" class="required">Address:</label>
                                     [% ELSE %]
-                                        <label for="borrower_B_address">
+                                        <label for="borrower_B_address">Address:</label>
                                     [% END %]
-                                    Address:</label>
 
-                                    <input type="text" id="borrower_B_address" name="borrower_B_address" value="[% borrower.B_address %]" />
+                                    <input type="text" id="borrower_B_address" name="borrower_B_address" value="[% borrower.B_address | html %]" />
                                     [% IF mandatory.defined('B_address') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('B_address2') %]
                                 <li>
                                     [% IF mandatory.defined('B_address2') %]
-                                        <label for="borrower_B_address2" class="required">
+                                        <label for="borrower_B_address2" class="required">Address 2:</label>
                                     [% ELSE %]
-                                        <label for="borrower_B_address2">
+                                        <label for="borrower_B_address2">Address 2:</label>
                                     [% END %]
-                                    Address 2:</label>
 
-                                    <input type="text" id="borrower_B_address2" name="borrower_B_address2" value="[% borrower.B_address2 %]" />
+                                    <input type="text" id="borrower_B_address2" name="borrower_B_address2" value="[% borrower.B_address2 | html %]" />
                                     [% IF mandatory.defined('B_address2') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('B_city') %]
                                 <li>
                                     [% IF mandatory.defined('B_city') %]
-                                        <label for="borrower_B_city" class="required">
+                                        <label for="borrower_B_city" class="required">City:</label>
                                     [% ELSE %]
-                                        <label for="borrower_B_city">
+                                        <label for="borrower_B_city">City:</label>
                                     [% END %]
-                                    City:</label>
 
-                                    <input type="text" id="borrower_B_city" name="borrower_B_city" value="[% borrower.B_city %]" />
+                                    <input type="text" id="borrower_B_city" name="borrower_B_city" value="[% borrower.B_city | html %]" />
                                     [% IF mandatory.defined('B_city') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('B_state') %]
                                 <li>
                                     [% IF mandatory.defined('B_state') %]
-                                        <label for="borrower_B_state" class="required">
+                                        <label for="borrower_B_state" class="required">State:</label>
                                     [% ELSE %]
-                                        <label for="borrower_B_state">
+                                        <label for="borrower_B_state">State:</label>
                                     [% END %]
-                                    State:</label>
 
-                                    <input type="text" id="borrower_B_state" name="borrower_B_state" value="[% borrower.B_state %]" />
+                                    <input type="text" id="borrower_B_state" name="borrower_B_state" value="[% borrower.B_state | html %]" />
                                     [% IF mandatory.defined('B_state') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('B_zipcode') %]
                                 <li>
                                     [% IF mandatory.defined('B_zipcode') %]
-                                        <label for="borrower_B_zipcode" class="required">
+                                        <label for="borrower_B_zipcode" class="required">ZIP/Postal code:</label>
                                     [% ELSE %]
-                                        <label for="borrower_B_zipcode">
+                                        <label for="borrower_B_zipcode">ZIP/Postal code:</label>
                                     [% END %]
-                                    ZIP/Postal code:</label>
 
-                                    <input type="text" id="borrower_B_zipcode" name="borrower_B_zipcode" value="[% borrower.B_zipcode %]" />
+                                    <input type="text" id="borrower_B_zipcode" name="borrower_B_zipcode" value="[% borrower.B_zipcode | html %]" />
                                     [% IF mandatory.defined('B_zipcode') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('B_country') %]
                                 <li>
                                     [% IF mandatory.defined('B_country') %]
-                                        <label for="borrower_B_country" class="required">
+                                        <label for="borrower_B_country" class="required">Country:</label>
                                     [% ELSE %]
-                                        <label for="borrower_B_country">
+                                        <label for="borrower_B_country">Country:</label>
                                     [% END %]
-                                    Country:</label>
 
-                                    <input type="text" id="borrower_B_country" name="borrower_B_country" value="[% borrower.B_country %]" />
+                                    <input type="text" id="borrower_B_country" name="borrower_B_country" value="[% borrower.B_country | html %]" />
                                     [% IF mandatory.defined('B_country') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('B_phone') %]
                                 <li>
                                     [% IF mandatory.defined('B_phone') %]
-                                        <label for="borrower_B_phone" class="required">
+                                        <label for="borrower_B_phone" class="required">Phone:</label>
                                     [% ELSE %]
-                                        <label for="borrower_B_phone">
+                                        <label for="borrower_B_phone">Phone:</label>
                                     [% END %]
-                                    Phone:</label>
 
-                                    <input type="text" id="borrower_B_phone" name="borrower_B_phone" value="[% borrower.B_phone %]" />
+                                    <input type="text" id="borrower_B_phone" name="borrower_B_phone" value="[% borrower.B_phone | html %]" />
                                     [% IF mandatory.defined('B_phone') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('B_email') %]
                                 <li>
                                     [% IF mandatory.defined('B_email') %]
-                                        <label for="borrower_B_email" class="required">
+                                        <label for="borrower_B_email" class="required">Email:</label>
                                     [% ELSE %]
-                                        <label for="borrower_B_email">
+                                        <label for="borrower_B_email">Email:</label>
                                     [% END %]
-                                    Email:</label>
 
-                                    <input type="text" id="borrower_B_email" name="borrower_B_email" value="[% borrower.B_email %]" />
+                                    <input type="text" id="borrower_B_email" name="borrower_B_email" value="[% borrower.B_email | html %]" />
                                     [% IF mandatory.defined('B_email') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('contactnote') %]
                                 <li>
                                     [% IF mandatory.defined('contactnote') %]
-                                        <label for="borrower_contactnote" class="required">
+                                        <label for="borrower_contactnote" class="required">Contact note:</label>
                                     [% ELSE %]
-                                        <label for="borrower_contactnote">
+                                        <label for="borrower_contactnote">Contact note:</label>
                                     [% END %]
-                                    Contact note:</label>
 
-                                    <textarea id="borrower_contactnote" name="borrower_contactnote" cols="30" rows="2">[% borrower.contactnote %]</textarea>
+                                    <textarea id="borrower_contactnote" name="borrower_contactnote" cols="30" rows="2">[% borrower.contactnote | html %]</textarea>
                                     [% IF mandatory.defined('contactnote') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                     </fieldset>
                 [% END %]
 
-                [% UNLESS
-                    hidden.defined('altcontactsurname') && hidden.defined('altcontactfirstname') && hidden.defined('altcontactaddress1') &&
-                    hidden.defined('altcontactaddress2') && hidden.defined('altcontactaddress3') && hidden.defined('altcontactstate') &&
-                    hidden.defined('altcontactzipcode') && hidden.defined('altcontactcountry') && hidden.defined('altcontactphone')
-                %]
+                [%# Following on one line for translatability %]
+                [% UNLESS hidden.defined('altcontactsurname') && hidden.defined('altcontactfirstname') && hidden.defined('altcontactaddress1') && hidden.defined('altcontactaddress2') && hidden.defined('altcontactaddress3') && hidden.defined('altcontactstate') && hidden.defined('altcontactzipcode') && hidden.defined('altcontactcountry') && hidden.defined('altcontactphone') %]
                     <fieldset class="rows" id="memberentry_alternatecontact">
                         <legend id="alternatecontact_legend">Alternate contact</legend>
 
                             [% UNLESS hidden.defined('altcontactsurname') %]
                                 <li>
                                     [% IF mandatory.defined('altcontactsurname') %]
-                                        <label for="borrower_altcontactsurname" class="required">
+                                        <label for="borrower_altcontactsurname" class="required">Surname:</label>
                                     [% ELSE %]
-                                        <label for="borrower_altcontactsurname">
+                                        <label for="borrower_altcontactsurname">Surname:</label>
                                     [% END %]
-                                    Surname:</label>
 
-                                    <input type="text" id="borrower_altcontactsurname" name="borrower_altcontactsurname" value="[% borrower.altcontactsurname %]" />
+                                    <input type="text" id="borrower_altcontactsurname" name="borrower_altcontactsurname" value="[% borrower.altcontactsurname | html %]" />
                                     [% IF mandatory.defined('altcontactsurname') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('altcontactfirstname') %]
                                 <li>
                                     [% IF mandatory.defined('altcontactfirstname') %]
-                                        <label for="borrower_altcontactfirstname" class="required">
+                                        <label for="borrower_altcontactfirstname" class="required">First name:</label>
                                     [% ELSE %]
-                                        <label for="borrower_altcontactfirstname">
+                                        <label for="borrower_altcontactfirstname">First name:</label>
                                     [% END %]
-                                    First name:</label>
 
-                                    <input type="text" id="borrower_altcontactfirstname" name="borrower_altcontactfirstname" value="[% borrower.altcontactfirstname %]" />
+                                    <input type="text" id="borrower_altcontactfirstname" name="borrower_altcontactfirstname" value="[% borrower.altcontactfirstname | html %]" />
                                     [% IF mandatory.defined('altcontactfirstname') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('altcontactaddress1') %]
                                 <li>
                                     [% IF mandatory.defined('altcontactaddress1') %]
-                                        <label for="borrower_altcontactaddress1" class="required">
+                                        <label for="borrower_altcontactaddress1" class="required">Address:</label>
                                     [% ELSE %]
-                                        <label for="borrower_altcontactaddress1">
+                                        <label for="borrower_altcontactaddress1">Address:</label>
                                     [% END %]
-                                    Address:</label>
 
-                                    <input type="text" id="borrower_altcontactaddress1" name="borrower_altcontactaddress1" value="[% borrower.altcontactaddress1 %]" />
+                                    <input type="text" id="borrower_altcontactaddress1" name="borrower_altcontactaddress1" value="[% borrower.altcontactaddress1 | html %]" />
                                     [% IF mandatory.defined('altcontactaddress1') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('altcontactaddress2') %]
                                 <li>
                                     [% IF mandatory.defined('altcontactaddress2') %]
-                                        <label for="borrower_altcontactaddress2" class="required">
+                                        <label for="borrower_altcontactaddress2" class="required">Address 2:</label>
                                     [% ELSE %]
-                                        <label for="borrower_altcontactaddress2">
+                                        <label for="borrower_altcontactaddress2">Address 2:</label>
                                     [% END %]
-                                    Address 2:</label>
 
-                                    <input type="text" id="borrower_altcontactaddress2" name="borrower_altcontactaddress2" value="[% borrower.altcontactaddress2 %]" />
+                                    <input type="text" id="borrower_altcontactaddress2" name="borrower_altcontactaddress2" value="[% borrower.altcontactaddress2 | html %]" />
                                     [% IF mandatory.defined('altcontactaddress2') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('altcontactaddress3') %]
                                 <li>
                                     [% IF mandatory.defined('altcontactaddress3') %]
-                                        <label for="borrower_altcontactaddress3" class="required">
+                                        <label for="borrower_altcontactaddress3" class="required">City:</label>
                                     [% ELSE %]
-                                        <label for="borrower_altcontactaddress3">
+                                        <label for="borrower_altcontactaddress3">City:</label>
                                     [% END %]
-                                    City:</label>
 
-                                    <input type="text" id="borrower_altcontactaddress3" name="borrower_altcontactaddress3" value="[% borrower.altcontactaddress3 %]" />
+                                    <input type="text" id="borrower_altcontactaddress3" name="borrower_altcontactaddress3" value="[% borrower.altcontactaddress3 | html %]" />
                                     [% IF mandatory.defined('altcontactaddress3') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('altcontactstate') %]
                                 <li>
                                     [% IF mandatory.defined('altcontactstate') %]
-                                        <label for="borrower_altcontactstate" class="required">
+                                        <label for="borrower_altcontactstate" class="required">State:</label>
                                     [% ELSE %]
-                                        <label for="borrower_altcontactstate">
+                                        <label for="borrower_altcontactstate">State:</label>
                                     [% END %]
-                                    State:</label>
 
-                                    <input type="text" id="borrower_altcontactstate" name="borrower_altcontactstate" value="[% borrower.altcontactstate %]" />
+                                    <input type="text" id="borrower_altcontactstate" name="borrower_altcontactstate" value="[% borrower.altcontactstate | html %]" />
                                     [% IF mandatory.defined('altcontactstate') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('altcontactzipcode') %]
                                 <li>
                                     [% IF mandatory.defined('altcontactzipcode') %]
-                                        <label for="borrower_altcontactzipcode" class="required">
+                                        <label for="borrower_altcontactzipcode" class="required">ZIP/Postal code:</label>
                                     [% ELSE %]
-                                        <label for="borrower_altcontactzipcode">
+                                        <label for="borrower_altcontactzipcode">ZIP/Postal code:</label>
                                     [% END %]
-                                    ZIP/Postal code:</label>
 
-                                    <input type="text" id="borrower_altcontactzipcode" name="borrower_altcontactzipcode" value="[% borrower.altcontactzipcode %]" />
+                                    <input type="text" id="borrower_altcontactzipcode" name="borrower_altcontactzipcode" value="[% borrower.altcontactzipcode | html %]" />
                                     [% IF mandatory.defined('altcontactzipcode') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('altcontactcountry') %]
                                 <li>
                                     [% IF mandatory.defined('altcontactcountry') %]
-                                        <label for="borrower_altcontactcountry" class="required">
+                                        <label for="borrower_altcontactcountry" class="required">Country:</label>
                                     [% ELSE %]
-                                        <label for="borrower_altcontactcountry">
+                                        <label for="borrower_altcontactcountry">Country:</label>
                                     [% END %]
-                                    Country:</label>
 
-                                    <input type="text" id="borrower_altcontactcountry" name="borrower_altcontactcountry" value="[% borrower.altcontactcountry %]" />
+                                    <input type="text" id="borrower_altcontactcountry" name="borrower_altcontactcountry" value="[% borrower.altcontactcountry | html %]" />
                                     [% IF mandatory.defined('altcontactcountry') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                             [% UNLESS hidden.defined('altcontactphone') %]
                                 <li>
                                     [% IF mandatory.defined('altcontactphone') %]
-                                        <label for="borrower_altcontactphone" class="required">
+                                        <label for="borrower_altcontactphone" class="required">Phone:</label>
                                     [% ELSE %]
-                                        <label for="borrower_altcontactphone">
+                                        <label for="borrower_altcontactphone">Phone:</label>
                                     [% END %]
-                                    Phone:</label>
 
-                                    <input type="text" id="borrower_altcontactphone" name="borrower_altcontactphone" value="[% borrower.altcontactphone %]" />
+                                    <input type="text" id="borrower_altcontactphone" name="borrower_altcontactphone" value="[% borrower.altcontactphone | html %]" />
                                     [% IF mandatory.defined('altcontactphone') %]<span class="required">Required</span>[% END %]
                                 </li>
                             [% END %]
                 [% UNLESS action == 'edit' || hidden.defined('password') %]
                     <fieldset class="rows" id="memberentry_password">
                         <legend id="contact_legend">Password</legend>
-                        [% IF Koha.Preference('minPasswordLength') || !mandatory.defined('password') %]
-                            <div class="alert alert-info">
-                                [% IF Koha.Preference('minPasswordLength') %]
-                                    <p>Your password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</p>
-                                [% END %]
-                                [% UNLESS mandatory.defined('password') %]
-                                    If you do not enter a password a system generated password will be created.
-                                [% END %]
-                            </div>
-                        [% END %]
+                        <div class="alert alert-info">
+                            <p>Your password must be at least [% Koha.Preference('minPasswordLength') | html %] characters long.</p>
+                            [% UNLESS mandatory.defined('password') %]
+                                <div>If you do not enter a password a system generated password will be created.</div>
+                            [% END %]
+                        </div>
 
                         [% IF mandatory.defined('password') %]
                             <ol>
                                 <li><label for="borrower_password" class="required">Password</label>
-                                    <input type="text" name="borrower_password" id="password" />
+                                    <input type="password" name="borrower_password" id="password" />
                                     <span class="required">Required</span>
                                 </li>
                                 <li><label for="borrower_password2" class="required">Confirm password</label>
-                                    <input type="text" name="borrower_password2" id="password2" />
+                                    <input type="password" name="borrower_password2" id="password2" />
                                     <span class="required">Required</span>
                                 </li>
                             </ol>
                         [% ELSE %]
                             <ol>
                                 <li><label for="borrower_password">Password</label>
-                                    <input type="text" name="borrower_password" id="password" />
+                                    <input type="password" name="borrower_password" id="password" />
                                 </li>
                                 <li><label for="borrower_password2">Confirm password</label>
-                                    <input type="text" name="borrower_password2" id="password2" />
+                                    <input type="password" name="borrower_password2" id="password2" />
                                 </li>
                             </ol>
                         [% END %]
                     </fieldset>
                [% END %]
 
+                [% IF ( Koha.Preference('ExtendedPatronAttributes') && patron_attribute_classes.size && !Koha.Preference('PatronSelfRegistrationVerifyByEmail') ) %]
+                    [% FOREACH pa_class IN patron_attribute_classes %]
+                        [% IF pa_class.class %]
+                            <fieldset id="aai_[% pa_loo.class | html %]" class="rows patron-attributes">
+                            <legend>[% pa_class.lib | html %]</legend>
+                        [% ELSE %]
+                            <fieldset class="rows patron-attributes">
+                            <legend>Additional information</legend>
+                        [% END %]
+                        <ol class="attributes_table">
+                            [% FOREACH pa IN pa_class.items %]
+                                [% FOREACH pa_value IN pa.values %]
+                                    [% IF loop.first %]<a name="patron-attr-start-[% pa.type.code | html %]"></a>[% END %]
+                                    [% form_id = 'patron-attr-' _ Math.int( Math.rand(1000000) ) %]
+                                    <li data-category_code="[% pa.type.category_code | html %]">
+                                        <label for="[% form_id | html %]">[% pa.type.description | html %]: </label>
+                                        [% IF pa.type.opac_editable %]
+                                            <input type="hidden" name="patron_attribute_code" value="[% pa.type.code | html %]" />
+                                            [% IF ( pa.type.authorised_value_category ) %]
+                                                <select id="[% form_id | html %]" name="patron_attribute_value">
+                                                    <option value=""></option>
+                                                    [% FOREACH auth_val IN AuthorisedValues.Get( pa.type.authorised_value_category, 1 ) %]
+                                                        [% IF ( auth_val.authorised_value == pa_value ) %]
+                                                            <option value="[% auth_val.authorised_value | html %]" selected="selected">
+                                                                [% auth_val.lib | html %]
+                                                            </option>
+                                                        [% ELSE %]
+                                                            <option value="[% auth_val.authorised_value | html %]" >
+                                                                [% auth_val.lib | html %]
+                                                            </option>
+                                                        [% END %]
+                                                    [% END %]
+                                                </select>
+                                            [% ELSE %]
+                                                <textarea rows="2" cols="30" id="[% form_id | html %]" name="patron_attribute_value">[% pa_value | html %]</textarea>
+                                            [% END %]
+                                            <a href="#" class="clear-attribute">Clear</a>
+                                            [% IF ( pa.type.repeatable ) %]
+                                            <a href="#" class="clone-attribute">New</a>
+                                            [% END %]
+                                        [% ELSE %]
+                                            [% IF ( pa.type.authorised_value_category ) %]
+                                                [% AuthorisedValues.GetByCode( pa.type.authorised_value_category, pa_value, 1 ) | html_line_break %]
+                                            [% ELSE %]
+                                                [% pa_value | html_line_break %]
+                                            [% END %]
+                                        [% END %]
+                                    </li>
+                                [% END %]
+                            [% END %]
+                        </ol>
+                        </fieldset>
+                    [% END %]
+                [% END %]
+
+                [% IF Koha.Preference('GDPR_Policy') && action != 'edit' %]
+                    <fieldset class="rows" id="memberentry_gdpr_consent">
+                        <legend>GDPR consent</legend>
+                        <ol>
+                        <li>
+                            <label></label><span><input type="checkbox" name="borrower_gdpr_proc_consent" value="agreed"> I agree with your processing of my personal data as outlined in the <a target="_blank" href="[% PrivacyPolicyURL | url %]">privacy policy</a>. <span class="required">Required</span></span>
+                        </li>
+                        </ol>
+                    </fieldset>
+               [% END %]
+
                [% UNLESS action == 'edit' %]
                     <fieldset class="rows" id="memberentry_captcha">
+                        <legend>Verification</legend>
                         <ol>
 
                             <li>
                                 <label for="captcha" class="required">Verification:</label>
 
                                 <input type="text" name="captcha" id="captcha" />
-                                <input type="hidden" name="captcha_digest" value="[% captcha_digest %]" />
+                                <input type="hidden" name="captcha_digest" value="[% captcha_digest | html %]" />
 
-                                <span class="hint">Please type the following characters into the preceding box: <strong>[% captcha %]</strong></span>
-                                <span class="hint">Note: The preceding box is case-sensitive. Ensure that the entered characters are in all-caps.</span>
+                                <span class="hint">Please type the following characters into the preceding box: <strong>[% captcha | html %]</strong></span>
                             </li>
                         </ol>
                     </fieldset>
                 [% END %]
 
-                [% IF ( borrower.ExtendedPatronAttributes ) %]
-                    <fieldset class="rows">
-                        <legend>Additional information</legend>
-                        <ol>
-                            [% FOREACH patron_attribute IN borrower.patron_attributes %]
-                                <li>
-                                    <label>[% patron_attribute.description %]:</label>
-                                    [% IF ( patron_attribute.value_description ) %]
-                                        [% patron_attribute.value_description %]
-                                    [% ELSE %]
-                                        [% patron_attribute.value |html_line_break %]
-                                    [% END %]
-                                </li>
-                            [% END %]
-                        </ol>
-                    </fieldset>
-                [% END %]
-
                 [% IF action == 'edit' %]
                     [% IF OPACPatronDetails %]
                         <fieldset class="action">
                             <input type="hidden" name="action" value="update" />
+                            <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
                             <input type="submit" class="btn" value="Submit update request" />
                         </fieldset>
                     [% END %]
 
 [% INCLUDE 'opac-bottom.inc' %]
 [% BLOCK jsinclude %]
-    <script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.validate.min.js"></script>
-    <script type="text/javascript">
+    [% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %]
+    [% PROCESS 'password_check.inc' %]
+    [% PROCESS 'add_password_check' new_password => 'borrower_password' %]
+    <script>
         //<![CDATA[
         $(document).ready(function() {
             [% IF action == 'edit' && !OPACPatronDetails %]
                 $('#memberentry-form :radio').attr('disabled',true);
                 $('span.required').remove();
                 $('label.required').removeClass('required');
-            [% ELSE %]
-                $( "#borrower_dateofbirth" ).datepicker({ yearRange: "c-120:c" });
             [% END %]
 
             $("#memberentry-form").validate({
                     },
                     borrower_B_email: {
                         email: true
+                    },
+                    borrower_password: {
+                        [% IF mandatory.defined('password') %]
+                        required: true,
+                        [% END %]
+                        password_strong: true,
+                        password_no_spaces: true
+                    },
+                    borrower_password2: {
+                        [% IF mandatory.defined('password') %]
+                        required: true,
+                        [% END %]
+                        password_match: true
+                    },
+                    captcha: {
+                        required: true,
                     }
                 },
                 submitHandler: function(form) {
                      });
                 });
             [% END %]
+
+            $(".patron-attributes").on( 'click', '.clear-attribute', function() {
+                $(this).parent()
+                    .find('textarea').attr('value', '').end()
+                    .find('select').attr('value', '').end();
+
+                return false;
+            } );
+
+            $(".patron-attributes").on( 'click', '.clone-attribute', function() {
+                var clone = $(this).parent().clone().insertAfter( $(this).parent() );
+
+                var newId = 50 + parseInt(Math.random() * 100000);
+                $('input[type!="hidden"],select,textarea', clone).attr('id', 'patron-attr-' + newId).attr('value', '');
+                $("label", clone).attr('for', 'patron-attr-' + newId).attr('value', '');
+
+                return false;
+            } );
         });
+
+    $(".cleardate").on("click", function(){
+        $('#borrower_dateofbirth').val('');
+        return false;
+    });
     //]]>
     </script>
 [% INCLUDE 'calendar.inc' %]