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