Bug 25364: Add "Other" to the gender options in a patron record
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-memberentry.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE AuthorisedValues %]
4 [% USE Categories %]
5 [% USE Koha %]
6 [% USE Branches %]
7 [% USE KohaDates %]
8 [% USE Math %]
9 [% SET userupdateview = 1 %]
10 [% BLOCK streetnumber %]
11     [% UNLESS hidden.defined('streetnumber') %]
12         <li>
13             [% IF mandatory.defined('streetnumber') %]
14                 <label for="borrower_streetnumber" class="required">Street number:</label>
15             [% ELSE %]
16                 <label for="borrower_streetnumber">Street number:</label>
17             [% END %]
18
19             <input type="text" id="borrower_streetnumber" name="borrower_streetnumber" value="[% borrower.streetnumber | html %]" />
20             [% IF mandatory.defined('streetnumber') %]<span class="required">Required</span>[% END %]
21         </li>
22     [% END %]
23 [% END %]
24
25 [% INCLUDE 'doc-head-open.inc' %]
26     <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>
27 [% INCLUDE 'doc-head-close.inc' %]
28 [% BLOCK cssinclude %][% END %]
29 </head>
30
31 [% IF action == 'edit' %]
32 [% INCLUDE 'bodytag.inc' bodyid='opac-patron-update' %]
33 [% ELSE %]
34 <body id="opac-patron-registration" class="opac">
35 [% END %]
36 [% INCLUDE 'masthead.inc' %]
37
38 <div class="main">
39     <ul class="breadcrumb">
40         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
41         [% IF action == 'edit' %]
42             <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
43             <li><a href="#">Your personal details</a></li>
44         [% ELSE %]
45             <li><a href="#">Register a new account</a></li>
46         [% END %]
47     </ul>
48
49     <div class="container-fluid">
50         <div class="row-fluid">
51             <div class="span2">
52                 <div id="navigation">
53                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
54                 </div>
55             </div>
56             <div class="span10">
57                 [% IF action == 'edit' %]
58                     <div id="update-account" class="maincontent">
59                 [% ELSE %]
60                     <div id="add-account" class="maincontent">
61                 [% END %]
62
63                 [% IF action == 'edit' %]
64                     [% UNLESS OPACPatronDetails %]
65                         <div class="alert alert-info">To make changes to your record please contact the library.</div>
66                     [% END %]
67                     [% IF nochanges %]
68                         <div class="alert alert-error">No changes were made.</div>
69                     [% END %]
70                 [% END %]
71
72                 [% IF empty_mandatory_fields %]
73                     <div class="alert">You have not filled out all required fields. Please fill in all missing fields and resubmit.</div>
74                 [% END %]
75
76                 [% IF invalid_form_fields %]
77                     <div class="alert alert-error"><strong>The following fields contain invalid information:</strong>
78                         <ul>
79                             [% FOREACH field IN invalid_form_fields %]
80                                 [% IF field == "email" %]<li>Contact information: <a href="#borrower_email">primary email address</a></li>[% END %]
81                                 [% IF field == "emailpro" %]<li>Contact information: <a href="#borrower_emailpro">secondary email address</a></li>[% END %]
82                                 [% IF field == "B_email" %]<li>Alternate address information: <a href="#borrower_B_email">email address</a></li>[% END %]
83                                 [% IF field == "password_match" %]<li>Passwords do not match! <a href="#password">password</a></li>[% END %]
84                                 [% IF field == "password_too_short" %]
85                                     <li>Password must be at least [% minPasswordLength | html %] characters long.</li>
86                                 [% END %]
87                                 [% IF field == "password_too_weak" %]
88                                     <li>Password must contain at least one digit, one lowercase and one uppercase.</li>
89                                 [% END %]
90                                 [% IF field == "password_has_whitespaces" %]
91                                     <li>Password must not contain leading or trailing whitespaces.</li>
92                                 [% END %]
93                                 [% IF field == "duplicate_email" %]
94                                     <li>This email address already exists in our database.</li>
95                                 [% END %]
96                                 [% IF field == "email_match" %]
97                                     <li>Emails do not match! <a href="#borrower_repeat_email">confirm email address</a></li>
98                                 [% END %]
99                             [% END %]
100                         </ul>
101                         <span>Please correct and resubmit.</span>
102                     </div>
103                 [% END %]
104
105                 [% IF cardnumber_wrong_length || cardnumber_already_exists %]
106                     <div class="alert alert-error">
107                         [% IF cardnumber_wrong_length %]
108                         <a href="#borrower_cardnumber"><strong>The entered card number is the wrong length.</strong></a>
109                         [% ELSIF cardnumber_already_exists %]
110                         <a href="#borrower_cardnumber"><strong>The entered card number is already in use.</strong></a>
111                         [% END %]
112                         <span>Please correct and resubmit.</span>
113                     </div>
114                 [% END %]
115
116                 [% IF failed_captcha %]
117                     <div class="alert">You typed in the wrong characters in the box before submitting. Please try again.</div>
118                 [% END %]
119
120                 [% IF has_guarantor_flag && !Koha.Preference('OPACPrivacy') && ( Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') || Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') ) %]
121                     <fieldset class="rows" id="memberentry_privacy">
122                         <legend id="privacy_legend">Privacy</legend>
123                         <ol>
124                             [% IF Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
125                             <li>
126                                 <label>Allow your guarantor to view your current checkouts?</label>
127                                 <select id="privacy_guarantor_checkouts">
128                                     <option value="0">No</option>
129                                     [% IF borrower.privacy_guarantor_checkouts %]
130                                         <option value="1" selected="selected">Yes</option>
131                                     [% ELSE %]
132                                         <option value="1">Yes</option>
133                                     [% END %]
134                                 </select>
135                                 <span class="hint">
136                                     <a id="update_privacy_guarantor_checkouts" href="#" class="btn">Update</a>
137                                     <span id="update_privacy_guarantor_checkouts_message" class="alert" style="display:none"></span>
138                                 </span>
139                             </li>
140                             [% END %]
141
142                             [% IF Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') %]
143                             <li>
144                                 <label>Allow your guarantor to view your current fines?</label>
145                                 <select id="privacy_guarantor_fines">
146                                     <option value="0">No</option>
147                                     [% IF borrower.privacy_guarantor_fines %]
148                                         <option value="1" selected="selected">Yes</option>
149                                     [% ELSE %]
150                                         <option value="1">Yes</option>
151                                     [% END %]
152                                 </select>
153                                 <span class="hint">
154                                     <a id="update_privacy_guarantor_fines" href="#" class="btn">Update</a>
155                                     <span id="update_privacy_guarantor_fines_message" class="alert" style="display:none"></span>
156                                 </span>
157                             </li>
158                             [% END %]
159
160                             <li>
161                                 <span class="hint">
162                                     Guaranteed by
163                                     [% FOREACH gr IN patron.guarantor_relationships %]
164                                         [% SET g = gr.guarantor %]
165                                         [% g.firstname | html %] [% g.surname | html %]
166                                         [%- IF ! loop.last %], [% END %]
167                                     [% END %]
168                                 </span>
169                             </li>
170                         </ol>
171                     </fieldset>
172                 [% END %]
173                 [% IF ( extended_unique_id_failed_code ) %]
174                     <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>
175                 [% END %]
176
177                 <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form" autocomplete="off">
178
179                 [%# Following on one line for translatability %]
180                 [% UNLESS ( hidden.defined('cardnumber') || ( !borrower && Koha.Preference('autoMemberNum') ) ) && hidden.defined('dateexpiry') && hidden.defined('branchcode') && hidden.defined('categorycode') %]
181                     <fieldset class="rows" id="memberentry_library">
182
183                         <legend id="library_legend">Library</legend>
184                             <ol>
185                                 [% UNLESS hidden.defined('cardnumber') || ( !borrower && Koha.Preference('autoMemberNum') ) %]
186                                 <li>
187                                     [% IF mandatory.defined('cardnumber') %]
188                                         <label for="borrower_cardnumber" class="required">Library card number:</label>
189                                     [% ELSE %]
190                                         <label for="borrower_cardnumber">Library card number:</label>
191                                     [% END %]
192                                     [% IF borrower && !(cardnumber_wrong_length || cardnumber_already_exists) %]
193                                         [% borrower.cardnumber | html %]
194                                     [% ELSE %]
195                                         [% IF minlength_cardnumber == maxlength_cardnumber %]
196                                             <input type="text" id="borrower_cardnumber" name="borrower_cardnumber" size="20" value="[% borrower.cardnumber | html %]" minlength="[% minlength_cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
197                                             [% IF ( mandatory.defined('cardnumber') ) %]<span class="required">Required</span>[% END %]
198                                             <div class="hint">Card number must be exactly [% minlength_cardnumber | html %] characters.</div>
199                                         [% ELSIF minlength_cardnumber && maxlength_cardnumber %]
200                                             <input type="text" id="borrower_cardnumber" name="borrower_cardnumber" size="20" value="[% borrower.cardnumber | html %]" minlength="[% minlength_cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
201                                             [% IF ( mandatory.defined('cardnumber') ) %]<span class="required">Required</span>[% END %]
202                                             <div class="hint">Card number must be between [% minlength_cardnumber | html %] and [% maxlength_cardnumber | html %] characters.</div>
203                                         [% ELSIF maxlength_cardnumber %]
204                                             <input type="text" id="borrower_cardnumber" name="borrower_cardnumber" size="20" value="[% borrower.cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
205                                             [% IF ( mandatory.defined('cardnumber') ) %]<span class="required">Required</span>[% END %]
206                                             <div class="hint">Card number can be up to [% maxlength_cardnumber | html %] characters.</div>
207                                         [% ELSE %]
208                                             <input type="text" id="borrower_cardnumber" name="borrower_cardnumber" size="20" value="[% borrower.cardnumber | html %]" />
209                                             [% IF ( mandatory.defined('cardnumber') ) %]<span class="required">Required</span>[% END %]
210                                             <div class="hint">There is no minimum or maximum character length.</div>
211                                         [% END %]
212                                     [% END %]
213                                 </li>
214                                 [% END %]
215
216                                 [% UNLESS hidden.defined('dateexpiry') %]
217                                 <li>
218                                     <label>Expiration date:</label>
219                                     [% borrower.dateexpiry | $KohaDates  %]
220                                 </li>
221                                 [% END %]
222
223                                 [% UNLESS hidden.defined('branchcode') %]
224                                     <li>
225                                         [% IF mandatory.defined('branchcode') %]
226                                             <label for="borrower_branchcode" class="required">Home library:</label>
227                                         [% ELSE %]
228                                             <label for="borrower_branchcode">Home library:</label>
229                                         [% END %]
230
231                                         <select id="borrower_branchcode" name="borrower_branchcode">
232                                             [% FOREACH l IN libraries %]
233                                                 [% IF l.branchcode == borrower.branchcode %]
234                                                     <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
235                                                 [% ELSE %]
236                                                     <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
237                                                 [% END %]
238                                             [% END %]
239                                         </select>
240                                     </li>
241                                 [% END %]
242
243                                 [% UNLESS hidden.defined('categorycode') %]
244                                     <li>
245                                         <label for="borrower_categorycode">
246                                         Category:</label>
247
248                                         [% IF borrower %]
249                                             [% Categories.GetName( borrower.categorycode ) | html %]
250                                             <input type="hidden" name="borrower_categorycode" value="[% borrower.categorycode | html %]" />
251                                         [% ELSE %]
252                                             <select id="borrower_categorycode" name="borrower_categorycode">
253                                                 [% FOREACH c IN Categories.all() %]
254                                                     [% IF c.categorycode == Koha.Preference('PatronSelfRegistrationDefaultCategory') %]
255                                                         <option value="[% c.categorycode | html %]" selected="selected">[% c.description | html %]</option>
256                                                     [% ELSE %]
257                                                         <option value="[% c.categorycode | html %]">[% c.description | html %]</option>
258                                                     [% END %]
259                                                 [% END %]
260                                             </select>
261                                         [% END %]
262                                     </li>
263                                 [% END %]
264                             </ol>
265                         </fieldset>
266                 [% END # / defined 'branchcode' %]
267
268                 [%# Following on one line for translatability %]
269                 [% UNLESS hidden.defined('title') && hidden.defined('surname') && hidden.defined('firstname') && hidden.defined('dateofbirth') && hidden.defined('initials') && hidden.defined('othernames') && hidden.defined('sex') %]
270                     <div class="row-fluid">
271                         [% IF ( display_patron_image ) %]
272                             <div class="span8">
273                         [% ELSE %]
274                             <div class="span12">
275                         [% END %]
276                             <fieldset class="rows" id="memberentry_identity">
277                                 <legend id="identity_legend">Identity</legend>
278
279                                 <ol>
280                                     [% UNLESS hidden.defined('title') || !Koha.Preference('BorrowersTitles') %]
281                                         <li>
282                                             [% IF mandatory.defined('title') %]
283                                                 <label for="borrower_title" class="required">Salutation:</label>
284                                             [% ELSE %]
285                                                 <label for="borrower_title">Salutation:</label>
286                                             [% END %]
287
288                                             <select id="borrower_title" name="borrower_title">
289                                                 <option value=""></option>
290                                                 [% FOREACH mt IN Koha.Preference('BorrowersTitles').split('\|') %]
291                                                     [% IF mt == borrower.title %]
292                                                         <option value="[% mt | html %]" selected="selected">[% mt | html %]</option>
293                                                     [% ELSE %]
294                                                         <option value="[% mt | html %]">[% mt | html %]</option>
295                                                     [% END %]
296                                                 [% END %]
297                                             </select>
298                                         </li>
299                                     [% END %]
300
301                                     [% UNLESS hidden.defined('surname') %]
302                                         <li>
303                                             [% IF mandatory.defined('surname') %]
304                                                 <label for="borrower_surname" class="required">Surname:</label>
305                                             [% ELSE %]
306                                                 <label for="borrower_surname">Surname:</label>
307                                             [% END %]
308
309                                             <input type="text" id="borrower_surname" name="borrower_surname" value="[% borrower.surname | html %]" />
310                                             [% IF mandatory.defined('surname') %]<span class="required">Required</span>[% END %]
311                                         </li>
312                                     [% END %]
313
314                                     [% UNLESS hidden.defined('firstname') %]
315                                         <li>
316                                             [% IF mandatory.defined('firstname') %]
317                                                 <label for="borrower_firstname" class="required">First name:</label>
318                                             [% ELSE %]
319                                                 <label for="borrower_firstname">First name:</label>
320                                             [% END %]
321
322                                             <input type="text" id="borrower_firstname" name="borrower_firstname" value="[% borrower.firstname | html %]" />
323                                             [% IF mandatory.defined('firstname') %]<span class="required">Required</span>[% END %]
324                                         </li>
325                                     [% END %]
326
327                                     [% UNLESS hidden.defined('dateofbirth') %]
328                                         <li>
329                                             [% IF mandatory.defined('dateofbirth') %]
330                                                 <label for="borrower_dateofbirth" class="required">Date of birth:</label>
331                                             [% ELSE %]
332                                                 <label for="borrower_dateofbirth">Date of birth:</label>
333                                             [% END %]
334
335                                             <input type="text" id="borrower_dateofbirth" name="borrower_dateofbirth" value="[% borrower.dateofbirth | $KohaDates %]" size="10" />
336
337                                             [% UNLESS action == 'edit' && !OPACPatronDetails %]
338                                                 [% UNLESS ( mandatory.defined('dateofbirth') ) %]
339                                                     <a href="#" style="font-size:85%;text-decoration:none;" class="cleardate">Clear date</a>
340                                                 [% END %]
341                                             [% END %]
342
343                                             [% IF mandatory.defined('dateofbirth') %]<span class="required">Required</span>[% END %]
344                                         </li>
345                                     [% END %]
346
347                                     [% UNLESS hidden.defined('initials') %]
348                                         <li>
349                                             [% IF mandatory.defined('initials') %]
350                                                 <label for="borrower_initials" class="required">Initials:</label>
351                                             [% ELSE %]
352                                                 <label for="borrower_initials">Initials:</label>
353                                             [% END %]
354
355                                             <input type="text" id="borrower_initials" name="borrower_initials" value="[% borrower.initials | html %]" />
356                                             [% IF mandatory.defined('initials') %]<span class="required">Required</span>[% END %]
357                                         </li>
358                                     [% END %]
359
360                                     [% UNLESS hidden.defined('othernames') %]
361                                         <li>
362                                             [% IF mandatory.defined('othernames') %]
363                                                 <label for="borrower_othernames" class="required">Other names:</label>
364                                             [% ELSE %]
365                                                 <label for="borrower_othernames">Other names:</label>
366                                             [% END %]
367
368                                             <input type="text" id="borrower_othernames" name="borrower_othernames" value="[% borrower.othernames | html %]" />
369                                             [% IF mandatory.defined('othernames') %]<span class="required">Required</span>[% END %]
370                                         </li>
371                                     [% END %]
372
373                                     [% UNLESS hidden.defined('sex') %]
374                                         <li class="lradio">
375                                             <label for="sex-female" class="radio inline"><span class="patronsex-female">Female:</span></label>
376                                             [% IF borrower.sex == 'F' %]
377                                                 <input type="radio" name="borrower_sex" id="sex-female" value="F" checked="checked" />
378                                             [% ELSE %]
379                                                 <input type="radio" name="borrower_sex" id="sex-female" value="F" />
380                                             [% END %]
381
382                                             <label for="sex-male" class="radio inline"><span class="patronsex-male">Male:</span></label>
383                                             [% IF borrower.sex == 'M' %]
384                                                 <input type="radio" name="borrower_sex" id="sex-male" value="M" checked="checked" />
385                                             [% ELSE %]
386                                                 <input type="radio" name="borrower_sex" id="sex-male" value="M" />
387                                             [% END %]
388
389                                             <label for="sex-other" class="radio inline"><span class="patronsex-other">Other:</span></label>
390                                             [% IF borrower.sex == 'O' %]
391                                                 <input type="radio" name="borrower_sex" id="sex-other" value="O" checked="checked" />
392                                             [% ELSE %]
393                                                 <input type="radio" name="borrower_sex" id="sex-other" value="O" />
394                                             [% END %]
395
396
397                                             <label for="sex-none" class="radio inline"><span class="patronsex-none">None specified / Prefer not to say:</span></label>
398                                             [% IF borrower.sex == '' %]
399                                                 <input type="radio" name="borrower_sex" id="sex-none" value="" checked="checked" />
400                                             [% ELSE %]
401                                                 <input type="radio" name="borrower_sex" id="sex-none" value="" />
402                                             [% END %]
403
404                                             [% IF mandatory.defined('sex') %]<span class="required">Required</span>[% END %]
405                                         </li>
406                                     [% END %]
407                                 </ol>
408                             </fieldset>
409                            </div>
410                         [% IF ( display_patron_image ) %]
411                             <div class="span4">
412                                 <p class="patronimage">
413                                    <img src="/cgi-bin/koha/opac-patron-image.pl" alt="" />
414                                 </p>
415                             </div>
416                         [% END %]
417                     </div>
418                 [% END # /UNLESS fields hidden %]
419
420                 [%# Following on one line for translatability %]
421                 [% UNLESS hidden.defined('streetnumber') && hidden.defined('address') && hidden.defined('address2') && hidden.defined('city') && hidden.defined('state') && hidden.defined('zipcode') && hidden.defined('country') %]
422                     <fieldset class="rows" id="memberentry_mainaddress">
423                         <legend id="mainaddress_legend">Main address</legend>
424
425                         <ol>
426                             [% IF Koha.Preference('AddressFormat') != 'de' %][% INCLUDE streetnumber %][% END %]
427
428                             [% UNLESS hidden.defined('address') %]
429                                 <li>
430                                     [% IF mandatory.defined('address') %]
431                                         <label for="borrower_address" class="required">Address:</label>
432                                     [% ELSE %]
433                                         <label for="borrower_address">Address:</label>
434                                     [% END %]
435
436                                     <input type="text" id="borrower_address" name="borrower_address" value="[% borrower.address | html %]" />
437                                     [% IF mandatory.defined('address') %]<span class="required">Required</span>[% END %]
438                                 </li>
439                             [% END %]
440
441                             [% IF Koha.Preference('AddressFormat') == 'de' %][% INCLUDE streetnumber %][% END %]
442
443                             [% UNLESS hidden.defined('address2') %]
444                                 <li>
445                                     [% IF mandatory.defined('address2') %]
446                                         <label for="borrower_address2" class="required">Address 2:</label>
447                                     [% ELSE %]
448                                         <label for="borrower_address2">Address 2:</label>
449                                     [% END %]
450
451                                     <input type="text" id="borrower_address2" name="borrower_address2" value="[% borrower.address2 | html %]" />
452                                     [% IF mandatory.defined('address2') %]<span class="required">Required</span>[% END %]
453                                 </li>
454                             [% END %]
455
456                             [% UNLESS hidden.defined('city') %]
457                                 <li>
458                                     [% IF mandatory.defined('city') %]
459                                         <label for="borrower_city" class="required">City:</label>
460                                     [% ELSE %]
461                                         <label for="borrower_city">City:</label>
462                                     [% END %]
463
464                                     <input type="text" id="borrower_city" name="borrower_city" value="[% borrower.city | html %]" />
465                                     [% IF mandatory.defined('city') %]<span class="required">Required</span>[% END %]
466                                 </li>
467                             [% END %]
468
469                             [% UNLESS hidden.defined('state') %]
470                                 <li>
471                                     [% IF mandatory.defined('state') %]
472                                         <label for="borrower_state" class="required">State:</label>
473                                     [% ELSE %]
474                                         <label for="borrower_state">State:</label>
475                                     [% END %]
476
477                                     <input type="text" id="borrower_state" name="borrower_state" value="[% borrower.state | html %]" />
478                                     [% IF mandatory.defined('state') %]<span class="required">Required</span>[% END %]
479                                 </li>
480                             [% END %]
481
482                             [% UNLESS hidden.defined('zipcode') %]
483                                 <li>
484                                     [% IF mandatory.defined('zipcode') %]
485                                         <label for="borrower_zipcode" class="required">ZIP/Postal code:</label>
486                                     [% ELSE %]
487                                         <label for="borrower_zipcode">ZIP/Postal code:</label>
488                                     [% END %]
489
490                                     <input type="text" id="borrower_zipcode" name="borrower_zipcode" value="[% borrower.zipcode | html %]" />
491                                     [% IF mandatory.defined('zipcode') %]<span class="required">Required</span>[% END %]
492                                 </li>
493                             [% END %]
494
495                             [% UNLESS hidden.defined('country') %]
496                                 <li>
497                                     [% IF mandatory.defined('country') %]
498                                         <label for="borrower_country" class="required">Country:</label>
499                                     [% ELSE %]
500                                         <label for="borrower_country">Country:</label>
501                                     [% END %]
502
503                                     <input type="text" id="borrower_country" name="borrower_country" value="[% borrower.country | html %]" />
504                                     [% IF mandatory.defined('country') %]<span class="required">Required</span>[% END %]
505                                 </li>
506                             [% END %]
507
508                         </ol>
509                     </fieldset>
510                 [% END %]
511
512                 [%# Following on one line for translatability %]
513                 [% UNLESS hidden.defined('phone') && hidden.defined('phonepro') && hidden.defined('mobile') && hidden.defined('email') && hidden.defined('emailpro') && hidden.defined('fax') %]
514                     <fieldset class="rows" id="memberentry_contact">
515                         <legend id="contact_legend">Contact information</legend>
516
517                         <ol>
518                             [% UNLESS hidden.defined('phone') %]
519                                 <li>
520                                     [% IF mandatory.defined('phone') %]
521                                         <label for="borrower_phone" class="required">Primary phone:</label>
522                                     [% ELSE %]
523                                         <label for="borrower_phone">Primary phone:</label>
524                                     [% END %]
525
526                                     <input type="text" id="borrower_phone" name="borrower_phone" value="[% borrower.phone | html %]" />
527                                     [% IF mandatory.defined('phone') %]<span class="required">Required</span>[% END %]
528                                 </li>
529                             [% END %]
530
531                             [% UNLESS hidden.defined('phonepro') %]
532                                 <li>
533                                     [% IF mandatory.defined('phonepro') %]
534                                         <label for="borrower_phonepro" class="required">Secondary phone:</label>
535                                     [% ELSE %]
536                                         <label for="borrower_phonepro">Secondary phone:</label>
537                                     [% END %]
538
539                                     <input type="text" id="borrower_phonepro" name="borrower_phonepro" value="[% borrower.phonepro | html %]" />
540                                     [% IF mandatory.defined('phonepro') %]<span class="required">Required</span>[% END %]
541                                 </li>
542                             [% END %]
543
544                             [% UNLESS hidden.defined('mobile') %]
545                                 <li>
546                                     [% IF mandatory.defined('mobile') %]
547                                         <label for="borrower_mobile" class="required">Other phone:</label>
548                                     [% ELSE %]
549                                         <label for="borrower_mobile">Other phone:</label>
550                                     [% END %]
551
552                                     <input type="text" id="borrower_mobile" name="borrower_mobile" value="[% borrower.mobile | html %]" />
553                                     [% IF mandatory.defined('mobile') %]<span class="required">Required</span>[% END %]
554                                 </li>
555                             [% END %]
556
557                             [% UNLESS hidden.defined('email') %]
558                                 <li>
559                                     [% IF mandatory.defined('email') %]
560                                         <label for="borrower_email" class="required">Primary email:</label>
561                                     [% ELSE %]
562                                         <label for="borrower_email">Primary email:</label>
563                                     [% END %]
564
565                                     <input type="text" id="borrower_email" name="borrower_email" value="[% borrower.email | html %]" />
566                                     [% IF mandatory.defined('email') %]<span class="required">Required</span>[% END %]
567                                 </li>
568
569                                 [% IF action != 'edit' and Koha.Preference('PatronSelfRegistrationConfirmEmail') %]
570                                     <li>
571                                         [% IF mandatory.defined('email') %]
572                                             <label for="borrower_repeat_email" class="required">Confirm primary email:</label>
573                                         [% ELSE %]
574                                             <label for="borrower_repeat_email">Confirm primary email:</label>
575                                         [% END %]
576
577                                         <input type="text" id="borrower_repeat_email" name="borrower_repeat_email" autocomplete=off>
578                                         [% IF mandatory.defined('email') %]<span class="required">Required</span>[% END %]
579                                     </li>
580                                 [% END %]
581                             [% END %]
582
583                             [% UNLESS hidden.defined('emailpro') %]
584                                 <li>
585                                     [% IF mandatory.defined('emailpro') %]
586                                         <label for="borrower_emailpro" class="required">Secondary email:</label>
587                                     [% ELSE %]
588                                         <label for="borrower_emailpro">Secondary email:</label>
589                                     [% END %]
590
591                                     <input type="text" id="borrower_emailpro" name="borrower_emailpro" value="[% borrower.emailpro | html %]" />
592                                     [% IF mandatory.defined('emailpro') %]<span class="required">Required</span>[% END %]
593                                 </li>
594                             [% END %]
595
596                             [% UNLESS hidden.defined('fax') %]
597                                 <li>
598                                     [% IF mandatory.defined('fax') %]
599                                         <label for="borrower_fax" class="required">Fax:</label>
600                                     [% ELSE %]
601                                         <label for="borrower_fax">Fax:</label>
602                                     [% END %]
603
604                                     <input type="text" id="borrower_fax" name="borrower_fax" value="[% borrower.fax | html %]" />
605                                     [% IF mandatory.defined('fax') %]<span class="required">Required</span>[% END %]
606                                 </li>
607                             [% END %]
608                         </ol>
609                     </fieldset>
610                 [% END %]
611
612                 [%# Following on one line for translatability %]
613                 [% 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') %]
614                     <fieldset class="rows" id="memberentry_alternateaddress">
615                         <legend id="alternateaddress_legend">Alternate address</legend>
616
617                         <ol>
618                             [% UNLESS hidden.defined('B_address') %]
619                                 <li>
620                                     [% IF mandatory.defined('B_address') %]
621                                         <label for="borrower_B_address" class="required">Address:</label>
622                                     [% ELSE %]
623                                         <label for="borrower_B_address">Address:</label>
624                                     [% END %]
625
626                                     <input type="text" id="borrower_B_address" name="borrower_B_address" value="[% borrower.B_address | html %]" />
627                                     [% IF mandatory.defined('B_address') %]<span class="required">Required</span>[% END %]
628                                 </li>
629                             [% END %]
630
631                             [% UNLESS hidden.defined('B_address2') %]
632                                 <li>
633                                     [% IF mandatory.defined('B_address2') %]
634                                         <label for="borrower_B_address2" class="required">Address 2:</label>
635                                     [% ELSE %]
636                                         <label for="borrower_B_address2">Address 2:</label>
637                                     [% END %]
638
639                                     <input type="text" id="borrower_B_address2" name="borrower_B_address2" value="[% borrower.B_address2 | html %]" />
640                                     [% IF mandatory.defined('B_address2') %]<span class="required">Required</span>[% END %]
641                                 </li>
642                             [% END %]
643
644                             [% UNLESS hidden.defined('B_city') %]
645                                 <li>
646                                     [% IF mandatory.defined('B_city') %]
647                                         <label for="borrower_B_city" class="required">City:</label>
648                                     [% ELSE %]
649                                         <label for="borrower_B_city">City:</label>
650                                     [% END %]
651
652                                     <input type="text" id="borrower_B_city" name="borrower_B_city" value="[% borrower.B_city | html %]" />
653                                     [% IF mandatory.defined('B_city') %]<span class="required">Required</span>[% END %]
654                                 </li>
655                             [% END %]
656
657                             [% UNLESS hidden.defined('B_state') %]
658                                 <li>
659                                     [% IF mandatory.defined('B_state') %]
660                                         <label for="borrower_B_state" class="required">State:</label>
661                                     [% ELSE %]
662                                         <label for="borrower_B_state">State:</label>
663                                     [% END %]
664
665                                     <input type="text" id="borrower_B_state" name="borrower_B_state" value="[% borrower.B_state | html %]" />
666                                     [% IF mandatory.defined('B_state') %]<span class="required">Required</span>[% END %]
667                                 </li>
668                             [% END %]
669
670                             [% UNLESS hidden.defined('B_zipcode') %]
671                                 <li>
672                                     [% IF mandatory.defined('B_zipcode') %]
673                                         <label for="borrower_B_zipcode" class="required">ZIP/Postal code:</label>
674                                     [% ELSE %]
675                                         <label for="borrower_B_zipcode">ZIP/Postal code:</label>
676                                     [% END %]
677
678                                     <input type="text" id="borrower_B_zipcode" name="borrower_B_zipcode" value="[% borrower.B_zipcode | html %]" />
679                                     [% IF mandatory.defined('B_zipcode') %]<span class="required">Required</span>[% END %]
680                                 </li>
681                             [% END %]
682
683                             [% UNLESS hidden.defined('B_country') %]
684                                 <li>
685                                     [% IF mandatory.defined('B_country') %]
686                                         <label for="borrower_B_country" class="required">Country:</label>
687                                     [% ELSE %]
688                                         <label for="borrower_B_country">Country:</label>
689                                     [% END %]
690
691                                     <input type="text" id="borrower_B_country" name="borrower_B_country" value="[% borrower.B_country | html %]" />
692                                     [% IF mandatory.defined('B_country') %]<span class="required">Required</span>[% END %]
693                                 </li>
694                             [% END %]
695
696                             [% UNLESS hidden.defined('B_phone') %]
697                                 <li>
698                                     [% IF mandatory.defined('B_phone') %]
699                                         <label for="borrower_B_phone" class="required">Phone:</label>
700                                     [% ELSE %]
701                                         <label for="borrower_B_phone">Phone:</label>
702                                     [% END %]
703
704                                     <input type="text" id="borrower_B_phone" name="borrower_B_phone" value="[% borrower.B_phone | html %]" />
705                                     [% IF mandatory.defined('B_phone') %]<span class="required">Required</span>[% END %]
706                                 </li>
707                             [% END %]
708
709                             [% UNLESS hidden.defined('B_email') %]
710                                 <li>
711                                     [% IF mandatory.defined('B_email') %]
712                                         <label for="borrower_B_email" class="required">Email:</label>
713                                     [% ELSE %]
714                                         <label for="borrower_B_email">Email:</label>
715                                     [% END %]
716
717                                     <input type="text" id="borrower_B_email" name="borrower_B_email" value="[% borrower.B_email | html %]" />
718                                     [% IF mandatory.defined('B_email') %]<span class="required">Required</span>[% END %]
719                                 </li>
720                             [% END %]
721
722                             [% UNLESS hidden.defined('contactnote') %]
723                                 <li>
724                                     [% IF mandatory.defined('contactnote') %]
725                                         <label for="borrower_contactnote" class="required">Contact note:</label>
726                                     [% ELSE %]
727                                         <label for="borrower_contactnote">Contact note:</label>
728                                     [% END %]
729
730                                     <textarea id="borrower_contactnote" name="borrower_contactnote" cols="30" rows="2">[% borrower.contactnote | html %]</textarea>
731                                     [% IF mandatory.defined('contactnote') %]<span class="required">Required</span>[% END %]
732                                 </li>
733                             [% END %]
734
735                         </ol>
736                     </fieldset>
737                 [% END %]
738
739                 [%# Following on one line for translatability %]
740                 [% 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') %]
741                     <fieldset class="rows" id="memberentry_alternatecontact">
742                         <legend id="alternatecontact_legend">Alternate contact</legend>
743
744                         <ol>
745                             [% UNLESS hidden.defined('altcontactsurname') %]
746                                 <li>
747                                     [% IF mandatory.defined('altcontactsurname') %]
748                                         <label for="borrower_altcontactsurname" class="required">Surname:</label>
749                                     [% ELSE %]
750                                         <label for="borrower_altcontactsurname">Surname:</label>
751                                     [% END %]
752
753                                     <input type="text" id="borrower_altcontactsurname" name="borrower_altcontactsurname" value="[% borrower.altcontactsurname | html %]" />
754                                     [% IF mandatory.defined('altcontactsurname') %]<span class="required">Required</span>[% END %]
755                                 </li>
756                             [% END %]
757
758                             [% UNLESS hidden.defined('altcontactfirstname') %]
759                                 <li>
760                                     [% IF mandatory.defined('altcontactfirstname') %]
761                                         <label for="borrower_altcontactfirstname" class="required">First name:</label>
762                                     [% ELSE %]
763                                         <label for="borrower_altcontactfirstname">First name:</label>
764                                     [% END %]
765
766                                     <input type="text" id="borrower_altcontactfirstname" name="borrower_altcontactfirstname" value="[% borrower.altcontactfirstname | html %]" />
767                                     [% IF mandatory.defined('altcontactfirstname') %]<span class="required">Required</span>[% END %]
768                                 </li>
769                             [% END %]
770
771                             [% UNLESS hidden.defined('altcontactaddress1') %]
772                                 <li>
773                                     [% IF mandatory.defined('altcontactaddress1') %]
774                                         <label for="borrower_altcontactaddress1" class="required">Address:</label>
775                                     [% ELSE %]
776                                         <label for="borrower_altcontactaddress1">Address:</label>
777                                     [% END %]
778
779                                     <input type="text" id="borrower_altcontactaddress1" name="borrower_altcontactaddress1" value="[% borrower.altcontactaddress1 | html %]" />
780                                     [% IF mandatory.defined('altcontactaddress1') %]<span class="required">Required</span>[% END %]
781                                 </li>
782                             [% END %]
783
784                             [% UNLESS hidden.defined('altcontactaddress2') %]
785                                 <li>
786                                     [% IF mandatory.defined('altcontactaddress2') %]
787                                         <label for="borrower_altcontactaddress2" class="required">Address 2:</label>
788                                     [% ELSE %]
789                                         <label for="borrower_altcontactaddress2">Address 2:</label>
790                                     [% END %]
791
792                                     <input type="text" id="borrower_altcontactaddress2" name="borrower_altcontactaddress2" value="[% borrower.altcontactaddress2 | html %]" />
793                                     [% IF mandatory.defined('altcontactaddress2') %]<span class="required">Required</span>[% END %]
794                                 </li>
795                             [% END %]
796
797                             [% UNLESS hidden.defined('altcontactaddress3') %]
798                                 <li>
799                                     [% IF mandatory.defined('altcontactaddress3') %]
800                                         <label for="borrower_altcontactaddress3" class="required">City:</label>
801                                     [% ELSE %]
802                                         <label for="borrower_altcontactaddress3">City:</label>
803                                     [% END %]
804
805                                     <input type="text" id="borrower_altcontactaddress3" name="borrower_altcontactaddress3" value="[% borrower.altcontactaddress3 | html %]" />
806                                     [% IF mandatory.defined('altcontactaddress3') %]<span class="required">Required</span>[% END %]
807                                 </li>
808                             [% END %]
809
810                             [% UNLESS hidden.defined('altcontactstate') %]
811                                 <li>
812                                     [% IF mandatory.defined('altcontactstate') %]
813                                         <label for="borrower_altcontactstate" class="required">State:</label>
814                                     [% ELSE %]
815                                         <label for="borrower_altcontactstate">State:</label>
816                                     [% END %]
817
818                                     <input type="text" id="borrower_altcontactstate" name="borrower_altcontactstate" value="[% borrower.altcontactstate | html %]" />
819                                     [% IF mandatory.defined('altcontactstate') %]<span class="required">Required</span>[% END %]
820                                 </li>
821                             [% END %]
822
823                             [% UNLESS hidden.defined('altcontactzipcode') %]
824                                 <li>
825                                     [% IF mandatory.defined('altcontactzipcode') %]
826                                         <label for="borrower_altcontactzipcode" class="required">ZIP/Postal code:</label>
827                                     [% ELSE %]
828                                         <label for="borrower_altcontactzipcode">ZIP/Postal code:</label>
829                                     [% END %]
830
831                                     <input type="text" id="borrower_altcontactzipcode" name="borrower_altcontactzipcode" value="[% borrower.altcontactzipcode | html %]" />
832                                     [% IF mandatory.defined('altcontactzipcode') %]<span class="required">Required</span>[% END %]
833                                 </li>
834                             [% END %]
835
836                             [% UNLESS hidden.defined('altcontactcountry') %]
837                                 <li>
838                                     [% IF mandatory.defined('altcontactcountry') %]
839                                         <label for="borrower_altcontactcountry" class="required">Country:</label>
840                                     [% ELSE %]
841                                         <label for="borrower_altcontactcountry">Country:</label>
842                                     [% END %]
843
844                                     <input type="text" id="borrower_altcontactcountry" name="borrower_altcontactcountry" value="[% borrower.altcontactcountry | html %]" />
845                                     [% IF mandatory.defined('altcontactcountry') %]<span class="required">Required</span>[% END %]
846                                 </li>
847                             [% END %]
848
849                             [% UNLESS hidden.defined('altcontactphone') %]
850                                 <li>
851                                     [% IF mandatory.defined('altcontactphone') %]
852                                         <label for="borrower_altcontactphone" class="required">Phone:</label>
853                                     [% ELSE %]
854                                         <label for="borrower_altcontactphone">Phone:</label>
855                                     [% END %]
856
857                                     <input type="text" id="borrower_altcontactphone" name="borrower_altcontactphone" value="[% borrower.altcontactphone | html %]" />
858                                     [% IF mandatory.defined('altcontactphone') %]<span class="required">Required</span>[% END %]
859                                 </li>
860                             [% END %]
861                         </ol>
862                     </fieldset>
863                 [% END %]
864
865                 [% UNLESS action == 'edit' || hidden.defined('password') %]
866                     <fieldset class="rows" id="memberentry_password">
867                         <legend id="contact_legend">Password</legend>
868                         <div class="alert alert-info">
869                             [% IF ( Koha.Preference('RequireStrongPassword') ) %]
870                                 <p>Your password must contain at least [% Koha.Preference('minPasswordLength') | html %] characters, including UPPERCASE, lowercase and numbers.</p>
871                             [% ELSE %]
872                                 <p>Your password must be at least [% Koha.Preference('minPasswordLength') | html %] characters long.</p>
873                             [% END %]
874                             [% UNLESS mandatory.defined('password') %]
875                                 <p>If you do not enter a password a system generated password will be created.</p>
876                             [% END %]
877                         </div>
878
879                         [% IF mandatory.defined('password') %]
880                             <ol>
881                                 <li><label for="borrower_password" class="required">Password</label>
882                                     <input type="password" name="borrower_password" id="password" />
883                                     <span class="required">Required</span>
884                                 </li>
885                                 <li><label for="borrower_password2" class="required">Confirm password</label>
886                                     <input type="password" name="borrower_password2" id="password2" />
887                                     <span class="required">Required</span>
888                                 </li>
889                             </ol>
890                         [% ELSE %]
891                             <ol>
892                                 <li><label for="borrower_password">Password</label>
893                                     <input type="password" name="borrower_password" id="password" />
894                                 </li>
895                                 <li><label for="borrower_password2">Confirm password</label>
896                                     <input type="password" name="borrower_password2" id="password2" />
897                                 </li>
898                             </ol>
899                         [% END %]
900                     </fieldset>
901                [% END %]
902
903                 [% IF ( Koha.Preference('ExtendedPatronAttributes') && patron_attribute_classes.size && action != 'new' ) %]
904                     [% FOREACH pa_class IN patron_attribute_classes %]
905                         [% IF pa_class.class %]
906                             <fieldset id="aai_[% pa_loo.class | html %]" class="rows patron-attributes">
907                             <legend>[% pa_class.lib | html %]</legend>
908                         [% ELSE %]
909                             <fieldset class="rows patron-attributes">
910                             <legend>Additional information</legend>
911                         [% END %]
912                         <ol class="attributes_table">
913                             [% FOREACH pa IN pa_class.items %]
914                                 [% FOREACH pa_value IN pa.values %]
915                                     [% IF loop.first %]<a name="patron-attr-start-[% pa.type.code | html %]"></a>[% END %]
916                                     [% form_id = 'patron-attr-' _ Math.int( Math.rand(1000000) ) %]
917                                     <li data-category_code="[% pa.type.category_code | html %]">
918                                         [% IF pa.type.mandatory && pa.type.opac_editable %]
919                                             <label for="[% form_id | html %]" class="required">[% pa.type.description | html %]: </label>
920                                         [% ELSE %]
921                                             <label for="[% form_id | html %]">[% pa.type.description | html %]: </label>
922                                         [% END %]
923                                         [% IF pa.type.opac_editable %]
924                                             <input type="hidden" name="patron_attribute_code" value="[% pa.type.code | html %]" />
925                                             [% IF ( pa.type.authorised_value_category ) %]
926                                                 <select id="[% form_id | html %]" name="patron_attribute_value">
927                                                     <option value=""></option>
928                                                     [% FOREACH auth_val IN AuthorisedValues.Get( pa.type.authorised_value_category, 1 ) %]
929                                                         [% IF ( auth_val.authorised_value == pa_value ) %]
930                                                             <option value="[% auth_val.authorised_value | html %]" selected="selected">
931                                                                 [% auth_val.lib | html %]
932                                                             </option>
933                                                         [% ELSE %]
934                                                             <option value="[% auth_val.authorised_value | html %]" >
935                                                                 [% auth_val.lib | html %]
936                                                             </option>
937                                                         [% END %]
938                                                     [% END %]
939                                                 </select>
940                                             [% ELSE %]
941                                                 <textarea rows="2" cols="30" id="[% form_id | html %]" name="patron_attribute_value">[% pa_value | html %]</textarea>
942                                             [% END %]
943                                             [% IF pa.type.mandatory %]
944                                                 <span class="required">Required</span>
945                                             [% END %]
946                                             <a href="#" class="clear-attribute">Clear</a>
947                                             [% IF ( pa.type.repeatable ) %]
948                                             <a href="#" class="clone-attribute">New</a>
949                                             [% END %]
950                                         [% ELSE %]
951                                             [% IF ( pa.type.authorised_value_category ) %]
952                                                 [% AuthorisedValues.GetByCode( pa.type.authorised_value_category, pa_value, 1 ) | html_line_break %]
953                                             [% ELSE %]
954                                                 [% pa_value | html_line_break %]
955                                             [% END %]
956                                         [% END %]
957                                     </li>
958                                 [% END %]
959                             [% END %]
960                         </ol>
961                         </fieldset>
962                     [% END %]
963                 [% END %]
964
965                 [% IF Koha.Preference('GDPR_Policy') && action != 'edit' %]
966                     <fieldset class="rows" id="memberentry_gdpr_consent">
967                         <legend>GDPR consent</legend>
968                         <ol>
969                         <li>
970                             <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="[% Koha.Preference('PrivacyPolicyURL') | url %]">privacy policy</a>. <span class="required">Required</span></span>
971                         </li>
972                         </ol>
973                     </fieldset>
974                [% END %]
975
976                [% UNLESS action == 'edit' %]
977                     <fieldset class="rows" id="memberentry_captcha">
978                         <legend>Verification</legend>
979                         <ol>
980
981                             <li>
982                                 <label for="captcha" class="required">Verification:</label>
983
984                                 <input type="text" name="captcha" id="captcha" />
985                                 <input type="hidden" name="captcha_digest" value="[% captcha_digest | html %]" />
986
987                                 <span class="hint">Please type the following characters into the preceding box: <strong>[% captcha | html %]</strong></span>
988                             </li>
989                         </ol>
990                     </fieldset>
991                 [% END %]
992
993                 [% IF action == 'edit' %]
994                     [% IF OPACPatronDetails %]
995                         <fieldset class="action">
996                             <input type="hidden" name="action" value="update" />
997                             <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
998                             <input type="submit" class="btn" value="Submit update request" />
999                         </fieldset>
1000                     [% END %]
1001                 [% ELSE %]
1002                     <fieldset class="action">
1003                         <input type="hidden" name="action" value="create" />
1004                         <input type="submit" class="btn" value="Submit" />
1005                     </fieldset>
1006                 [% END %]
1007
1008                 </form>
1009
1010                     </div><!--/div id="update-account" -->
1011                 </div>
1012             </div>
1013         </div>
1014     </div>
1015
1016 [% INCLUDE 'opac-bottom.inc' %]
1017 [% BLOCK jsinclude %]
1018     [% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %]
1019     [% PROCESS 'password_check.inc' %]
1020     [% PROCESS 'add_password_check' new_password => 'borrower_password' %]
1021     <script>
1022         //<![CDATA[
1023         $(document).ready(function() {
1024             [% IF action == 'edit' && !OPACPatronDetails %]
1025                 $("#memberentry-form :input").attr('readonly', true);
1026                 $("#borrower_branchcode").attr('disabled',true);
1027                 $("#borrower_title").attr('disabled',true);
1028                 $('#memberentry-form :radio').attr('disabled',true);
1029                 $('span.required').remove();
1030                 $('label.required').removeClass('required');
1031             [% END %]
1032
1033             $("#memberentry-form").validate({
1034                 rules: {
1035                     borrower_email: {
1036                         email: true
1037                     },
1038                     borrower_repeat_email: {
1039                         equalTo: '#borrower_email'
1040                     },
1041                     borrower_emailpro: {
1042                         email: true
1043                     },
1044                     borrower_B_email: {
1045                         email: true
1046                     },
1047                     borrower_password: {
1048                         [% IF mandatory.defined('password') %]
1049                         required: true,
1050                         [% END %]
1051                         password_strong: true,
1052                         password_no_spaces: true
1053                     },
1054                     borrower_password2: {
1055                         [% IF mandatory.defined('password') %]
1056                         required: true,
1057                         [% END %]
1058                         password_match: true
1059                     },
1060                     captcha: {
1061                         required: true,
1062                     }
1063                 },
1064                 submitHandler: function(form) {
1065                     if (form.beenSubmitted) {
1066                         return false;
1067                     }
1068                     else {
1069                         form.beenSubmitted = true;
1070                         form.submit();
1071                     }
1072                 },
1073                 errorPlacement: function(error, element) {
1074                     offset = element.offset();
1075                     error.insertAfter(element)
1076                     error.addClass('error');  // add a class to the wrapper
1077                     error.css('position', 'absolute');
1078                     error.css('left', offset.left + element.outerWidth() + 10);
1079                     error.css('top', offset.top);
1080                     error.css('width', 'auto');
1081                 }
1082             });
1083
1084             [% IF patron.guarantor_relationships && !Koha.Preference('OPACPrivacy') %]
1085
1086                 [% IF Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
1087                     $('#update_privacy_guarantor_checkouts').click( function() {
1088                         var can_see_checkouts = $('#privacy_guarantor_checkouts').val() == 1;
1089                         $.ajax({
1090                             url: "/api/v1/public/patrons/[% logged_in_user.borrowernumber | uri %]/guarantors/can_see_checkouts",
1091                             type: "PUT",
1092                             data: JSON.stringify({
1093                                 allowed: can_see_checkouts
1094                             }),
1095                             contentType: "application/json",
1096                             success: function () {
1097                                 $('#update_privacy_guarantor_checkouts_message')
1098                                     .fadeIn("slow")
1099                                     .text(_("Your setting has been updated!"))
1100                                     .delay(5000)
1101                                     .fadeOut("slow");
1102                             },
1103                             error: function () {
1104                                 $('#update_privacy_guarantor_checkouts_message')
1105                                     .fadeIn("slow")
1106                                     .text(_("Unable to update your setting!"))
1107                                     .delay(5000)
1108                                     .fadeOut("slow");
1109                             }
1110                         });
1111                     });
1112                 [% END %]
1113
1114                 [% IF Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') %]
1115                     $('#update_privacy_guarantor_fines').click( function() {
1116                         var can_see_charges = $('#privacy_guarantor_fines').val() == 1;
1117                         $.ajax({
1118                             url: "/api/v1/public/patrons/[% logged_in_user.borrowernumber | uri %]/guarantors/can_see_charges",
1119                             type: 'PUT',
1120                             data: JSON.stringify({ 
1121                                 allowed: can_see_charges
1122                             }),
1123                             contentType: 'application/json',
1124                             success: function() {
1125                                 $('#update_privacy_guarantor_fines_message')
1126                                     .fadeIn("slow")
1127                                     .text( _("Your setting has been updated!") )
1128                                     .delay( 5000 )
1129                                     .fadeOut("slow");
1130                             },
1131                             error: function() {
1132                                 $('#update_privacy_guarantor_fines_message')
1133                                     .fadeIn("slow")
1134                                     .text( _("Unable to update your setting!") )
1135                                     .delay( 5000 )
1136                                     .fadeOut("slow");
1137                             }
1138                         });
1139                     });
1140                 [% END %]
1141             [% END %]
1142
1143             $(".patron-attributes").on( 'click', '.clear-attribute', function() {
1144                 $(this).parent()
1145                     .find('textarea').attr('value', '').end()
1146                     .find('select').attr('value', '').end();
1147
1148                 return false;
1149             } );
1150
1151             $(".patron-attributes").on( 'click', '.clone-attribute', function() {
1152                 var clone = $(this).parent().clone().insertAfter( $(this).parent() );
1153
1154                 var newId = 50 + parseInt(Math.random() * 100000);
1155                 $('input[type!="hidden"],select,textarea', clone).attr('id', 'patron-attr-' + newId).attr('value', '');
1156                 $("label", clone).attr('for', 'patron-attr-' + newId).attr('value', '');
1157
1158                 return false;
1159             } );
1160         });
1161
1162     $(".cleardate").on("click", function(){
1163         $('#borrower_dateofbirth').val('');
1164         return false;
1165     });
1166
1167     [% IF action != 'edit' and Koha.Preference('PatronSelfRegistrationConfirmEmail') %]
1168         $("#borrower_email").bind("cut copy paste", function(e){
1169             e.preventDefault();
1170             $("#borrower_email").bind("contextmenu", function(e){
1171                 e.preventDefault();
1172             });
1173         });
1174         $("#borrower_repeat_email").bind("cut copy paste", function(e){
1175             e.preventDefault();
1176             $("#borrower_repeat_email").bind("contextmenu", function(e){
1177                 e.preventDefault();
1178             });
1179         });
1180     [% END %]
1181     //]]>
1182     </script>
1183 [% INCLUDE 'calendar.inc' %]
1184 [% END %]