Bug 30713: Patron entry should limit date of birth selection to dates in the past
[koha-ffzg.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / memberentrygen.tt
1 [% PROCESS 'i18n.inc' %]
2 [% USE raw %]
3 [% USE Asset %]
4 [% USE To %]
5 [% USE Koha %]
6 [% USE KohaDates %]
7 [% USE Branches %]
8 [% PROCESS 'member-main-address-style.inc' %]
9 [% PROCESS 'member-alt-address-style.inc' %]
10 [% PROCESS 'member-alt-contact-style.inc' %]
11 [% SET footerjs = 1 %]
12 [% INCLUDE 'doc-head-open.inc' %]
13     <title>
14         [% UNLESS blocking_error %]
15             [% IF ( opadd ) %]
16                 Add patron
17             [% ELSIF ( opduplicate ) %]
18                 Duplicate patron
19             [% ELSE %]
20                 Modify patron
21             [% END %]
22             [% INCLUDE 'patron-title.inc' no_html = 1 %]
23             [% IF categoryname %]([% categoryname | html %])[% END %]
24         [% END %] &rsaquo; Patrons &rsaquo; Koha
25     </title>
26 <style>
27 legend:hover {
28     cursor: pointer;
29 }
30 </style>
31 [% INCLUDE 'doc-head-close.inc' %]
32 </head>
33
34 <body id="pat_memberentrygen" class="pat">
35     [% INCLUDE 'header.inc' %]
36     [% INCLUDE 'patron-search-header.inc' %]
37
38     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
39         <ol>
40             <li>
41                 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
42             </li>
43
44             [% IF blocking_error %]
45                 <li>
46                     <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
47                 </li>
48             [% ELSE %]
49                 <li>
50                     <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
51                 </li>
52                 [% IF (borrower_data.firstname || borrower_data.surname ) %]
53                     <li>
54                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | uri %]">
55                             [% INCLUDE 'patron-title.inc' %]
56                         </a>
57                     </li>
58                 [% END %]
59                 <li>
60                     <a href="#" aria-current="page">
61                         [% IF ( opadd ) %]
62                             Add patron
63                         [% ELSIF ( opduplicate ) %]
64                             Duplicate patron
65                         [% ELSE %]
66                             Modify patron
67                         [% END %]
68                         [% IF categoryname %]
69                             ([% categoryname | html %])
70                         [% END %]
71                     </a>
72                 </li>
73             [% END %]
74         </ol>
75     </nav> <!-- /#breadcrumbs -->
76
77     <div class="main container-fluid">
78         <div class="row">
79             [% IF borrower_data.messages %]
80                 [% FOR message IN borrower_data.messages %]
81                     [% SWITCH message.error %]
82                         [% CASE 'error_on_insert_patron' %]
83                             <div class="dialog alert">Something went wrong when creating the patron. Check the logs.</div>
84                         [% CASE 'error_on_update_patron' %]
85                             <div class="dialog alert">Something went wrong when updating the patron. Check the logs.</div>
86                         [% CASE %]<div class="dialog alert">Unhandled error: [% message.error | html %]</div>
87                     [% END %]
88                 [% END %]
89             [% END %]
90             [% IF ( opadd ) %]
91                 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
92             [% ELSE %]
93                 <div class="col-sm-10 col-sm-push-2">
94             [% END %]
95                 <main class="clearfix">
96                     [% INCLUDE 'blocking_errors.inc' %]
97
98                     [% IF error_alert %]
99                         [% IF ( error_alert == "no_email" ) %]
100                             <div class="dialog alert">This member has no email</div>
101                         [% ELSE %]
102                             <div class="dialog alert">[% error_alert | html %]</div>
103                         [% END %]
104                     [% END %]
105                     [% IF info_alert %]
106                         <div class="dialog message">Email has been sent.</div>
107                     [% END %]
108
109                     [% INCLUDE 'noadd-warnings.inc' %]
110
111                     [% UNLESS ( no_add ) %]
112                         <h1>
113                             [% IF ( opadd ) %]
114                                 Add patron
115                             [% ELSIF ( opduplicate ) %]
116                                 Duplicate patron
117                             [% ELSE %]
118                                 Modify patron
119                             [% END %]
120                             [% INCLUDE 'patron-title.inc' %]
121                             [% IF categoryname %]([% categoryname | html %])[% END %]
122                         </h1>
123
124                         [% IF quickadd && opadd && !check_member %]
125                             <a href="#" class="toggle_quick_add"><i class="fa fa-plus-square"></i> Show full form</a>
126                             <a href="#" class="toggle_quick_add" style="display:none"><i class="fa fa-minus-square"></i> Show brief form</a>
127                         [% END %]
128
129                         [% IF ( check_member ) %]
130                             <div class="dialog alert">
131                                 <h3>Duplicate patron record?</h3>
132                                 <p><a class="popup_patronview" href="/cgi-bin/koha/members/moremember.pl?print=brief&amp;borrowernumber=[% check_member | uri %]"><i class="fa fa-window-restore"></i> View existing record</a></p>
133                                 <button id="duplicate" type="submit" class="new"> <i class="fa fa-pencil"></i> It is a duplicate. Edit existing record </button>
134                                 <button type="submit" id="not-duplicate" class="new"> <i class="fa fa-plus"></i> Not a duplicate. Save as new record </button>
135                             </div>
136                         [% END %]
137
138                         [% IF ( nok ) %]
139                             <div class="dialog alert">
140                                 <p>The following fields are wrong. Please fix them.</p>
141                                 <ul>
142                                     [% IF ( ERROR_login_exist ) %]
143                                         <li id="ERROR_login_exist">Username/password already exists.</li>
144                                     [% END %]
145                                     [% IF ERROR_cardnumber_already_exists %]
146                                         <li id="ERROR_cardnumber">Cardnumber already in use.</li>
147                                     [% END %]
148                                     [% IF ERROR_cardnumber_length %]
149                                         <li id="ERROR_cardnumber">Cardnumber length is incorrect.</li>
150                                     [% END %]
151                                     [% IF ( ERROR_age_limitations ) %]
152                                     <li id="ERROR_age_limitations">Patron's age is incorrect for their category.
153                                             Ages allowed are [% age_low | html %]-[% age_high | html %].</li>
154                                     [% END %]
155                                     [% IF ( ERROR_branch ) %]
156                                         <li id="ERROR_branch">Library is invalid.</li>
157                                     [% END %]
158                                     [% IF ( ERROR_dateofbirth ) %]
159                                         <li id="ERROR_dateofbirth">Date of birth is invalid.</li>
160                                     [% END %]
161                                     [% IF ( ERROR_dateenrolled ) %]
162                                         <li id="ERROR_dateenrolled">Date of enrollment is invalid.</li>
163                                     [% END %]
164                                     [% IF ( ERROR_dateexpiry ) %]
165                                         <li id="ERROR_dateexpiry">Date of expiration is invalid.</li>
166                                     [% END %]
167                                     [% IF ( ERROR_password_too_short ) %]
168                                         <li id="ERROR_short_password">Password must be at least [% minPasswordLength | html %] characters long.</li>
169                                     [% END %]
170                                     [% IF ( ERROR_password_too_weak ) %]
171                                         <li id="ERROR_weak_password">Password must contain at least one digit, one lowercase and one uppercase.</li>
172                                     [% END %]
173                                     [% IF ( ERROR_password_has_whitespaces ) %]
174                                         <li id="ERROR_weak_password">Password must not contain leading or trailing whitespaces.</li>
175                                     [% END %]
176                                     [% IF ( ERROR_password_mismatch ) %]
177                                         <li id="ERROR_password_mismatch">Passwords do not match.</li>
178                                     [% END %]
179                                     [% IF ( ERROR_password_expiration_date ) %]
180                                         <li id="ERROR_dateexpiry">Password expiration date is invalid.</li>
181                                     [% END %]
182                                     [% IF ( ERROR_extended_unique_id_failed ) %]
183                                         <li id="ERROR_extended_unique_id_failed"><strong>[% ERROR_extended_unique_id_failed_description | html %]:</strong> Attribute value "[% ERROR_extended_unique_id_failed_value | html %]" is already in use by another patron record.</li>
184                                     [% END %]
185                                     [% IF ERROR_bad_email %]
186                                         <li id="ERROR_bad_email">The primary email is invalid.</li>
187                                     [% END %]
188                                     [% IF ERROR_bad_email_secondary %]
189                                         <li id="ERROR_bad_email_secondary">The secondary email is invalid.</li>
190                                     [% END %]
191                                     [% IF ERROR_bad_email_alternative %]
192                                         <li id="ERROR_bad_email_alternative">The alternative email is invalid.</li>
193                                     [% END %]
194                                 </ul>
195                             </div>
196                         [% END %]
197
198                         [% SET fieldstohide = Koha.Preference('CollapseFieldsPatronAddForm') %]
199                         [% IF Koha.Preference('CollapseFieldsPatronAddForm') %][% UNLESS step %]
200                             <p id="selections">
201                                 <input type="checkbox" id="toggle_hidden_fields" title="These fields are collapsed by default by the CollapseFieldsPatronAddForm system preference"><strong>Show collapsed fields:</strong>
202                                 [% FOREACH field IN fieldstohide.split(',') %]
203                                     [% SWITCH field %]
204                                         [% CASE 'identity' %] <span>Patron identity</span> |
205                                         [% CASE 'guarantor' %] <span>Guarantor information</span> |
206                                         [% CASE 'primary_address' %] <span>Main address</span> |
207                                         [% CASE 'primary_contact' %] <span>Contact information</span> |
208                                         [% CASE 'alt_address' %] <span>Alternate address</span> |
209                                         [% CASE 'alt_contact' %] <span>Alternate contact</span> |
210                                         [% CASE 'lib_mgmt' %] <span>Library management</span> |
211                                         [% CASE 'lib_setup' %] <span>Library setup</span> |
212                                         [% CASE 'login' %] <span>OPAC/Staff interface login</span> |
213                                         [% CASE 'flags' %] <span>Patron account flags</span> |
214                                         [% CASE 'debarments' %] <span>Patron restrictions</span> |
215                                         [% CASE 'housebound' %] <span>Housebound roles</span> |
216                                         [% CASE 'additional' %] <span>Additional attributes and identifiers</span> |
217                                         [% CASE 'messaging' %] <span>Patron messaging preferences</span> |
218                                     [% END %]
219                                 [% END %]
220                             </p>
221                         [% END %][% END %]
222
223                         [% UNLESS ( check_member ) %]
224                             <div id="toolbar" class="btn-toolbar">
225                                 [% IF quickadd && opadd %]
226                                     <button class="btn btn-default toggler" id="save_quick_add" name="save"><i class="fa fa-save"></i> Save</button>
227                                 [% END %]
228                                 <button class="btn btn-default toggler" id="saverecord" name="save" ><i class="fa fa-save"></i> Save</button>
229                                 [% IF opadd %]
230                                     <a class="btn btn-default" href="/cgi-bin/koha/members/member.pl" class="toggler save_entryform">
231                                 [% ELSE %]
232                                     <a class="btn btn-default" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | html %]">
233                                 [% END %]
234                                     <i class="fa fa-times"></i> Cancel
235                                 </a>
236                             </div>
237                         [% END %]
238
239                         <form name="form" id="entryform" action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class="toggler">
240                             [% UNLESS ( check_member ) %]
241                                 <input type="hidden" name="nodouble"  value="[% nodouble | html %]" />
242                             [% END %]
243                             <!--    field always hidden in different form (1,2,3) -->
244                             <input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField | html %]" />
245                             <input type="hidden" name="category_type" value="[% category_type | html %]" />
246                             <input type="hidden" name="updtype" value="[% updtype | html %]" />
247                             <input type="hidden" name="destination" value="[% destination | html %]" />
248                             <input type="hidden" name="check_member" value="[% check_member | html %]" />
249                             <input type="hidden" name="borrowernumber" value="[% borrowernumber | html UNLESS opduplicate %]" />
250                             <input type="hidden" name="nodouble"  value="[% nodouble | html UNLESS opduplicate %]" />
251                             <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
252                             [% IF ( step ) %]
253                                 <input type="hidden" name="step"  value="[% step | html %]" />
254                             [% END %]
255                             [% IF ( opadd ) %]
256                                 <input type="hidden" name="op" value="insert" />
257                             [% ELSIF ( opduplicate ) %]
258                                 <input type="hidden" name="op" value="insert" />
259                             [% ELSE %]
260                                 <input type="hidden" name="op" value="save" />
261                                 [% IF step == 4 || step == 5 || step == 6 || step == 2 || step == 1 || step == 7 %]
262                                     [%# Only put the card number if we arent showing it in the form later %]
263                                     [% IF borrower_data.cardnumber %]
264                                         <input type="hidden" name="cardnumber" value="[% borrower_data.cardnumber | html %]" />
265                                     [% END %]
266                                 [% END %]
267                             [% END %]
268
269                             [% IF ( step_1 ) %]
270                                 [% UNLESS notitle && nosurname && nofirstname && nodateofbirth && noinitials && noothernames &&nosex %]
271                                     <fieldset class="rows" id="memberentry_identity">
272                                         <legend id="identity_lgd">[% IF ( I ) %]Organization [% ELSE %]Patron [% END %]identity</legend>
273                                         <ol>
274                                             [% UNLESS ( I ) %]
275                                                 [% UNLESS notitle %]
276                                                     [% IF Koha.Preference('BorrowersTitles') %]
277                                                         <li>
278                                                             [% IF ( mandatorytitle ) %]
279                                                                 <label for="btitle" class="required">
280                                                             [% ELSE %]
281                                                                 <label for="btitle">
282                                                             [% END %]
283                                                             Salutation: </label>
284                                                             <select id="btitle" name="title">
285                                                                 <option value=""></option>
286                                                                 [% FOREACH t IN Koha.Preference('BorrowersTitles').split('\|') %]
287                                                                     [% IF btitle == t %]
288                                                                         <option value="[% t | html %]" selected="selected">[% t | html %]</option>
289                                                                     [% ELSE %]
290                                                                         <option value="[% t | html %]">[% t | html %]</option>
291                                                                     [% END %]
292                                                                 [% END %]
293                                                             </select>
294                                                             [% IF ( mandatorytitle ) %]
295                                                                 <span class="required">Required</span>
296                                                             [% END %]
297                                                         </li>
298                                                     [% END # /IF Koha.Preference('BorrowersTitles') %]
299                                                 [% END # /UNLESS notitle %]
300                                             [% END # /UNLESS ( I ) %]
301
302                                             [% UNLESS nosurname %]
303                                                 <li>
304                                                     [% IF ( I ) %]
305                                                         <label for="surname" class="required">
306                                                             Name:
307                                                         </label>
308                                                     [% ELSE %]
309                                                         [% IF ( mandatorysurname ) %]
310                                                             <label for="surname" class="required">
311                                                         [% ELSE %]
312                                                             <label for="surname">
313                                                         [% END %]
314                                                         Surname: </label>
315                                                     [% END %]
316
317                                                     [% IF ( uppercasesurnames ) %]
318                                                         <input style="text-transform:uppercase;" type="text" id="surname" name="surname" size="20"  value="[% borrower_data.surname | html %]" />
319                                                     [% ELSE %]
320                                                         <input type="text" id="surname" name="surname" size="20"  value="[% borrower_data.surname | html %]" />
321                                                     [% END %]
322                                                     [% IF ( mandatorysurname ) %]
323                                                         <span class="required">Required</span>
324                                                     [% END %]
325                                                 </li>
326                                             [% END # /UNLESS nosurname %]
327
328                                             [% UNLESS ( I ) %]
329                                                 [% UNLESS nofirstname %]
330                                                     <li>
331                                                         [% IF ( mandatoryfirstname ) %]
332                                                             <label for="firstname" class="required">
333                                                         [% ELSE %]
334                                                             <label for="firstname">
335                                                         [% END %]
336                                                             First name:
337                                                         </label>
338                                                         <input type="text" id="firstname" name="firstname" size="20"  value="[% borrower_data.firstname | html UNLESS opduplicate %]" />
339                                                         [% IF ( mandatoryfirstname ) %]
340                                                             <span class="required">Required</span>
341                                                         [% END %]
342                                                     </li>
343                                                 [% END #/UNLESS nofirstname %]
344                                                 [% UNLESS nodateofbirth %]
345                                                     <li>
346                                                         [% IF ( mandatorydateofbirth ) %]
347                                                             <label for="dateofbirth" class="required">
348                                                         [% ELSE %]
349                                                             <label for="dateofbirth">
350                                                         [% END %]
351                                                         Date of birth:
352                                                         </label>
353                                                         <input type="text" id="dateofbirth" name="dateofbirth" size="20" value="[% borrower_data.dateofbirth | html UNLESS opduplicate %]" class="flatpickr" data-flatpickr-pastinclusive="true" />
354                                                          [% IF ( mandatorydateofbirth ) %]
355                                                             <span class="required">Required</span>
356                                                         [% END %]
357                                                         [% IF ( ERROR_dateofbirth ) %]
358                                                             <span class="required">(Error)</span>
359                                                         [% END %]
360                                                         <div id="dateofbirth_hint" class="hint">[% INCLUDE 'date-format.inc' %]</div>
361                                                     </li>
362                                                 [% END # /UNLESS nodateofbirth %]
363                                                 [% UNLESS noinitials %]
364                                                     <li>
365                                                         [% IF ( mandatoryinitials ) %]
366                                                             <label for="initials" class="required">
367                                                         [% ELSE %]
368                                                             <label for="initials">
369                                                         [% END %]
370                                                             Initials:
371                                                         </label>
372                                                         <input type="text" id="initials" name="initials" size="20"  value="[% borrower_data.initials | html UNLESS opduplicate %]" />
373                                                         [% IF ( mandatoryinitials ) %]
374                                                             <span class="required">Required</span>
375                                                         [% END %]
376                                                     </li>
377                                                 [% END # /UNLESS noinitials %]
378                                             [% END #/UNLESS ( I ) %]
379                                             [% UNLESS noothernames %]
380                                                 <li>
381                                                     [% IF ( mandatoryothernames ) %]
382                                                         <label for="othernames" class="required">
383                                                     [% ELSE %]
384                                                         <label for="othernames">
385                                                     [% END %]
386                                                         Other name:
387                                                     </label>
388                                                     <input type="text" id="othernames" name="othernames" size="20"  value="[% borrower_data.othernames | html UNLESS opduplicate %]" />
389                                                     [% IF ( mandatoryothernames ) %]
390                                                         <span class="required">Required</span>
391                                                     [% END %]
392                                                     [% IF ( I ) %]<input type="hidden" name="sex" value="N" />[% END %]
393                                                 </li>
394                                             [% END #/UNLESS noothernames %]
395
396                                             [% UNLESS ( I ) %]
397                                                 [% UNLESS nosex %]
398                                                     <li class="radio">
399                                                         [% UNLESS ( opduplicate ) %]
400                                                             [% IF ( female ) %]
401                                                                 <label for="sex-female"><input type="radio" name="sex" id="sex-female" value="F" checked="checked" /><span class="patronsex-female"> Female</span></label>
402                                                             [% ELSE %]
403                                                                 <label for="sex-female"><input type="radio" name="sex" id="sex-female" value="F" /><span class="patronsex-female"> Female</span></label>
404                                                             [% END %]
405                                                             [% IF ( male ) %]
406                                                                 <label for="sex-male"><input type="radio" name="sex" id="sex-male" value="M" checked="checked" /><span class="patronsex-male"> Male</span></label>
407                                                             [% ELSE %]
408                                                                 <label for="sex-male"><input type="radio" name="sex" id="sex-male" value="M" /><span class="patronsex-male"> Male</span></label>
409                                                             [% END %]
410                                                             [% IF ( other ) %]
411                                                                 <label for="sex-other"><input type="radio" name="sex" id="sex-other" value="O" checked="checked" /><span class="patronsex-other"> Other</span></label>
412                                                             [% ELSE %]
413                                                                 <label for="sex-other"><input type="radio" name="sex" id="sex-other" value="O" /><span class="patronsex-other"> Other</span></label>
414                                                             [% END %]
415                                                             [% IF ( none ) %]
416                                                                 <label for="sex-none"><input type="radio" name="sex" id="sex-none" value=""  checked="checked" /><span class="patronsex-none"> None specified</span></label>
417                                                             [% ELSE %]
418                                                                 <label for="sex-none"><input type="radio" name="sex" id="sex-none" value="" /><span class="patronsex-none"> None specified</span></label>
419                                                             [% END %]
420                                                         [% ELSE %]
421                                                             <label for="sex-female"><span class="patronsex-female">Female </span></label><input type="radio" name="sex" id="sex-female" value="F" />
422                                                             <label for="sex-male"><span class="patronsex-male">Male </span></label><input type="radio" name="sex" id="sex-male" value="M" />
423                                                             <label for="sex-other"><span class="patronsex-other">Other </span></label><input type="radio" name="sex" id="sex-other" value="O" />
424                                                             <label for="sex-none"><span class="patronsex-none">None specified </span></label><input type="radio" name="sex" id="sex-none" value="" checked="checked" />
425                                                         [% END # /UNLESS ( opduplicate )%]
426                                                     </li>
427                                                 [% END # /UNLESS nosex %]
428                                             [% END # /UNLESS ( I ) %]
429                                         </ol>
430                                     </fieldset> <!-- /#memberentry_identity -->
431                                 [% END # hide fieldset %]
432
433                                 [% IF show_guarantor || guarantor %]
434                                     [% SET possible_relationships = Koha.Preference('borrowerRelationship') %]
435                                     <div id="memberentry_guarantor_anchor">
436                                         <fieldset id="memberentry_guarantor" class="rows">
437                                             <legend>Patron guarantor</legend>
438
439                                             <div id="guarantor_relationships">
440                                                 [% FOREACH r IN relationships %]
441                                                     <fieldset>
442                                                         <ol>
443                                                             [% IF category_type == 'I' %]
444                                                                 <li class="guarantor-details" data-borrowernumber="[% r.guarantor_id | $raw %]">
445                                                                     <span class="label">Organization:</span>
446                                                                     [% INCLUDE 'patron-title.inc' patron=r.guarantor hide_patron_infos_if_needed=1 %]
447                                                                 </li>
448                                                                 <li>
449                                                                     <span class="label">Relationship:</span>
450                                                                     <span>[% r.relationship | html %]</span>
451                                                                 </li>
452                                                             [% ELSE %]
453                                                                 <li class="guarantor-details" data-borrowernumber="[% r.guarantor_id | $raw %]">
454                                                                     <span class="label">Guarantor:</span>
455                                                                     [% INCLUDE 'patron-title.inc' patron=r.guarantor hide_patron_infos_if_needed=1 %]
456                                                                 </li>
457                                                                 <li>
458                                                                     <span class="label">Relationship:</span>
459                                                                     <span>[% r.relationship | html %]</span>
460                                                                 </li>
461
462                                                                 <li>
463                                                                     <label for="delete_guarantor-[% r.id | uri %]">Remove: </label>
464                                                                     <input type="checkbox" id="delete_guarantor-[% r.id | uri %]" name="delete_guarantor" value="[% r.id | html %]" />
465                                                                 </li>
466                                                             [% END %]
467                                                         </ol>
468                                                     </fieldset>
469                                                 [% END # END relationships foreach %]
470                                                 [% IF guarantor && (!relationships) %]
471                                                     <fieldset class="guarantor">
472                                                         <ol>
473                                                             <li class="guarantor-details" data-borrowernumber="0">
474                                                                 <span class="label">Guarantor:</span>
475                                                                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.borrowernumber | uri %]" target="blank">[% guarantor.firstname | html %] [% guarantor.surname | html %] ([% guarantor.cardnumber | html %])</a>
476                                                                 <input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value="[% guarantor.borrowernumber | html %]"/>
477                                                             </li>
478
479                                                             [% IF possible_relationships %]
480                                                                 <li>
481                                                                     [% UNLESS empty_relationship_allowed %]
482                                                                         <label for="guarantor_relationship" class="required">Relationship: </label>
483                                                                         <select class="new_guarantor_relationship" name="new_guarantor_relationship" required="required">
484                                                                     [% ELSE %]
485                                                                         <label for="guarantor_relationship">Relationship: </label>
486                                                                         <select class="new_guarantor_relationship" name="new_guarantor_relationship">
487                                                                     [% END %]
488                                                                         <option value="" selected>Empty option</option>
489                                                                         [% FOREACH pr IN possible_relationships.split('\|') %]
490                                                                             [% IF pr != "" %]
491                                                                                 <option value="[% pr | html %]">[% pr | html %]</option>
492                                                                             [% END %]
493                                                                         [% END %]
494                                                                     </select>
495                                                                     [% UNLESS empty_relationship_allowed %]
496                                                                         <span class="required">Required</span>
497                                                                     [% END %]
498                                                                 </li>
499                                                             [% ELSE %]
500                                                                 <input type="hidden" name="new_guarantor_relationship" value="" />
501                                                             [% END %]
502
503                                                             <li>
504                                                                 <label for="guarantor_cancel">&nbsp;</label>
505                                                                 <span><a href="#" class="guarantor_cancel"><i class="fa fa-trash" aria-hidden="true"></i> Remove</a></span>
506                                                             </li>
507                                                         </ol>
508                                                     </fieldset>
509                                                 [% END %]
510                                             </div> <!-- #/guarantor_relationships -->
511
512                                             <fieldset class="guarantor" id="guarantor_template">
513                                                 <ol>
514                                                     <li class="guarantor-details" data-borrowernumber="0">
515                                                         <span class="label">Guarantor:</span>
516                                                         <a class="new_guarantor_link" href="#" target="blank">
517                                                             <span class="new_guarantor_firstname_text"></span> <span class="new_guarantor_surname_text"></span>
518                                                             (<span class="new_guarantor_id_text"></span>)
519                                                          </a>
520                                                         <input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value=""/>
521                                                     </li>
522
523                                                     [% IF possible_relationships %]
524                                                         <li>
525                                                             [% UNLESS empty_relationship_allowed %]
526                                                                 <label for="guarantor_relationship" class="required">Relationship: </label>
527                                                                 <select class="new_guarantor_relationship" name="new_guarantor_relationship" required="required">
528                                                             [% ELSE %]
529                                                                 <label for="guarantor_relationship">Relationship: </label>
530                                                                 <select class="new_guarantor_relationship" name="new_guarantor_relationship">
531                                                             [% END %]
532                                                                 <option value="" selected></option>
533                                                                 [% FOREACH pr IN possible_relationships.split('\|') %]
534                                                                     [% IF pr != "" %]
535                                                                         <option value="[% pr | html %]">[% pr | html %]</option>
536                                                                     [% END %]
537                                                                 [% END %]
538                                                             </select>
539                                                             [% UNLESS empty_relationship_allowed %]
540                                                                 <span class="required">Required</span>
541                                                             [% END %]
542                                                         </li>
543                                                     [% ELSE %]
544                                                         <input type="hidden" name="new_guarantor_relationship" value="" />
545                                                     [% END %]
546
547                                                     <li>
548                                                         <label for="guarantor_cancel">&nbsp;</label>
549                                                         <span><a href="#" class="guarantor_cancel"><i class="fa fa-trash"></i> Remove</a></span>
550                                                     </li>
551                                                 </ol>
552                                             </fieldset>
553
554                                             <ol>
555                                                 <input type="hidden" id="guarantor_id" value="" />
556                                                 <input name="guarantor_surname" id="guarantor_surname" type="hidden" />
557                                                 <input name="guarantor_firstname" id="guarantor_firstname" type="hidden" />
558
559                                                 <li>
560                                                     <a href="#" id="guarantor_search" class="btn btn-default"><i class="fa fa-plus"></i> Add guarantor</a>
561                                                 </li>
562
563                                                 [% IF Koha.Preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') %]
564                                                     <li>
565                                                         <label for="privacy_guarantor_checkouts">Show checkouts to guarantors</label>
566                                                         <select name="privacy_guarantor_checkouts" id="privacy_guarantor_checkouts">
567                                                             [% IF borrower_data.privacy_guarantor_checkouts %]
568                                                                 <option value="0">No</option>
569                                                                 <option value="1" selected>Yes</option>
570                                                             [% ELSE %]
571                                                                 <option value="0" selected>No</option>
572                                                                 <option value="1">Yes</option>
573                                                             [% END %]
574                                                         </select>
575                                                         <div class="hint">Allow guarantors of this patron to view this patron's checkouts from the OPAC</div>
576                                                     </li>
577                                                 [% END %]
578                                                 [% IF Koha.Preference('AllowStaffToSetFinesVisibilityForGuarantor') %]
579                                                     <li>
580                                                         <label for="privacy_guarantor_fines">Show fines to guarantors</label>
581                                                         <select name="privacy_guarantor_fines" id="privacy_guarantor_fines">
582                                                             [% IF borrower_data.privacy_guarantor_fines %]
583                                                                 <option value="0">No</option>
584                                                                 <option value="1" selected>Yes</option>
585                                                             [% ELSE %]
586                                                                 <option value="0" selected>No</option>
587                                                                 <option value="1">Yes</option>
588                                                             [% END %]
589                                                         </select>
590                                                         <div class="hint">Allow guarantors of this patron to view this patron's fines from the OPAC</div>
591                                                     </li>
592                                                 [% END %]
593                                             </ol>
594                                         </fieldset> <!-- /#memberentry_guarantor -->
595                                     </div> <!-- #/memberentry_guarantor_anchor -->
596
597                                     [% UNLESS nocontactname && nocontactfirstname && norelationship %]
598                                         <fieldset class="rows" id="non_patron_guarantor">
599                                             <legend>Non-patron guarantor</legend>
600                                             <ol>
601                                                 [% UNLESS nocontactname %]
602                                                     <li>
603                                                         [% IF ( mandatorycontactname ) %]
604                                                             <label for="contactname" class="required">
605                                                         [% ELSE %]
606                                                             <label for="contactname">
607                                                         [% END %]
608                                                             Guarantor surname:
609                                                         </label>
610                                                         <input type="text" id="contactname" name="contactname" value="[% patron.contactname | html %]" />
611                                                         [% IF ( mandatorycontactname ) %]
612                                                             <span class="required">Required</span>
613                                                         [% END %]
614                                                         <div class="hint">Non-patron guarantor surname</div>
615                                                     </li>
616                                                 [% END # /UNLESS nocontactname %]
617
618                                                 [% UNLESS nocontactfirstname %]
619                                                     <li>
620                                                         [% IF ( mandatorycontactfirstname ) %]
621                                                             <label for="contactfirstname" class="required">
622                                                         [% ELSE %]
623                                                             <label for="contactfirstname">
624                                                         [% END %]
625                                                             Guarantor first name:
626                                                         </label>
627                                                         <input type="text" id="contactfirstname" name="contactfirstname" value="[% patron.contactfirstname | html %]" />
628                                                         [% IF ( mandatorycontactfirstname ) %]
629                                                             <span class="required">Required</span>
630                                                         [% END %]
631                                                         <div class="hint">Non-patron guarantor first name</div>
632                                                     </li>
633                                                 [% END # /UNLESS noaltcontactfirstname %]
634
635                                                 [% UNLESS norelationship %]
636                                                     [% IF possible_relationships %]
637                                                         <li>
638                                                             <label for="relationship">Relationship: </label>
639                                                             <select class="relationship" name="relationship">
640                                                                 <option value=""></option>
641                                                                 [% FOREACH pr IN possible_relationships.split('\|') %]
642                                                                     [% IF pr == borrower_data.relationship %]
643                                                                         <option value="[% pr | html %]" selected="selected">[% pr | html %]</option>
644                                                                     [% ELSE %]
645                                                                         <option value="[% pr | html %]">[% pr | html %]</option>
646                                                                     [% END %]
647                                                                 [% END %]
648                                                             </select>
649                                                         </li>
650                                                     [% END #/IF possible_relationships %]
651                                                 [% END # /UNLESS norelationship %]
652                                             </ol>
653                                         </fieldset> <!-- /#non_patron_guarantor -->
654                                     [% END # /UNLESS nocontactname && nocontactfirstname && norelationship %]
655                                 [% END # /IF show_guarantor || guarantor  %]
656
657                                 [% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %]
658                                     [% PROCESS 'main-address-style' %]
659                                 [% END # /UNLESS nostreet && nocity etc group%]
660
661                                 [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
662                                     <fieldset class="rows" id="memberentry_contact">
663                                         <legend id="contact_lgd">Contact information</legend>
664                                         <ol>
665                                             [% UNLESS nophone %]
666                                                 <li>
667                                                     [% IF ( mandatoryphone ) %]
668                                                         <label for="phone" class="required">
669                                                     [% ELSE %]
670                                                         <label for="phone">
671                                                     [% END %]
672                                                         Primary phone:
673                                                     </label>
674                                                     <input type="text" id="phone" name="phone" value="[% patron.phone | html %]" />
675                                                     [% IF ( mandatoryphone ) %]
676                                                         <span class="required">Required</span>
677                                                     [% END %]
678                                                     <div class="hint">Shows on transit slips</div>
679                                                 </li>
680                                             [% END # /UNLESS nophone %]
681
682                                             [% UNLESS nophonepro %]
683                                                 <li>
684                                                     [% IF ( mandatoryphonepro ) %]
685                                                         <label for="phonepro" class="required">
686                                                     [% ELSE %]
687                                                         <label for="phonepro">
688                                                     [% END %]
689                                                         Secondary phone:
690                                                     </label>
691                                                     <input type="text" id="phonepro" name="phonepro" value="[% patron.phonepro | html %]" />
692                                                     [% IF ( mandatoryphonepro ) %]
693                                                         <span class="required">Required</span>
694                                                     [% END %]
695                                                 </li>
696                                             [% END # /UNLESS nophonepro %]
697
698                                             [% UNLESS nomobile %]
699                                                 <li>
700                                                     [% IF ( mandatorymobile ) %]
701                                                         <label for="mobile" class="required">
702                                                     [% ELSE %]
703                                                         <label for="mobile">
704                                                     [% END %]
705                                                         Other phone:
706                                                     </label>
707                                                     <input type="text" id="mobile" name="mobile" value="[% patron.mobile | html %]" />
708                                                     [% IF ( mandatorymobile ) %]
709                                                         <span class="required">Required</span>
710                                                     [% END %]
711                                                 </li>
712                                             [% END # /UNLESS nomobile %]
713
714                                             [% UNLESS noemail %]
715                                                 <li>
716                                                     [% IF ( mandatoryemail ) %]
717                                                         <label for="email" class="required">
718                                                     [% ELSE %]
719                                                         <label for="email">
720                                                     [% END %]
721                                                         Primary email:
722                                                     </label>
723                                                     [% IF ( NoUpdateEmail ) %]
724                                                     <input type="text" id="email" name="email" size="45" value="[% patron.email | html %]" disabled="disabled" />
725                                                     [% ELSE %]
726                                                     <input type="text" id="email" name="email" size="45" value="[% patron.email | html %]" />
727                                                     [% END %]
728                                                     [% IF ( mandatoryemail ) %]
729                                                         <span class="required">Required</span>
730                                                     [% END %]
731                                                     <div class="hint">Shows on transit slips</div>
732                                                 </li>
733                                             [% END #/UNLESS noemail %]
734
735                                             [% UNLESS noemailpro %]
736                                                 <li>
737                                                     [% IF ( mandatoryemailpro ) %]
738                                                         <label for="emailpro" class="required">
739                                                     [% ELSE %]
740                                                         <label for="emailpro">
741                                                     [% END %]
742                                                         Secondary email:
743                                                     </label>
744                                                     [% IF ( NoUpdateEmail ) %]
745                                                     <input type="text" id="emailpro" name="emailpro" size="45" value="[% patron.emailpro | html %]" disabled="disabled"/>
746                                                     [% ELSE %]
747                                                     <input type="text" id="emailpro" name="emailpro" size="45" value="[% patron.emailpro | html %]" />
748                                                     [% END %]
749                                                     [% IF ( mandatoryemailpro ) %]
750                                                         <span class="required">Required</span>
751                                                     [% END %]
752                                                 </li>
753                                             [% END #/UNLESS noemailpro %]
754
755                                             [% UNLESS nofax %]
756                                                 <li>
757                                                     [% IF ( mandatoryfax ) %]
758                                                         <label for="fax" class="required">
759                                                     [% ELSE %]
760                                                         <label for="fax">
761                                                     [% END %]
762                                                         Fax:
763                                                     </label>
764                                                     <input type="text" id="fax" name="fax" value="[% patron.fax | html %]" />
765                                                     [% IF ( mandatoryfax ) %]
766                                                         <span class="required">Required</span>
767                                                     [% END %]
768                                                 </li>
769                                             [% END #/UNLESS nofax %]
770
771                                             [% UNLESS noprimary_contact_method %]
772                                                 <li>
773                                                     [% IF mandatoryprimary_contact_method %]
774                                                         <label for="primary_contact_method" class="required">
775                                                     [% ELSE %]
776                                                         <label for="primary_contact_method">
777                                                     [% END %]
778                                                     Main contact method: </label>
779
780                                                     <select id="primary_contact_method" name="primary_contact_method">
781                                                         <option value=""></option>
782                                                         [% UNLESS nophone %]
783                                                             [% IF ( borrower_data.primary_contact_method == 'phone' ) %]
784                                                                 <option value="phone" selected="selected">Primary phone</option>
785                                                             [% ELSE %]
786                                                                 <option value="phone">Primary phone</option>
787                                                             [% END %]
788                                                         [% END %]
789                                                         [% UNLESS nophonepro %]
790                                                             [% IF ( borrower_data.primary_contact_method == 'phonepro' ) %]
791                                                                 <option value="phonepro" selected="selected">Secondary phone</option>
792                                                             [% ELSE %]
793                                                                 <option value="phonepro">Secondary phone</option>
794                                                             [% END %]
795                                                         [% END %]
796                                                         [% UNLESS nomobile %]
797                                                             [% IF ( borrower_data.primary_contact_method == 'mobile' ) %]
798                                                                 <option value="mobile" selected="selected">Other phone</option>
799                                                             [% ELSE %]
800                                                                 <option value="mobile">Other phone</option>
801                                                             [% END %]
802                                                         [% END %]
803                                                         [% UNLESS noemail %]
804                                                             [% IF ( borrower_data.primary_contact_method == 'email' ) %]
805                                                                 <option value="email" selected="selected">Primary email</option>
806                                                             [% ELSE %]
807                                                                 <option value="email">Primary email</option>
808                                                             [% END %]
809                                                         [% END %]
810                                                         [% UNLESS noemailpro %]
811                                                             [% IF ( borrower_data.primary_contact_method == 'emailpro' ) %]
812                                                                 <option value="emailpro" selected="selected">Secondary email</option>
813                                                             [% ELSE %]
814                                                                 <option value="emailpro">Secondary email</option>
815                                                             [% END %]
816                                                         [% END %]
817                                                         [% UNLESS nofax %]
818                                                             [% IF ( borrower_data.primary_contact_method == 'fax' ) %]
819                                                                 <option value="fax" selected="selected">Fax</option>
820                                                             [% ELSE %]
821                                                                 <option value="fax">Fax</option>
822                                                             [% END %]
823                                                         [% END %]
824                                                     </select>
825                                                     [% IF mandatoryprimary_contact_method %]
826                                                         <span class="required">Required</span>
827                                                     [% END %]
828                                                 </li>
829                                             [% END %]
830                                         </ol>
831                                     </fieldset> <!-- /#memberentry_contact -->
832                                 [% END # hide fieldset %]
833
834                                 <!-- ************************ STEP_1 *********************** -->
835                             [% END # /IF ( step_1 ) %]
836
837                             [% IF ( step_6 ) %]
838                                 [% UNLESS noB_address && noB_address2 && noB_city && noB_zipcode && noB_state && noB_country &&nocontactnote && noB_phone && noB_email %]
839                                     [% PROCESS 'alt-address-style' %]
840                                 [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %]
841                             [% END # /IF ( step_6 ) %]
842
843                             [% IF ( step_2 ) %]
844                                 [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactaddress2 && noaltcontactaddress3 && noaltcontactstate && noaltcontactzipcode && noaltcontactcountry && noaltcontactphone %]
845                                     [% PROCESS 'alt-contact-style' %]
846                                 [% END # UNLESS noaltcontactsurname && noaltcontactfirstname etc %]
847                             [% END # /IF ( step_2 ) %]
848
849                             [% IF ( step_3 ) %]
850                                 [% SET autoMemberNum = Koha.Preference('autoMemberNum') %]
851                                 <fieldset class="rows" id="memberentry_library_management">
852                                     <legend id="library_management_lgd">Library management</legend>
853                                     <ol>
854                                         [% UNLESS nocardnumber %]
855                                             <li>
856                                                 [% IF mandatorycardnumber %]
857                                                     <label for="cardnumber" class="required">
858                                                 [% ELSE %]
859                                                     <label for="cardnumber" class="validated">
860                                                 [% END %]
861                                                     Card number:
862                                                 </label>
863
864                                                 <!-- NOTE: div.hint closing tag isn't on the same line -->
865                                                 [% IF minlength_cardnumber == maxlength_cardnumber %]
866                                                     <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% borrower_data.cardnumber | html %]" minlength="[% minlength_cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
867                                                     [% IF mandatorycardnumber %]
868                                                         <span class="required">Required</span>
869                                                     [% END %]
870                                                     <span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber | html %] characters.</span>
871                                                     <div class="hint">Card number must be exactly [% minlength_cardnumber | html %] characters.
872                                                 [% ELSIF minlength_cardnumber && maxlength_cardnumber %]
873                                                     <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% borrower_data.cardnumber | html %]" minlength="[% minlength_cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
874                                                     [% IF mandatorycardnumber %]
875                                                         <span class="required">Required</span>
876                                                     [% END %]
877                                                     <span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber | html %] characters.</span>
878                                                     <div class="hint">Card number must be between [% minlength_cardnumber | html %] and [% maxlength_cardnumber | html %] characters.
879                                                 [% ELSIF maxlength_cardnumber %]
880                                                     <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% borrower_data.cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
881                                                     [% IF mandatorycardnumber %]
882                                                         <span class="required">Required</span>
883                                                     [% END %]
884                                                     <span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber | html %] characters.</span>
885                                                     <div class="hint">Card number can be up to [% maxlength_cardnumber | html %] characters.
886                                                 [% ELSE %]
887                                                     <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% borrower_data.cardnumber | html %]" />
888                                                     [% IF mandatorycardnumber %]
889                                                         <span class="required">Required</span>
890                                                     [% END %]
891                                                     <div class="hint">There is no minimum or maximum character length.
892                                                 [% END %]
893                                                 [% IF autoMemberNum %]
894                                                     [% IF mandatorycardnumber %]
895                                                         <br/><span class="error">AutoMemberNum is set to enabled, but card number is marked as mandatory in BorrowerMandatoryField: auto calc has been disabled.</span>
896                                                     [% ELSE %]
897                                                         <br/>Leave blank for auto calc during registration
898                                                     [% END %]
899                                                 [% END %]
900                                                 </div><!--/div.hint -->
901                                             </li>
902                                         [% END # /UNLESS nocardnumber %]
903
904                                         [% UNLESS nobranchcode %]
905                                             <li>
906                                                 <label for="libraries" class="required">Library:</label>
907                                                 <select name="branchcode" id="libraries">
908                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => userbranch, only_from_group => 1 ) %]
909                                                 </select>
910                                                 <span class="required">Required</span>
911                                             </li>
912                                         [% END %]
913
914                                         <li>
915                                             <label for="categorycode_entry" class="required">Category: </label>
916                                             <select id="categorycode_entry" name="categorycode">
917                                                 [% FOREACH typeloo IN typeloop %]
918                                                     [% FOREACH categoryloo IN typeloo.categoryloop %]
919                                                         [% IF ( loop.first ) %]
920                                                             [% IF ( typeloo.typename_C ) %]<optgroup label="Child">[% END %]
921                                                             [% IF ( typeloo.typename_A ) %]<optgroup label="Adult">[% END %]
922                                                             [% IF ( typeloo.typename_S ) %]<optgroup label="Staff">[% END %]
923                                                             [% IF ( typeloo.typename_I ) %]<optgroup label="Organization">[% END %]
924                                                             [% IF ( typeloo.typename_P ) %]<optgroup label="Professional">[% END %]
925                                                             [% IF ( typeloo.typename_X ) %]<optgroup label="Statistical">[% END %]
926                                                         [% END %]
927                                                         [% IF ( categoryloo.categorycodeselected ) %]
928                                                             <option value="[% categoryloo.categorycode | html %]" selected="selected" data-pwd-length="[% categoryloo.effective_min_password_length | html %]" data-pwd-strong="[% categoryloo.effective_require_strong_password | html %]" data-typename="[% typeloo.typename | html %]">[% categoryloo.categoryname | html %]</option>
929                                                         [% ELSE %]
930                                                             <option value="[% categoryloo.categorycode | html %]" data-pwd-length="[% categoryloo.effective_min_password_length | html %]" data-pwd-strong="[% categoryloo.effective_require_strong_password | html %]" data-typename="[% typeloo.typename | html %]">[% categoryloo.categoryname | html %]</option>
931                                                         [% END %]
932                                                         [% IF ( loop.last ) %]
933                                                             </optgroup>
934                                                         [% END %]
935                                                     [% END # /FOREACH categoryloo %]
936                                                 [% END # /FOREACH typeloo %]
937                                             </select>
938                                             <span class="required">Required</span>
939                                         </li>
940
941                                         [% UNLESS nosort1 %]
942                                             <li>
943                                                 [% IF ( mandatorysort1 ) %]
944                                                     <label for="sort1" class="required">
945                                                 [% ELSE %]
946                                                     <label for="sort1">
947                                                 [% END %]
948                                                     Sort 1:
949                                                 </label>
950                                                 [% PROCESS 'av-build-dropbox.inc' name="sort1", category="Bsort1", default=borrower_data.sort1, empty=1, size = 20 %]
951                                                 [% IF ( mandatorysort1 ) %]
952                                                     <span class="required">Required</span>
953                                                 [% END %]
954                                             </li>
955                                         [% END # /UNLESS nosort1 %]
956
957                                         [% UNLESS nosort2 %]
958                                             <li>
959                                                 [% IF ( mandatorysort2 ) %]
960                                                     <label for="sort2" class="required">
961                                                 [% ELSE %]
962                                                     <label for="sort2">
963                                                 [% END %]
964                                                     Sort 2:
965                                                 </label>
966                                                 [% PROCESS 'av-build-dropbox.inc' name="sort2", category="Bsort2", default=borrower_data.sort2, empty=1, size = 20 %]
967                                                 [% IF ( mandatorysort2 ) %]
968                                                     <span class="required">Required</span>
969                                                 [% END %]
970                                             </li>
971                                         [% END # /UNLESS nosort2 %]
972
973                                         [% UNLESS noautorenew_checkouts %]
974                                             <li class="radio">
975                                                 <label for="yes-autorenew_checkouts">
976                                                     Allow auto-renewal of items:
977                                                 </label>
978                                                     [% IF ( borrower_data.autorenew_checkouts || opadd ) %]
979                                                         <label for="yes-autorenew_checkouts">
980                                                             Yes
981                                                             <input type="radio" id="yes-autorenew_checkouts" name="autorenew_checkouts" value="1" checked="checked" />
982                                                         </label>
983                                                         <label for="no-autorenew_checkouts">
984                                                             No
985                                                             <input type="radio" id="no-autorenew_checkouts" name="autorenew_checkouts" value="0" />
986                                                         </label>
987                                                     [% ELSE %]
988                                                         <label for="yes-autorenew_checkouts">
989                                                             Yes
990                                                             <input type="radio" id="yes-autorenew_checkouts" name="autorenew_checkouts" value="1" />
991                                                         </label>
992                                                         <label for="no-autorenew_checkouts">
993                                                             No
994                                                             <input type="radio" id="no-autorenew_checkouts" name="autorenew_checkouts" value="0" checked="checked" />
995                                                         </label>
996                                                     [% END %]
997                                             </li>
998                                         [% END %]
999
1000                                         [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
1001                                             <li>
1002                                                 <label for="checkprevcheckout">Check for previous checkouts: </label>
1003                                                 <select name="checkprevcheckout" id="checkprevcheckout">
1004                                                     [% IF ( borrower_data.checkprevcheckout == 'yes' ) %]
1005                                                         <option value="yes" selected="selected">Yes if settings allow it</option>
1006                                                         <option value="no">No if settings allow it</option>
1007                                                         <option value="inherit">Inherit from settings</option>
1008                                                     [% ELSIF ( borrower_data.checkprevcheckout == 'no' ) %]
1009                                                         <option value="yes">Yes if settings allow it</option>
1010                                                         <option value="no" selected="selected">No if settings allow it</option>
1011                                                         <option value="inherit">Inherit from settings</option>
1012                                                     [% ELSE %]
1013                                                         <option value="yes">Yes if settings allow it</option>
1014                                                         <option value="no">No if settings allow it</option>
1015                                                         <option value="inherit" selected="selected">Inherit from settings</option>
1016                                                     [% END %]
1017                                                 </select>
1018                                             </li>
1019                                         [% END # /IF ( Koha.Preference('CheckPrevCheckout') %]
1020
1021                                         [% IF Koha.Preference('TranslateNotices') %]
1022                                             <li>
1023                                                 <label for="lang">Preferred language for notices: </label>
1024                                                 <select id="lang" name="lang">
1025                                                     <option value="default">Default</option>
1026                                                     [% FOR language IN languages %]
1027                                                         [% FOR sublanguage IN language.sublanguages_loop %]
1028                                                             [% IF language.plural %]
1029                                                                 [% IF sublanguage.rfc4646_subtag == borrower_data.lang %]
1030                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
1031                                                                 [% ELSE %]
1032                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
1033                                                                 [% END %]
1034                                                             [% ELSE %]
1035                                                                 [% IF sublanguage.rfc4646_subtag == borrower_data.lang %]
1036                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
1037                                                                 [% ELSE %]
1038                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
1039                                                                 [% END %]
1040                                                             [% END # /IF language.plural %]
1041                                                         [% END # /FOR sublanguage %]
1042                                                     [% END #/FOR language %]
1043                                                 </select> <!-- /#lang -->
1044                                             </li>
1045                                         [% END #/IF Koha.Preference('TranslateNotices') %]
1046                                     </ol>
1047                                 </fieldset> <!-- /#memberentry_library_management -->
1048
1049                                 [% UNLESS nodateenrolled &&  noopacnote && noborrowernotes %]
1050                                     <fieldset class="rows" id="memberentry_subscription">
1051                                         <legend id="library_setup_lgd">Library setup</legend><ol>
1052                                         [% UNLESS nodateenrolled %]
1053                                             <li>
1054                                                 [% IF ( mandatorydateenrolled ) %]
1055                                                     <label for="from" class="required">
1056                                                 [% ELSE %]
1057                                                     <label for="from">
1058                                                 [% END %]
1059                                                     Registration date:
1060                                                 </label>
1061                                                 <input type="text" id="from" name="dateenrolled"  maxlength="10" size="10" value="[% borrower_data.dateenrolled | html %]" class="flatpickr" data-date_to="to" />
1062                                                 [% IF ( mandatorydateenrolled ) %]
1063                                                     <span class="required">Required</span>
1064                                                 [% END %]
1065                                                 [% IF ( ERROR_dateenrolled ) %]
1066                                                     <span class="required">(Error)</span>
1067                                                 [% END %]
1068                                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1069                                             </li>
1070                                         [% END # /UNLESS nodateenrolled %]
1071
1072                                         [% UNLESS nodateexpiry %]
1073                                             <li>
1074                                         [% ELSE %]
1075                                             <li style="display:none">
1076                                         [% END %]
1077                                             [% IF ( mandatorydateexpiry ) %]
1078                                                 <label for="to" class="required">
1079                                             [% ELSE %]
1080                                                 <label for="to">
1081                                             [% END %]
1082                                                     Expiry date (leave blank for auto calc):
1083                                                 </label>
1084                                                 [% UNLESS ( opadd ) %]
1085                                                     <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% borrower_data.dateexpiry | html UNLESS opduplicate %]" class="flatpickr" />
1086                                                 [% ELSE %]
1087                                                     <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% borrower_data.dateexpiry | html %]" class="flatpickr" />
1088                                                 [% END %]
1089                                                 [% IF ( mandatorydateexpiry ) %]
1090                                                     <span class="required">Required</span>
1091                                                 [% END %]
1092                                                 [% IF ( ERROR_dateexpiry ) %]
1093                                                     <span class="required">(Error)</span>
1094                                                 [% END %]
1095                                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1096                                             </li>
1097
1098                                             [% UNLESS noopacnote %]
1099                                                 <li>
1100                                                     [% IF ( mandatoryopacnote ) %]
1101                                                         <label for="opacnote" class="required">
1102                                                     [% ELSE %]
1103                                                         <label for="opacnote">
1104                                                     [% END %]
1105                                                         OPAC note:
1106                                                     </label>
1107                                                     <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% borrower_data.opacnote | html UNLESS opduplicate %]</textarea>
1108                                                     <div class="hint">This message appears on this patron's user page in the OPAC</div>
1109                                                     [% IF ( mandatoryopacnote ) %]
1110                                                         <span class="required">Required</span>
1111                                                     [% END %]
1112                                                 </li>
1113                                             [% END # /UNLESS noopacnote %]
1114
1115                                             [% UNLESS noborrowernotes %]
1116                                                 <li>
1117                                                     [% IF ( mandatoryborrowernotes ) %]
1118                                                         <label for="borrowernotes" class="required">
1119                                                     [% ELSE %]
1120                                                         <label for="borrowernotes">
1121                                                     [% END %]
1122                                                         Circulation note:
1123                                                     </label>
1124                                                     <textarea id="borrowernotes" name="borrowernotes" cols="55" rows="5">[% borrower_data.borrowernotes | html UNLESS opduplicate %]</textarea>
1125                                                     <div class="hint">This message displays when checking out to this patron</div>
1126                                                     [% IF ( mandatoryborrowernotes ) %]
1127                                                         <span class="required">Required</span>
1128                                                     [% END %]
1129                                                 </li>
1130                                             [% END # /UNLESS noborrowernotes %]
1131                                         </ol>
1132                                     </fieldset> <!-- /#memberentry_subscription -->
1133                                 [% END # hide fieldset %]
1134
1135                                 [% UNLESS nouserid && nopassword && !CanUpdatePasswordExpiration %]
1136                                     <fieldset class="rows" id="memberentry_userid">
1137                                         <legend id="opac_staff_login_lgd">OPAC/Staff interface login</legend>
1138                                         <ol>
1139                                             [% UNLESS nouserid %]
1140                                                 <li>
1141                                                     [% IF ( mandatoryuserid ) %]
1142                                                         <label for="userid" class="required">
1143                                                     [% ELSE %]
1144                                                         <label for="userid">
1145                                                     [% END %]
1146                                                         Username:
1147                                                     </label>
1148
1149                                                     [% IF ( NoUpdateLogin ) %]
1150                                                         [% IF ( opduplicate ) %]
1151                                                             <input type="text" id="userid" name="userid" size="20" disabled="disabled" />
1152                                                         [% ELSE %]
1153                                                             <input type="text" id="userid" name="userid" size="20" disabled="disabled" value="[% borrower_data.userid | html %]" />
1154                                                         [% END %]
1155                                                     [% ELSE %]
1156                                                         [% IF ( opduplicate ) %]
1157                                                             <input type="text" id="userid" name="userid" size="20" value="" />
1158                                                         [% ELSE %]
1159                                                             <input type="text" id="userid" name="userid" size="20" value="[% borrower_data.userid | html %]" />
1160                                                         [% END %]
1161                                                     [% END # /IF ( NoUpdateLogin ) %]
1162
1163                                                     [%# Dummy input to avoid Firefox from using userid/password saved for authentication %]
1164                                                     <input type="text" disabled="disabled" style="display:none" />
1165
1166                                                     [% IF ( mandatoryuserid ) %]
1167                                                         <span class="required">Required</span>
1168                                                     [% END %]
1169                                                 </li>
1170                                             [% END # /UNLESS nouserid %]
1171
1172                                             [% UNLESS nopassword %]
1173                                                 <li>
1174                                                     [% IF ( mandatorypassword ) %]
1175                                                         <label for="password" class="required">
1176                                                     [% ELSE %]
1177                                                         <label for="password">
1178                                                     [% END %]
1179                                                         Password:
1180                                                     </label>
1181                                                     [% IF ( opadd ) %]
1182                                                         [% IF ( NoUpdateLogin ) %]
1183                                                             [% IF ( opduplicate ) %]
1184                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" />
1185                                                             [% ELSE %]
1186                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" value="[% borrower_data.password | html %]" />
1187                                                             [% END %]
1188                                                         [% ELSE %]
1189                                                             [% IF ( opduplicate ) %]
1190                                                                 <input type="password" id="password" name="password" size="20" autocomplete="new-password" />
1191                                                             [% ELSE %]
1192                                                                 <input type="password" id="password" name="password" size="20" autocomplete="new-password" value="[% borrower_data.password | html %]" />
1193                                                             [% END %]
1194                                                         [% END # /IF ( NoUpdateLogin ) %]
1195                                                     [% ELSE # IF ( opadd ) %]
1196
1197                                                         [% IF ( borrower_data.password ) %]
1198                                                             [% IF ( NoUpdateLogin ) %]
1199                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" value="****" />
1200                                                             [% ELSE %]
1201                                                                 [% IF ( opduplicate ) %]
1202                                                                     <input type="password" id="password" name="password" autocomplete="new-password" size="20" />
1203                                                                 [% ELSE %]
1204                                                                     <input type="password" id="password" name="password" size="20" value="****" />
1205                                                                 [% END %]
1206                                                             [% END %]
1207                                                         [% ELSE %]
1208                                                             [% IF ( NoUpdateLogin ) %]
1209                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" value="" />
1210                                                             [% ELSE %]
1211                                                                 <input type="password" id="password" name="password" size="20" autocomplete="new-password" value="" />
1212                                                             [% END %]
1213                                                         [% END # /IF ( password ) %]
1214                                                     [% END # /IF ( opadd )  %]
1215                                                     [% IF ( mandatorypassword ) %]
1216                                                         <span class="required">Required</span>
1217                                                     [% END %]
1218                                                     [% IF ( ERROR_password_too_short ) %]
1219                                                         <span class="required">Password is too short</span>
1220                                                     [% END %]
1221                                                     [% IF ( ERROR_password_too_weak ) %]
1222                                                         <span class="required">Password is too weak</span>
1223                                                     [% END %]
1224                                                     [% IF ( ERROR_password_has_whitespaces ) %]
1225                                                         <span class="required">Password has leading or trailing whitespaces</span>
1226                                                     [% END %]
1227                                                     <div class="hint">Minimum password length: [% patron.category.effective_min_password_length | html %]</div>
1228                                                 </li>
1229
1230                                                 <li>
1231                                                     [% IF ( mandatorypassword ) %]
1232                                                         <label for="password2" class="required">
1233                                                     [% ELSE %]
1234                                                         <label for="password2">
1235                                                     [% END %]
1236                                                         Confirm password:
1237                                                     </label>
1238                                                     [% IF ( opadd ) %]
1239                                                         [% IF ( NoUpdateLogin ) %]
1240                                                             [% IF ( opduplicate ) %]
1241                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" />
1242                                                             [% ELSE %]
1243                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="[% borrower_data.password | html %]" />
1244                                                             [% END %]
1245                                                         [% ELSE %]
1246                                                             [% IF ( opduplicate ) %]
1247                                                                 <input type="password" id="password2" name="password2" size="20" />
1248                                                             [% ELSE %]
1249                                                                 <input type="password" id="password2" name="password2" size="20" value="[% borrower_data.password | html %]" />
1250                                                             [% END %]
1251                                                         [% END %]
1252                                                     [% ELSE # IF ( opadd ) %]
1253                                                         [% IF ( borrower_data.password ) %]
1254                                                             [% IF ( NoUpdateLogin ) %]
1255                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="****" />
1256                                                             [% ELSE %]
1257                                                                 [% IF ( opduplicate ) %]
1258                                                                     <input type="password" id="password2" name="password2" size="20" />
1259                                                                 [% ELSE %]
1260                                                                     <input type="password" id="password2" name="password2" size="20" value="****" />
1261                                                                 [% END %]
1262                                                             [% END %]
1263                                                         [% ELSE %]
1264                                                             [% IF ( NoUpdateLogin ) %]
1265                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="" />
1266                                                             [% ELSE %]
1267                                                                 <input type="password" id="password2" name="password2" size="20" value="" />
1268                                                             [% END %]
1269                                                         [% END %]
1270                                                     [% END # /IF ( opadd ) %]
1271
1272                                                     [% IF ( mandatorypassword ) %]
1273                                                         <span class="required">Required</span>
1274                                                     [% END %]
1275                                                     [% IF ( ERROR_password_mismatch ) %]
1276                                                         <span class="required">Passwords do not match</span>
1277                                                     [% END %]
1278                                                 </li>
1279                                             [% END # /UNLESS nopassword %]
1280                                             [% UNLESS ( !CanUpdatePasswordExpiration ) %]
1281                                                 <li>
1282                                                     <label for="password_expiration_date">Password expiration date:</label>
1283                                                     <input type="text" id="password_expiration_date" name="password_expiration_date" maxlength="10" size="10" value="[% password_expiration_date | html %]" class="flatpickr" />
1284                                                 </li>
1285                                             [% END %]
1286                                         </ol>
1287                                     </fieldset> <!-- /#memberentry_userid -->
1288                                 [% END # UNLESS nouserid && nopassword && !CanUpdatePasswordExpiration %]
1289
1290                                 <!--this zones are not necessary in modif mode -->
1291                                 [% UNLESS ( opadd || opduplicate ) %]
1292                                     <fieldset class="rows" id="memberentry_account_flags">
1293                                         <legend id="account_flags_lgd">Patron account flags</legend>
1294                                         <ol class="radio">
1295                                             [% FOREACH flagloo IN flagloop %]
1296                                                 <li>
1297                                                     <label class="radio" for="yes[% flagloo.name | html %]">
1298                                                         [% IF ( flagloo.key == 'gonenoaddress' ) %]Gone no address:[% END %]
1299                                                         [% IF ( flagloo.key == 'lost' ) %]Lost card:[% END %]
1300                                                     </label>
1301                                                     [% IF CAN_user_circulate_manage_restrictions %]
1302                                                         <label for="yes[% flagloo.name | html %]">
1303                                                             [% IF ( flagloo.yes ) %]
1304                                                                 <input type="radio" id="yes[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="1" checked="checked" />
1305                                                             [% ELSE %]
1306                                                                 <input type="radio" id="yes[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="1" />
1307                                                             [% END %]
1308                                                                 Yes
1309                                                         </label>
1310                                                         <label for="no[% flagloo.name | html %]">
1311                                                             [% IF ( flagloo.no ) %]
1312                                                                 <input type="radio" id="no[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="0" checked="checked"/>
1313                                                             [% ELSE %]
1314                                                                 <input type="radio" id="no[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="0" />
1315                                                             [% END %]
1316                                                                 No
1317                                                         </label>
1318                                                     [% ELSE %]
1319                                                         [% IF flagloo.yes %]Yes[% ELSE %]No[% END %]
1320                                                     [% END # /IF CAN_user_circulate_manage_restrictions %]
1321                                                 </li>
1322                                             [% END # /FOREACH flagloo %]
1323                                         </ol>
1324                                     </fieldset> <!-- /#memberentry_account_flags -->
1325
1326                                     <fieldset class="rows" id="memberentry_restrictions">
1327                                         <legend id="restrictions_lgd">Patron restrictions</legend>
1328                                         [% IF ( debarments ) %]
1329                                             <table>
1330                                                 <thead>
1331                                                     <tr>
1332                                                          <th>Type</th>
1333                                                          <th>Comment</th>
1334                                                          <th>Expiration</th>
1335                                                          <th>[% tp('patron restriction created on', 'Created') | html %]</th>
1336                                                          [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1337                                                            <th>Remove?</th>
1338                                                          [% END %]
1339                                                     </tr>
1340                                                 </thead>
1341                                                 <tbody>
1342                                                     [% FOREACH d IN debarments %]
1343                                                         <tr>
1344                                                             <td>[% d.type | html %]</td>
1345                                                             <td>
1346                                                                 [% IF d.comment.search('OVERDUES_PROCESS') %]
1347                                                                     Restriction added by overdues process [% d.comment.remove('OVERDUES_PROCESS ') | $raw %]
1348                                                                 [% ELSE %]
1349                                                                     [% d.comment | $raw %]
1350                                                                 [% END %]
1351                                                             </td>
1352                                                             <td>
1353                                                                 [% IF d.expiration %]
1354                                                                     [% d.expiration | $KohaDates %]
1355                                                                 [% ELSE %]
1356                                                                     <em>Indefinite</em>
1357                                                                 [% END %]
1358                                                             </td>
1359                                                             <td>[% d.created | $KohaDates %]</td>
1360                                                             [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1361                                                                 <td>
1362                                                                     <input type="checkbox" id="debarment_[% d.borrower_debarment_id | html %]" name="remove_debarment" value="[% d.borrower_debarment_id | html %]" />
1363                                                                 </td>
1364                                                             [% END %]
1365                                                         </tr>
1366                                                     [% END # /FOREACH d %]
1367                                                 </tbody>
1368                                             </table>
1369                                         [% ELSE %]
1370                                             <p>Patron is currently unrestricted.</p>
1371                                         [% END # /IF ( debarments ) %]
1372
1373                                         [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1374                                             <p><a href="#" id="add_manual_restriction">Add manual restriction</a></p>
1375                                             <fieldset id="manual_restriction_form">
1376                                                 <input type="hidden" id="add_debarment" name="add_debarment" value="0" />
1377                                                 <legend id="manual_restriction_lgd">Add manual restriction</legend>
1378                                                 <ol>
1379                                                     <li>
1380                                                         <label for="debarred_comment">Comment: </label>
1381                                                         <input type="text" id="debarred_comment" name="debarred_comment" />
1382                                                     </li>
1383                                                     <li>
1384                                                         <label for="debarred_expiration">Expiration: </label>
1385                                                         <input name="debarred_expiration" id="debarred_expiration" size="10" value="" class="flatpickr" type="text" />
1386                                                         <a href="#" id="clear_debarred_expiration">Clear date</a>
1387                                                     </li>
1388                                                 </ol>
1389                                                 <p>
1390                                                     <a class="cancel" id="cancel_manual_restriction" href="#">Cancel</a>
1391                                                 </p>
1392                                             </fieldset> <!-- /#manual_restriction_form -->
1393                                         [% END # /IF CAN_user_borrowers_edit_borrowers %]
1394                                     </fieldset> <!-- /#memberentry_restrictions -->
1395                                 [% END # /UNLESS ( opadd || opduplicate ) %]
1396                             [% END # /IF ( step_3 ) %]
1397
1398                             [% IF ( step_7 ) %]
1399                                 [% IF Koha.Preference('HouseboundModule') %]
1400                                     <fieldset class="rows" id="memberentry_housebound_roles">
1401                                         <legend id="housebound_roles">Housebound roles</legend>
1402                                         <ol class="radio">
1403                                             <li>
1404                                                 <label class="radio" for="housebound_chooser">
1405                                                     Chooser:
1406                                                 </label>
1407                                                 [% IF ( housebound_role.housebound_chooser == 1 ) %]
1408                                                     <label for="yes_housebound_chooser">Yes </label>
1409                                                     <input type="radio" id="yes_housebound_chooser" name="housebound_chooser" value="1" checked="checked" />
1410                                                     <label for="no_housebound_chooser">No </label>
1411                                                     <input type="radio" id="no_housebound_chooser" name="housebound_chooser" value="0" />
1412                                                 [% ELSE %]
1413                                                     <label for="yes_housebound_chooser">Yes </label>
1414                                                     <input type="radio" id="yes_housebound_chooser" name="housebound_chooser" value="1" />
1415                                                     <label for="no_housebound_chooser">No </label>
1416                                                     <input type="radio" id="no_housebound_chooser" name="housebound_chooser" value="0" checked="checked" />
1417                                                 [% END %]
1418                                             </li>
1419                                             <li>
1420                                                 <label class="radio" for="housebound_deliverer">Deliverer:</label>
1421                                                 [% IF ( housebound_role.housebound_deliverer == 1 ) %]
1422                                                     <label for="yes_housebound_deliverer">Yes </label>
1423                                                     <input type="radio" id="yes_housebound_deliverer" name="housebound_deliverer" value="1" checked="checked" />
1424                                                     <label for="no_housebound_deliverer">No </label>
1425                                                     <input type="radio" id="no_housebound_deliverer" name="housebound_deliverer" value="0" />
1426                                                 [% ELSE %]
1427                                                     <label for="yes_housebound_deliverer">Yes </label>
1428                                                     <input type="radio" id="yes_housebound_deliverer" name="housebound_deliverer" value="1" />
1429                                                     <label for="no_housebound_deliverer">No </label>
1430                                                     <input type="radio" id="no_housebound_deliverer" name="housebound_deliverer" value="0" checked="checked" />
1431                                                 [% END %]
1432                                             </li>
1433                                         </ol> <!-- /ol.radio -->
1434                                     </fieldset> <!-- /#memberentry_housebound_roles -->
1435                                 [% END # hide fieldset %]
1436                             [% END # IF step_7 %]
1437
1438                             [% IF ( step_4 ) %]
1439                                 [% IF Koha.Preference('ExtendedPatronAttributes') %]
1440                                     [% UNLESS ( no_patron_attribute_types ) %]
1441                                         <fieldset class="rows" id="memberentry_patron_attributes">
1442                                             <legend id="patron_attributes_lgd">Additional attributes and identifiers</legend>
1443                                             <input type="hidden" name="setting_extended_patron_attributes" value="1" />
1444                                             [% FOREACH pa_loo IN patron_attributes %]
1445                                                 <ol class="attributes_table">
1446                                                     [% IF pa_loo.class %]
1447                                                         <fieldset id="aai_[% pa_loo.class | html %]">
1448                                                         <legend id="[% pa_loo.class | html %]_lgd">[% pa_loo.lib | html %]</legend>
1449                                                     [% END %]
1450                                                     [% FOREACH patron_attribute IN pa_loo.items %]
1451                                                         <li data-category_code="[% patron_attribute.category_code | html %]">
1452                                                             [% IF patron_attribute.mandatory %]
1453                                                                 <label for="[% patron_attribute.form_id | html %]" class="required" required="required">[% patron_attribute.description | html %]: </label>
1454                                                             [% ELSE %]
1455                                                                 <label for="[% patron_attribute.form_id | html %]">[% patron_attribute.description | html %]: </label>
1456                                                             [% END %]
1457                                                             [% IF ( patron_attribute.use_dropdown ) %]
1458                                                                 [% IF patron_attribute.mandatory %]
1459                                                                     <select id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]" required="required">
1460                                                                 [% ELSE %]
1461                                                                     <select id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">
1462                                                                 [% END %]
1463                                                                     <option value=""></option>
1464                                                                     [% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %]
1465                                                                         [% IF auth_val_loo.authorised_value == patron_attribute.value %]
1466                                                                             <option value="[% auth_val_loo.authorised_value | html %]" selected="selected">
1467                                                                                 [% auth_val_loo.lib | html %]
1468                                                                             </option>
1469                                                                         [% ELSE %]
1470                                                                             <option value="[% auth_val_loo.authorised_value | html %]" >
1471                                                                                 [% auth_val_loo.lib | html %]
1472                                                                             </option>
1473                                                                         [% END %]
1474                                                                     [% END %]
1475                                                                 </select>
1476                                                             [% ELSE %]
1477                                                                 [% IF patron_attribute.mandatory %]
1478                                                                 <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]" required="required">[% patron_attribute.value | html %]</textarea>
1479                                                                 [% ELSE %]
1480                                                                 <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">[% patron_attribute.value | html %]</textarea>
1481                                                                 [% END %]
1482                                                             [% END # /IF ( patron_attribute.use_dropdown ) %]
1483                                                             <input type="hidden" id="[% patron_attribute.form_id | html %]_code" name="[% patron_attribute.form_id | html %]_code" value="[% patron_attribute.code | html %]" />
1484                                                             <a href="#" class="clear_attribute"><i class="fa fa-fw fa-trash"></i> Clear</a>
1485                                                             [% IF ( patron_attribute.repeatable ) %]
1486                                                                 <a href="#" class="clone_attribute"><i class="fa fa-fw fa-plus"></i> New</a>
1487                                                             [% END %]
1488                                                             [% IF patron_attribute.mandatory %]<span class="required">Required</span>[% END %]
1489                                                         </li>
1490                                                     [% END # /FOREACH patron_attribute %]
1491                                                     [% IF pa_loo.class %]</fieldset>[% END %]
1492                                                 </ol>
1493                                             [% END # /FOREACH pa_loo %]
1494                                         </fieldset> <!-- /#memberentry_patron_attributes -->
1495                                     [% END # UNLESS ( no_patron_attribute_types ) %]
1496                                 [% END # IF Koha.Preference('ExtendedPatronAttributes') %]
1497                             [% END # IF ( step_4 ) %]
1498
1499                             [% IF ( step_5 ) %]
1500                                 [% IF ( EnhancedMessagingPreferences ) %]
1501                                     <fieldset class="rows" id="memberentry_messaging_prefs">
1502                                         <legend id="patron_messaging_prefs_lgd">Patron messaging preferences</legend>
1503                                         <div id="messaging_prefs_loading" class="form-message" style="display:none">
1504                                             <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading new messaging defaults
1505                                         </div>
1506                                         <input type="hidden" name="setting_messaging_prefs" value="1" />
1507                                         [% INCLUDE 'messaging-preference-form.inc' %]
1508                                         [% IF ( SMSSendDriver ) %]
1509                                             <p>
1510                                                 <label for="SMSnumber">SMS number:</label>
1511                                                 <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber | html %]" />
1512                                                 <span class="hint sms_number_help">Please enter numbers only. Prefix the number with + if including the country code.</span>
1513                                             </p>
1514                                             [% UNLESS nosms_provider_id %]
1515                                                 <p>
1516                                                     <label for="sms_provider_id">SMS provider:</label>
1517                                                     <select id="sms_provider_id" name="sms_provider_id">
1518                                                         <option value="">Unknown</option>
1519                                                         [% FOREACH s IN sms_providers %]
1520                                                             [% IF s.id == borrower_data.sms_provider_id %]
1521                                                                 <option value="[% s.id | html %]" selected="selected">[% s.name | html %]</option>
1522                                                             [% ELSE %]
1523                                                                 <option value="[% s.id | html %]">[% s.name | html %]</option>
1524                                                             [% END %]
1525                                                         [% END %]
1526                                                     </select>
1527                                                 </p>
1528                                             [% END # /UNLESS nosms_provider_id %]
1529                                         [% END # IF ( SMSSendDriver ) %]
1530                                     </fieldset>
1531                                 [% END # IF ( EnhancedMessagingPreferences ) %]
1532                             [% END # /IF step_5 %]
1533                         </form> <!-- /#entryform -->
1534
1535                         [% IF quickadd && opadd  && !check_member %]
1536                             <form id="quick_add_form" class="toggler">
1537                                 <fieldset class="rows quick_add"><legend>Quick add</legend>
1538                                     <ol id="quick_add_list">
1539                                     </ol>
1540                                 </fieldset>
1541                             </form>
1542                         [% END %]
1543
1544                     [% END # /UNLESS ( no_add ) %]
1545                 </main>
1546             </div> <!-- /.col-sm-10.col-sm-push-2 -->
1547
1548             [% UNLESS ( opadd ) %]
1549                 <div class="col-sm-2 col-sm-pull-10">
1550                     <aside>
1551                         [% INCLUDE 'circ-menu.inc' %]
1552                     </aside>
1553                 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1554             [% END %]
1555         </div> <!-- /.row -->
1556
1557 [% MACRO jsinclude BLOCK %]
1558     [% Asset.js("lib/hc-sticky.js") | $raw %]
1559     [% INCLUDE 'calendar.inc' %]
1560     [% INCLUDE 'str/members-menu.inc' %]
1561     [% Asset.js("js/members-menu.js") | $raw %]
1562     <script>
1563         function update_cardnumber_warning(size){
1564             var max_len = [% maxlength_cardnumber | html %];
1565             if ( size >= max_len ) {
1566                 $("#cn_max").show();
1567             } else {
1568                 $("#cn_max").hide();
1569             }
1570         }
1571         var Sticky;
1572         function showHideFields(){
1573             [% UNLESS step == 1 %]
1574                 [% IF fieldstohide.match('identity') %]
1575                     $("#memberentry_identity").find('legend').nextAll().toggle();
1576                 [% END %]
1577                 [% IF show_guarantor || guarantor %]
1578                     [% IF fieldstohide.match('guarantor') %]
1579                         $("#memberentry_guarantor").find('legend').nextAll().toggle();
1580                         $("#guarantor_template").toggle();
1581                     [% END %]
1582                 [% END %]
1583                 [% IF fieldstohide.match('primary_address') %]
1584                     $("#memberentry_mainaddress").find('legend').nextAll().toggle();
1585                 [% END %]
1586                 [% IF fieldstohide.match('primary_contact') %]
1587                     $("#memberentry_contact").find('legend').nextAll().toggle();
1588                 [% END %]
1589             [% END %]
1590             [% UNLESS step == 6 %]
1591                 [% IF fieldstohide.match('alt_address') %]
1592                     $("#memberentry_address").find('legend').nextAll().toggle();
1593                 [% END %]
1594             [% END %]
1595             [% UNLESS step == 2 %]
1596                 [% IF fieldstohide.match('alt_contact') %]
1597                     $("#memberentry_altaddress").find('legend').nextAll().toggle();
1598                 [% END %]
1599             [% END %]
1600             [% UNLESS step == 3 %]
1601                 [% IF fieldstohide.match('lib_mgmt') %]
1602                         $("#memberentry_library_management").find('legend').nextAll().toggle();
1603                 [% END %]
1604                 [% UNLESS nodateenrolled && noopacnote && noborrowernotes %]
1605                     [% IF fieldstohide.match('lib_setup') %]
1606                         $("#memberentry_subscription").find('legend').nextAll().toggle();
1607                     [% END %]
1608                 [% END %]
1609                 [% UNLESS nouserid && nopassword %]
1610                     [% IF fieldstohide.match('login') %]
1611                         $("#memberentry_userid").find('legend').nextAll().toggle();
1612                     [% END %]
1613                 [% END %]
1614                 [% UNLESS ( opadd || opduplicate ) %]
1615                     [% IF fieldstohide.match('flags') %]
1616                         $("#memberentry_account_flags").find('legend').nextAll().toggle();
1617                     [% END %]
1618                 [% END %]
1619                 [% IF fieldstohide.match('debarments') %]
1620                     $("#memberentry_restrictions").find('legend').nextAll().toggle();
1621                 [% END %]
1622             [% END %]
1623             [% UNLESS step == 7 %]
1624                 [% IF Koha.Preference('HouseboundModule') %]
1625                     [% IF fieldstohide.match('housebound') %]
1626                         $("#memberentry_housebound_roles").find('legend').nextAll().toggle();
1627                     [% END %]
1628                 [% END %]
1629             [% END %]
1630             [% UNLESS step == 4 %]
1631                 [% IF Koha.Preference('ExtendedPatronAttributes') %]
1632                     [% IF fieldstohide.match('additional') %]
1633                         $("#memberentry_patron_attributes").find('legend').nextAll().toggle();
1634                     [% END %]
1635                 [% END %]
1636             [% END %]
1637             [% UNLESS step == 5 %]
1638                 [% IF Koha.Preference('EnhancedMessagingPreferences') %]
1639                     [% IF fieldstohide.match('messaging') %]
1640                         $("#memberentry_messaging_prefs").find('legend').nextAll().toggle();
1641                         $("#messaging_prefs_loading").toggle();
1642                     [% END %]
1643                 [% END %]
1644             [% END %]
1645         }
1646
1647         $(document).ready(function() {
1648             showHideFields();
1649             $("#toggle_hidden_fields").change(function(){
1650                 showHideFields();
1651             });
1652
1653             $("legend").click(function(){
1654                 $(this).nextAll().toggle();
1655                 $("#messaging_prefs_loading").hide();
1656                 $("#guarantor_template").hide();
1657             });
1658
1659             $("#saverecord").css({ 'margin-left': 0 });
1660
1661             Sticky = $("#toolbar");
1662             Sticky.hcSticky({
1663                 stickTo: "main",
1664                 stickyClass: "floating"
1665             });
1666
1667             [% IF borrower_data.categorycode %]
1668                 update_category_code( "[% borrower_data.categorycode | html %]" );
1669             [% ELSE %]
1670                 if ( $("#categorycode_entry").length > 0 ){
1671                     var category_code = $("#categorycode_entry").find("option:selected").val();
1672                     update_category_code( category_code );
1673                 }
1674             [% END %]
1675
1676             [% IF new_guarantors %]
1677                 [% FOREACH g IN new_guarantors %]
1678                     select_user( '[% g.patron.borrowernumber | html %]', [% To.json( g.patron.unblessed ) | $raw %], '[% g.relationship | html %]' );
1679                 [% END %]
1680             [% END %]
1681
1682             $("#cn_max").hide();
1683             var content;
1684             $("#cardnumber").on("keydown", function(e){
1685                 content = $(this).val();
1686             });
1687             $("#cardnumber").on("keyup", function(e){
1688                 // .val() will return the value of the input after the key has been released
1689                 var l = $(this).val().length;
1690                 if ( l == content.length + 1 ) { l--; }
1691                 update_cardnumber_warning(l);
1692             });
1693             $("#cardnumber").bind("paste", function(e){
1694                 var pastedData = e.originalEvent.clipboardData.getData('text');
1695                 update_cardnumber_warning(pastedData.length - 1);
1696             } );
1697             var toggle_quick_add = $(".toggle_quick_add");
1698             $(toggle_quick_add).click(function(e){
1699                 toggle_quick_add.toggle();
1700                 e.preventDefault();
1701                 var toggle_to = '';
1702                 var toggle_from = '';
1703                 if( $("#entryform:visible").length ) {
1704                     toggle_to = "#quick_add_form label";
1705                     toggle_from = "#entryform label";
1706                     $("#memberentry_guarantor").appendTo("#quick_add_form");
1707                 } else {
1708                     toggle_to="#entryform label";
1709                     toggle_from = "#quick_add_form label";
1710                     $("#memberentry_guarantor").appendTo("#memberentry_guarantor_anchor");
1711                 }
1712                 $(toggle_from).each(function() {
1713                     var input_label = $(this).attr('for');
1714                     if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' || input_label == 'sex-other' ) {
1715                         $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') );
1716                         return;
1717                     }
1718                     $(toggle_to+"[for='"+input_label+"']").next().val(  $(this).next().val() );
1719                 });
1720
1721                 $(".toggler").toggle();
1722             });
1723
1724             $("#save_quick_add").click(function(){
1725                 $("#quick_add_form").validate();
1726                 if( $("#quick_add_form").valid()){
1727                     $('.toggle_quick_add').click();
1728                     $("#memberentry_guarantor").appendTo("#memberentry_guarantor_anchor");
1729                     $('#saverecord').click();
1730                 }
1731                 else {return false;}
1732             });
1733
1734             $("#saverecord").click(function(){
1735                 if( check_form_borrowers() ){
1736                     $("#entryform").submit();
1737                 }
1738             });
1739
1740             $('#duplicate').on('click', function() {
1741                 $("input[name='op']").val('modify');
1742                 $("input[name='borrowernumber']").val('[% check_member | html %]');
1743                 $("input[name='check_member']").val('');
1744                 $('#entryform').submit();
1745             });
1746
1747             $('#not-duplicate').on('click', function() {
1748                 $("input[name='nodouble']").val('1');
1749                 $('#entryform').submit();
1750             });
1751
1752             $(".popup_patronview").on("click", function(e){
1753                 e.preventDefault();
1754                 var url = $(this).attr("href");
1755                 openWindow( url, "patronview" );
1756             });
1757
1758             $("#dateofbirth").on("change", function(){
1759                  write_age();
1760             });
1761
1762             $("#debarred_comment, #debarred_expiration").on("change", function(){
1763                 $("#add_debarment").val(1);
1764             });
1765
1766             $("#clear_debarred_expiration").on("click", function(e){
1767                 e.preventDefault();
1768                 $('#debarred_expiration').val("");
1769             });
1770
1771             $("#memberentry_patron_attributes").on("click", ".clear_attribute", function(e){
1772                 e.preventDefault();
1773                 clear_entry( this );
1774             });
1775
1776             $("#memberentry_patron_attributes").on("click", ".clone_attribute", function(e){
1777                 e.preventDefault();
1778                 clone_entry( this );
1779             });
1780
1781             $("#categorycode_entry").on("change", function(){
1782                 update_category_code(this);
1783             });
1784         });
1785
1786         [% IF quickadd && opadd  && !check_member %]
1787             $(document).ready(function () {
1788
1789                 $("#entryform,#saverecord").hide();
1790                 [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
1791                 var qaddfields = [[% FOREACH field IN q_add_f.unique %]"[% field | html %]",[% END %]];
1792                 $("#entryform label").each(function () {
1793                     var input_label = $(this).attr('for');
1794                     if ( input_label == 'sex-female' ) {
1795                         input_label='sex';
1796                     }
1797                     else if ( input_label == 'btitle' ) {
1798                         input_label='title';
1799                     }
1800                     if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){
1801                        $(this).parent().clone().appendTo("#quick_add_list");
1802                        [% UNLESS mandatorypassword %]
1803                              if( input_label == 'password' ) $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list");
1804                        [% END %]
1805                     }
1806                 });
1807                 if ( $("#memberentry_guarantor").length ) {
1808                     $("#memberentry_guarantor").appendTo("#quick_add_form");
1809                 }
1810                 $("#quick_add_form").show();
1811             });
1812         [% END %]
1813         $("#guarantor_template").hide();
1814
1815     </script>
1816     [% Asset.js("js/members.js") | $raw %]
1817     [% Asset.js("js/messaging-preference-form.js") | $raw %]
1818     [% PROCESS 'password_check.inc' new_password => 'password', category_selector => '#categorycode_entry', minPasswordLength => patron.category.effective_min_password_length, RequireStrongPassword => patron.category.effective_require_strong_password %]
1819 [% END %]
1820
1821 [% INCLUDE 'intranet-bottom.inc' %]