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