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