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