Bug 31422: Add patron's current category to dropdown while editing
[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">Home</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-primary toggler" id="save_quick_add" name="save"><i class="fa fa-save"></i> Save</button>
231                                 [% END %]
232                                 <button class="btn btn-primary toggler" id="saverecord" name="save" ><i class="fa fa-save"></i> Save</button>
233                                 [% IF opadd %]
234                                     <a class="btn btn-link" href="/cgi-bin/koha/members/member.pl" class="toggler save_entryform">
235                                 [% ELSE %]
236                                     <a class="btn btn-link" 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                                             [% IF limited_category %]
978                                                 <span style="float:right;" title="The patron's current category ([% patron_category.description | html %]) is limited to other branches"><i class="fa fa-exclamation-circle" aria-hidden="true"></i></span>
979                                             [% END %]
980                                             <span class="required">Required</span>
981                                         </li>
982
983                                         [% UNLESS nosort1 %]
984                                             <li>
985                                                 [% IF ( mandatorysort1 ) %]
986                                                     <label for="sort1" class="required">
987                                                 [% ELSE %]
988                                                     <label for="sort1">
989                                                 [% END %]
990                                                     Sort 1:
991                                                 </label>
992                                                 [% PROCESS 'av-build-dropbox.inc' name="sort1", category="Bsort1", default=borrower_data.sort1, empty=1, size = 20 %]
993                                                 [% IF ( mandatorysort1 ) %]
994                                                     <span class="required">Required</span>
995                                                 [% END %]
996                                             </li>
997                                         [% END # /UNLESS nosort1 %]
998
999                                         [% UNLESS nosort2 %]
1000                                             <li>
1001                                                 [% IF ( mandatorysort2 ) %]
1002                                                     <label for="sort2" class="required">
1003                                                 [% ELSE %]
1004                                                     <label for="sort2">
1005                                                 [% END %]
1006                                                     Sort 2:
1007                                                 </label>
1008                                                 [% PROCESS 'av-build-dropbox.inc' name="sort2", category="Bsort2", default=borrower_data.sort2, empty=1, size = 20 %]
1009                                                 [% IF ( mandatorysort2 ) %]
1010                                                     <span class="required">Required</span>
1011                                                 [% END %]
1012                                             </li>
1013                                         [% END # /UNLESS nosort2 %]
1014
1015                                         [% UNLESS noautorenew_checkouts %]
1016                                             <li class="radio">
1017                                                 <label for="yes-autorenew_checkouts">
1018                                                     Allow auto-renewal of items:
1019                                                 </label>
1020                                                     [% IF ( borrower_data.autorenew_checkouts || opadd ) %]
1021                                                         <label for="yes-autorenew_checkouts">
1022                                                             Yes
1023                                                             <input type="radio" id="yes-autorenew_checkouts" name="autorenew_checkouts" value="1" checked="checked" />
1024                                                         </label>
1025                                                         <label for="no-autorenew_checkouts">
1026                                                             No
1027                                                             <input type="radio" id="no-autorenew_checkouts" name="autorenew_checkouts" value="0" />
1028                                                         </label>
1029                                                     [% ELSE %]
1030                                                         <label for="yes-autorenew_checkouts">
1031                                                             Yes
1032                                                             <input type="radio" id="yes-autorenew_checkouts" name="autorenew_checkouts" value="1" />
1033                                                         </label>
1034                                                         <label for="no-autorenew_checkouts">
1035                                                             No
1036                                                             <input type="radio" id="no-autorenew_checkouts" name="autorenew_checkouts" value="0" checked="checked" />
1037                                                         </label>
1038                                                     [% END %]
1039                                             </li>
1040                                         [% END %]
1041
1042                                         [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
1043                                             <li>
1044                                                 <label for="checkprevcheckout">Check for previous checkouts: </label>
1045                                                 <select name="checkprevcheckout" id="checkprevcheckout">
1046                                                     [% IF ( borrower_data.checkprevcheckout == 'yes' ) %]
1047                                                         <option value="yes" selected="selected">Yes if settings allow it</option>
1048                                                         <option value="no">No if settings allow it</option>
1049                                                         <option value="inherit">Inherit from settings</option>
1050                                                     [% ELSIF ( borrower_data.checkprevcheckout == 'no' ) %]
1051                                                         <option value="yes">Yes if settings allow it</option>
1052                                                         <option value="no" selected="selected">No if settings allow it</option>
1053                                                         <option value="inherit">Inherit from settings</option>
1054                                                     [% ELSE %]
1055                                                         <option value="yes">Yes if settings allow it</option>
1056                                                         <option value="no">No if settings allow it</option>
1057                                                         <option value="inherit" selected="selected">Inherit from settings</option>
1058                                                     [% END %]
1059                                                 </select>
1060                                             </li>
1061                                         [% END # /IF ( Koha.Preference('CheckPrevCheckout') %]
1062
1063                                         [% IF Koha.Preference('TranslateNotices') %]
1064                                             <li>
1065                                                 <label for="lang">Preferred language for notices: </label>
1066                                                 <select id="lang" name="lang">
1067                                                     <option value="default">Default</option>
1068                                                     [% FOR language IN languages %]
1069                                                         [% FOR sublanguage IN language.sublanguages_loop %]
1070                                                             [% IF language.plural %]
1071                                                                 [% IF sublanguage.rfc4646_subtag == borrower_data.lang %]
1072                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
1073                                                                 [% ELSE %]
1074                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
1075                                                                 [% END %]
1076                                                             [% ELSE %]
1077                                                                 [% IF sublanguage.rfc4646_subtag == borrower_data.lang %]
1078                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
1079                                                                 [% ELSE %]
1080                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
1081                                                                 [% END %]
1082                                                             [% END # /IF language.plural %]
1083                                                         [% END # /FOR sublanguage %]
1084                                                     [% END #/FOR language %]
1085                                                 </select> <!-- /#lang -->
1086                                             </li>
1087                                         [% END #/IF Koha.Preference('TranslateNotices') %]
1088                                     </ol>
1089                                 </fieldset> <!-- /#memberentry_library_management -->
1090
1091                                 [% UNLESS nodateenrolled &&  noopacnote && noborrowernotes %]
1092                                     <fieldset class="rows" id="memberentry_subscription">
1093                                         <legend id="library_setup_lgd">Library setup</legend><ol>
1094                                         [% UNLESS nodateenrolled %]
1095                                             <li>
1096                                                 [% IF ( mandatorydateenrolled ) %]
1097                                                     <label for="from" class="required">
1098                                                 [% ELSE %]
1099                                                     <label for="from">
1100                                                 [% END %]
1101                                                     Registration date:
1102                                                 </label>
1103                                                 <input type="text" id="from" name="dateenrolled"  maxlength="10" size="10" value="[% borrower_data.dateenrolled | html %]" class="flatpickr" data-date_to="to" />
1104                                                 [% IF ( mandatorydateenrolled ) %]
1105                                                     <span class="required">Required</span>
1106                                                 [% END %]
1107                                                 [% IF ( ERROR_dateenrolled ) %]
1108                                                     <span class="required">(Error)</span>
1109                                                 [% END %]
1110                                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1111                                             </li>
1112                                         [% END # /UNLESS nodateenrolled %]
1113
1114                                         [% UNLESS nodateexpiry %]
1115                                             <li>
1116                                         [% ELSE %]
1117                                             <li style="display:none">
1118                                         [% END %]
1119                                             [% IF ( mandatorydateexpiry ) %]
1120                                                 <label for="to" class="required">
1121                                             [% ELSE %]
1122                                                 <label for="to">
1123                                             [% END %]
1124                                                     Expiry date (leave blank for auto calc):
1125                                                 </label>
1126                                                 [% UNLESS ( opadd ) %]
1127                                                     <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% borrower_data.dateexpiry | html UNLESS opduplicate %]" class="flatpickr" />
1128                                                 [% ELSE %]
1129                                                     <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% borrower_data.dateexpiry | html %]" class="flatpickr" />
1130                                                 [% END %]
1131                                                 [% IF ( mandatorydateexpiry ) %]
1132                                                     <span class="required">Required</span>
1133                                                 [% END %]
1134                                                 [% IF ( ERROR_dateexpiry ) %]
1135                                                     <span class="required">(Error)</span>
1136                                                 [% END %]
1137                                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1138                                             </li>
1139
1140                                             [% UNLESS noopacnote %]
1141                                                 <li>
1142                                                     [% IF ( mandatoryopacnote ) %]
1143                                                         <label for="opacnote" class="required">
1144                                                     [% ELSE %]
1145                                                         <label for="opacnote">
1146                                                     [% END %]
1147                                                         OPAC note:
1148                                                     </label>
1149                                                     <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% borrower_data.opacnote | html UNLESS opduplicate %]</textarea>
1150                                                     <div class="hint">This message appears on this patron's user page in the OPAC</div>
1151                                                     [% IF ( mandatoryopacnote ) %]
1152                                                         <span class="required">Required</span>
1153                                                     [% END %]
1154                                                 </li>
1155                                             [% END # /UNLESS noopacnote %]
1156
1157                                             [% UNLESS noborrowernotes %]
1158                                                 <li>
1159                                                     [% IF ( mandatoryborrowernotes ) %]
1160                                                         <label for="borrowernotes" class="required">
1161                                                     [% ELSE %]
1162                                                         <label for="borrowernotes">
1163                                                     [% END %]
1164                                                         Circulation note:
1165                                                     </label>
1166                                                     <textarea id="borrowernotes" name="borrowernotes" cols="55" rows="5">[% borrower_data.borrowernotes | html UNLESS opduplicate %]</textarea>
1167                                                     <div class="hint">This message displays when checking out to this patron</div>
1168                                                     [% IF ( mandatoryborrowernotes ) %]
1169                                                         <span class="required">Required</span>
1170                                                     [% END %]
1171                                                 </li>
1172                                             [% END # /UNLESS noborrowernotes %]
1173                                         </ol>
1174                                     </fieldset> <!-- /#memberentry_subscription -->
1175                                 [% END # hide fieldset %]
1176
1177                                 [% UNLESS nouserid && nopassword && !CanUpdatePasswordExpiration %]
1178                                     <fieldset class="rows" id="memberentry_userid">
1179                                         <legend id="opac_staff_login_lgd">OPAC/Staff interface login</legend>
1180                                         <ol>
1181                                             [% UNLESS nouserid %]
1182                                                 <li>
1183                                                     [% IF ( mandatoryuserid ) %]
1184                                                         <label for="userid" class="required">
1185                                                     [% ELSE %]
1186                                                         <label for="userid">
1187                                                     [% END %]
1188                                                         Username:
1189                                                     </label>
1190
1191                                                     [% IF ( NoUpdateLogin ) %]
1192                                                         [% IF ( opduplicate ) %]
1193                                                             <input type="text" id="userid" name="userid" size="20" disabled="disabled" />
1194                                                         [% ELSE %]
1195                                                             <input type="text" id="userid" name="userid" size="20" disabled="disabled" value="[% borrower_data.userid | html %]" />
1196                                                         [% END %]
1197                                                     [% ELSE %]
1198                                                         [% IF ( opduplicate ) %]
1199                                                             <input type="text" id="userid" name="userid" size="20" value="" />
1200                                                         [% ELSE %]
1201                                                             <input type="text" id="userid" name="userid" size="20" value="[% borrower_data.userid | html %]" />
1202                                                         [% END %]
1203                                                     [% END # /IF ( NoUpdateLogin ) %]
1204
1205                                                     [%# Dummy input to avoid Firefox from using userid/password saved for authentication %]
1206                                                     <input type="text" disabled="disabled" style="display:none" />
1207
1208                                                     [% IF ( mandatoryuserid ) %]
1209                                                         <span class="required">Required</span>
1210                                                     [% END %]
1211                                                 </li>
1212                                             [% END # /UNLESS nouserid %]
1213
1214                                             [% UNLESS nopassword %]
1215                                                 <li>
1216                                                     [% IF ( mandatorypassword ) %]
1217                                                         <label for="password" class="required">
1218                                                     [% ELSE %]
1219                                                         <label for="password">
1220                                                     [% END %]
1221                                                         Password:
1222                                                     </label>
1223                                                     [% IF ( opadd ) %]
1224                                                         [% IF ( NoUpdateLogin ) %]
1225                                                             [% IF ( opduplicate ) %]
1226                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" />
1227                                                             [% ELSE %]
1228                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" value="[% borrower_data.password | html %]" />
1229                                                             [% END %]
1230                                                         [% ELSE %]
1231                                                             [% IF ( opduplicate ) %]
1232                                                                 <input type="password" id="password" name="password" size="20" autocomplete="new-password" />
1233                                                             [% ELSE %]
1234                                                                 <input type="password" id="password" name="password" size="20" autocomplete="new-password" value="[% borrower_data.password | html %]" />
1235                                                             [% END %]
1236                                                         [% END # /IF ( NoUpdateLogin ) %]
1237                                                     [% ELSE # IF ( opadd ) %]
1238
1239                                                         [% IF ( borrower_data.password ) %]
1240                                                             [% IF ( NoUpdateLogin ) %]
1241                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" value="****" />
1242                                                             [% ELSE %]
1243                                                                 [% IF ( opduplicate ) %]
1244                                                                     <input type="password" id="password" name="password" autocomplete="new-password" size="20" />
1245                                                                 [% ELSE %]
1246                                                                     <input type="password" id="password" name="password" size="20" value="****" />
1247                                                                 [% END %]
1248                                                             [% END %]
1249                                                         [% ELSE %]
1250                                                             [% IF ( NoUpdateLogin ) %]
1251                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" value="" />
1252                                                             [% ELSE %]
1253                                                                 <input type="password" id="password" name="password" size="20" autocomplete="new-password" value="" />
1254                                                             [% END %]
1255                                                         [% END # /IF ( password ) %]
1256                                                     [% END # /IF ( opadd )  %]
1257                                                     [% IF ( mandatorypassword ) %]
1258                                                         <span class="required">Required</span>
1259                                                     [% END %]
1260                                                     [% IF ( ERROR_password_too_short ) %]
1261                                                         <span class="required">Password is too short</span>
1262                                                     [% END %]
1263                                                     [% IF ( ERROR_password_too_weak ) %]
1264                                                         <span class="required">Password is too weak</span>
1265                                                     [% END %]
1266                                                     [% IF ( ERROR_password_has_whitespaces ) %]
1267                                                         <span class="required">Password has leading or trailing whitespaces</span>
1268                                                     [% END %]
1269                                                     <div class="hint">Minimum password length: [% patron.category.effective_min_password_length | html %]</div>
1270                                                 </li>
1271
1272                                                 <li>
1273                                                     [% IF ( mandatorypassword ) %]
1274                                                         <label for="password2" class="required">
1275                                                     [% ELSE %]
1276                                                         <label for="password2">
1277                                                     [% END %]
1278                                                         Confirm password:
1279                                                     </label>
1280                                                     [% IF ( opadd ) %]
1281                                                         [% IF ( NoUpdateLogin ) %]
1282                                                             [% IF ( opduplicate ) %]
1283                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" />
1284                                                             [% ELSE %]
1285                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="[% borrower_data.password | html %]" />
1286                                                             [% END %]
1287                                                         [% ELSE %]
1288                                                             [% IF ( opduplicate ) %]
1289                                                                 <input type="password" id="password2" name="password2" size="20" />
1290                                                             [% ELSE %]
1291                                                                 <input type="password" id="password2" name="password2" size="20" value="[% borrower_data.password | html %]" />
1292                                                             [% END %]
1293                                                         [% END %]
1294                                                     [% ELSE # IF ( opadd ) %]
1295                                                         [% IF ( borrower_data.password ) %]
1296                                                             [% IF ( NoUpdateLogin ) %]
1297                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="****" />
1298                                                             [% ELSE %]
1299                                                                 [% IF ( opduplicate ) %]
1300                                                                     <input type="password" id="password2" name="password2" size="20" />
1301                                                                 [% ELSE %]
1302                                                                     <input type="password" id="password2" name="password2" size="20" value="****" />
1303                                                                 [% END %]
1304                                                             [% END %]
1305                                                         [% ELSE %]
1306                                                             [% IF ( NoUpdateLogin ) %]
1307                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="" />
1308                                                             [% ELSE %]
1309                                                                 <input type="password" id="password2" name="password2" size="20" value="" />
1310                                                             [% END %]
1311                                                         [% END %]
1312                                                     [% END # /IF ( opadd ) %]
1313
1314                                                     [% IF ( mandatorypassword ) %]
1315                                                         <span class="required">Required</span>
1316                                                     [% END %]
1317                                                     [% IF ( ERROR_password_mismatch ) %]
1318                                                         <span class="required">Passwords do not match</span>
1319                                                     [% END %]
1320                                                 </li>
1321                                             [% END # /UNLESS nopassword %]
1322                                             [% UNLESS ( !CanUpdatePasswordExpiration ) %]
1323                                                 <li>
1324                                                     <label for="password_expiration_date">Password expiration date:</label>
1325                                                     <input type="text" id="password_expiration_date" name="password_expiration_date" maxlength="10" size="10" value="[% password_expiration_date | html %]" class="flatpickr" />
1326                                                 </li>
1327                                             [% END %]
1328                                         </ol>
1329                                     </fieldset> <!-- /#memberentry_userid -->
1330                                 [% END # UNLESS nouserid && nopassword && !CanUpdatePasswordExpiration %]
1331
1332                                 <!--this zones are not necessary in modif mode -->
1333                                 [% UNLESS ( opadd || opduplicate || ( nogonenoaddress && nolost ) ) %]
1334                                     <fieldset class="rows" id="memberentry_account_flags">
1335                                         <legend id="account_flags_lgd">Patron account flags</legend>
1336                                         <p>Setting a value here will prevent patron from circulating materials and placing holds on the OPAC</p>
1337                                         <ol class="radio">
1338                                             [% UNLESS nogonenoaddress %]
1339                                                 <li>
1340                                                     [% IF mandatorygonenoaddress %]
1341                                                         <label class="radio required" for="yesgonenoaddress">
1342                                                     [% ELSE %]
1343                                                         <label class="radio" for="yesgonenoaddress">
1344                                                     [% END %]
1345                                                         Gone no address:
1346                                                     </label>
1347                                                     [% IF CAN_user_circulate_manage_restrictions %]
1348                                                         <label for="yesgonenoaddress">
1349                                                             [% IF ( borrower_data.gonenoaddress ) %]
1350                                                                 <input type="radio" id="yesgonenoaddress" name="gonenoaddress" value="1" checked="checked" />
1351                                                             [% ELSE %]
1352                                                                 <input type="radio" id="yesgonenoaddress" name="gonenoaddress" value="1" />
1353                                                             [% END %]
1354                                                                 Yes
1355                                                         </label>
1356                                                         <label for="nogonenoaddress">
1357                                                             [% IF ( borrower_data.gonenoaddress ) %]
1358                                                                 <input type="radio" id="nogonenoaddress" name="gonenoaddress" value="0" />
1359                                                             [% ELSE %]
1360                                                                 <input type="radio" id="nogonenoaddress" name="gonenoaddress" value="0" checked="checked"/>
1361                                                             [% END %]
1362                                                                 No
1363                                                         </label>
1364                                                     [% ELSE %]
1365                                                         [% IF borrower_data.gonenoaddress %]<span>Yes</span>[% ELSE %]<span>No</span>[% END %]
1366                                                     [% END # /IF CAN_user_circulate_manage_restrictions %]
1367                                                     [% IF mandatorygonenoaddress %]
1368                                                         <span class="required">Required</span>
1369                                                     [% END %]
1370                                                 </li>
1371
1372                                             [% END # /UNLESS nogonenoaddress %]
1373                                             [% UNLESS nolost %]
1374                                                 <li>
1375                                                     [% IF mandatorylost %]
1376                                                         <label class="radio required" for="yeslost">
1377                                                     [% ELSE %]
1378                                                         <label class="radio" for="yeslost">
1379                                                     [% END %]
1380                                                         Lost card:
1381                                                     </label>
1382                                                     [% IF CAN_user_circulate_manage_restrictions %]
1383                                                         <label for="yeslost">
1384                                                             [% IF ( borrower_data.lost ) %]
1385                                                                 <input type="radio" id="yeslost" name="lost" value="1" checked="checked" />
1386                                                             [% ELSE %]
1387                                                                 <input type="radio" id="yeslost" name="lost" value="1" />
1388                                                             [% END %]
1389                                                                 Yes
1390                                                         </label>
1391                                                         <label for="nolost">
1392                                                             [% IF ( borrower_data.lost ) %]
1393                                                                 <input type="radio" id="nolost" name="lost" value="0" />
1394                                                             [% ELSE %]
1395                                                                 <input type="radio" id="nolost" name="lost" value="0" checked="checked"/>
1396                                                             [% END %]
1397                                                                 No
1398                                                         </label>
1399                                                     [% ELSE %]
1400                                                         [% IF borrower_data.lost %]<span>Yes</span>[% ELSE %]<span>No</span>[% END %]
1401                                                     [% END # /IF CAN_user_circulate_manage_restrictions %]
1402                                                     [% IF mandatorylost %]
1403                                                         <span class="required">Required</span>
1404                                                     [% END %]
1405                                                 </li>
1406                                             [% END # /UNLESS nogonenoaddress %]
1407                                         </ol>
1408                                     </fieldset> <!-- /#memberentry_account_flags -->
1409
1410                                     <fieldset class="rows" id="memberentry_restrictions">
1411                                         <legend id="restrictions_lgd">Patron restrictions</legend>
1412                                         [% IF ( debarments ) %]
1413                                             <table>
1414                                                 <thead>
1415                                                     <tr>
1416                                                          <th>Type</th>
1417                                                          <th>Comment</th>
1418                                                          <th>Expiration</th>
1419                                                          <th>[% tp('patron restriction created on', 'Created') | html %]</th>
1420                                                          [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1421                                                            <th>Remove?</th>
1422                                                          [% END %]
1423                                                     </tr>
1424                                                 </thead>
1425                                                 <tbody>
1426                                                     [% FOREACH d IN debarments %]
1427                                                         [% dtype = d.type %]
1428                                                         <tr>
1429                                                             <td>[% restriction_types.$dtype.display_text | html %]</td>
1430                                                             <td>
1431                                                                 [% IF d.comment.search('OVERDUES_PROCESS') %]
1432                                                                     Restriction added by overdues process [% d.comment.remove('OVERDUES_PROCESS ') | $raw %]
1433                                                                 [% ELSE %]
1434                                                                     [% d.comment | $raw %]
1435                                                                 [% END %]
1436                                                             </td>
1437                                                             <td>
1438                                                                 [% IF d.expiration %]
1439                                                                     [% d.expiration | $KohaDates %]
1440                                                                 [% ELSE %]
1441                                                                     <em>Indefinite</em>
1442                                                                 [% END %]
1443                                                             </td>
1444                                                             <td>[% d.created | $KohaDates %]</td>
1445                                                             [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1446                                                                 <td>
1447                                                                     <input type="checkbox" id="debarment_[% d.borrower_debarment_id | html %]" name="remove_debarment" value="[% d.borrower_debarment_id | html %]" />
1448                                                                 </td>
1449                                                             [% END %]
1450                                                         </tr>
1451                                                     [% END # /FOREACH d %]
1452                                                 </tbody>
1453                                             </table>
1454                                         [% ELSE %]
1455                                             <p>Patron is currently unrestricted.</p>
1456                                         [% END # /IF ( debarments ) %]
1457
1458                                         [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1459                                             <p><a href="#" id="add_manual_restriction">Add manual restriction</a></p>
1460                                             <fieldset id="manual_restriction_form">
1461                                                 <input type="hidden" id="add_debarment" name="add_debarment" value="0" />
1462                                                 <legend id="manual_restriction_lgd">Add manual restriction</legend>
1463                                                 <ol>
1464                                                     [% IF Koha.Preference('PatronRestrictionTypes') %]
1465                                                     <li>
1466                                                         <label for="debarred_type">Type:</label>
1467                                                         <select name="debarred_type">
1468                                                             [% FOREACH code IN restriction_types.keys %]
1469                                                                 [% IF !restriction_types.$code.is_system %]
1470                                                                     [% IF restriction_types.$code.is_default %]
1471                                                                     <option value="[% code | html %]" selected>[% PROCESS restriction_type_description restriction=restriction_types.$code %]</option>
1472                                                                     [% ELSE %]
1473                                                                     <option value="[% code | html %]">[% PROCESS restriction_type_description restriction=restriction_types.$code %]</option>
1474                                                                     [% END %]
1475                                                                 [% END %]
1476                                                             [% END %]
1477                                                         </select>
1478                                                     </li>
1479                                                     [% END %]
1480                                                     <li>
1481                                                         <label for="debarred_comment">Comment: </label>
1482                                                         <input type="text" id="debarred_comment" name="debarred_comment" />
1483                                                     </li>
1484                                                     <li>
1485                                                         <label for="debarred_expiration">Expiration: </label>
1486                                                         <input name="debarred_expiration" id="debarred_expiration" size="10" value="" class="flatpickr" type="text" />
1487                                                         <a href="#" id="clear_debarred_expiration">Clear date</a>
1488                                                     </li>
1489                                                 </ol>
1490                                                 <p>
1491                                                     <a class="cancel" id="cancel_manual_restriction" href="#">Cancel</a>
1492                                                 </p>
1493                                             </fieldset> <!-- /#manual_restriction_form -->
1494                                         [% END # /IF CAN_user_borrowers_edit_borrowers %]
1495                                     </fieldset> <!-- /#memberentry_restrictions -->
1496                                 [% END # /UNLESS ( opadd || opduplicate ) %]
1497                             [% END # /IF ( step_3 ) %]
1498
1499                             [% IF ( step_7 ) %]
1500                                 [% IF Koha.Preference('HouseboundModule') %]
1501                                     <fieldset class="rows" id="memberentry_housebound_roles">
1502                                         <legend id="housebound_roles">Housebound roles</legend>
1503                                         <ol class="radio">
1504                                             <li>
1505                                                 <label class="radio" for="housebound_chooser">
1506                                                     Chooser:
1507                                                 </label>
1508                                                 [% IF ( housebound_role.housebound_chooser == 1 ) %]
1509                                                     <label for="yes_housebound_chooser">Yes </label>
1510                                                     <input type="radio" id="yes_housebound_chooser" name="housebound_chooser" value="1" checked="checked" />
1511                                                     <label for="no_housebound_chooser">No </label>
1512                                                     <input type="radio" id="no_housebound_chooser" name="housebound_chooser" value="0" />
1513                                                 [% ELSE %]
1514                                                     <label for="yes_housebound_chooser">Yes </label>
1515                                                     <input type="radio" id="yes_housebound_chooser" name="housebound_chooser" value="1" />
1516                                                     <label for="no_housebound_chooser">No </label>
1517                                                     <input type="radio" id="no_housebound_chooser" name="housebound_chooser" value="0" checked="checked" />
1518                                                 [% END %]
1519                                             </li>
1520                                             <li>
1521                                                 <label class="radio" for="housebound_deliverer">Deliverer:</label>
1522                                                 [% IF ( housebound_role.housebound_deliverer == 1 ) %]
1523                                                     <label for="yes_housebound_deliverer">Yes </label>
1524                                                     <input type="radio" id="yes_housebound_deliverer" name="housebound_deliverer" value="1" checked="checked" />
1525                                                     <label for="no_housebound_deliverer">No </label>
1526                                                     <input type="radio" id="no_housebound_deliverer" name="housebound_deliverer" value="0" />
1527                                                 [% ELSE %]
1528                                                     <label for="yes_housebound_deliverer">Yes </label>
1529                                                     <input type="radio" id="yes_housebound_deliverer" name="housebound_deliverer" value="1" />
1530                                                     <label for="no_housebound_deliverer">No </label>
1531                                                     <input type="radio" id="no_housebound_deliverer" name="housebound_deliverer" value="0" checked="checked" />
1532                                                 [% END %]
1533                                             </li>
1534                                         </ol> <!-- /ol.radio -->
1535                                     </fieldset> <!-- /#memberentry_housebound_roles -->
1536                                 [% END # hide fieldset %]
1537                             [% END # IF step_7 %]
1538
1539                             [% IF ( step_4 ) %]
1540                                 [% IF Koha.Preference('ExtendedPatronAttributes') %]
1541                                     [% UNLESS ( no_patron_attribute_types ) %]
1542                                         <fieldset class="rows" id="memberentry_patron_attributes">
1543                                             <legend id="patron_attributes_lgd">Additional attributes and identifiers</legend>
1544                                             <input type="hidden" name="setting_extended_patron_attributes" value="1" />
1545                                             [% FOREACH pa_loo IN patron_attributes %]
1546                                                 <ol class="attributes_table">
1547                                                     [% IF pa_loo.class %]
1548                                                         <fieldset id="aai_[% pa_loo.class | html %]">
1549                                                         <legend id="[% pa_loo.class | html %]_lgd">[% pa_loo.lib | html %]</legend>
1550                                                     [% END %]
1551                                                     [% FOREACH patron_attribute IN pa_loo.items %]
1552                                                         <li data-category_code="[% patron_attribute.category_code | html %]">
1553                                                             [% IF patron_attribute.mandatory %]
1554                                                                 <label for="[% patron_attribute.form_id | html %]" class="required" required="required">[% patron_attribute.description | html %]: </label>
1555                                                             [% ELSE %]
1556                                                                 <label for="[% patron_attribute.form_id | html %]">[% patron_attribute.description | html %]: </label>
1557                                                             [% END %]
1558                                                             [% IF ( patron_attribute.use_dropdown ) %]
1559                                                                 [% IF patron_attribute.mandatory %]
1560                                                                     <select id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]" required="required">
1561                                                                 [% ELSE %]
1562                                                                     <select id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">
1563                                                                 [% END %]
1564                                                                     <option value=""></option>
1565                                                                     [% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %]
1566                                                                         [% IF auth_val_loo.authorised_value == patron_attribute.value %]
1567                                                                             <option value="[% auth_val_loo.authorised_value | html %]" selected="selected">
1568                                                                                 [% auth_val_loo.lib | html %]
1569                                                                             </option>
1570                                                                         [% ELSE %]
1571                                                                             <option value="[% auth_val_loo.authorised_value | html %]" >
1572                                                                                 [% auth_val_loo.lib | html %]
1573                                                                             </option>
1574                                                                         [% END %]
1575                                                                     [% END %]
1576                                                                 </select>
1577                                                             [% ELSE %]
1578                                                                 [% IF patron_attribute.mandatory %]
1579                                                                 <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]" required="required">[% patron_attribute.value | html %]</textarea>
1580                                                                 [% ELSE %]
1581                                                                 <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">[% patron_attribute.value | html %]</textarea>
1582                                                                 [% END %]
1583                                                             [% END # /IF ( patron_attribute.use_dropdown ) %]
1584                                                             <input type="hidden" id="[% patron_attribute.form_id | html %]_code" name="[% patron_attribute.form_id | html %]_code" value="[% patron_attribute.code | html %]" />
1585                                                             <a href="#" class="clear_attribute"><i class="fa fa-fw fa-trash"></i> Clear</a>
1586                                                             [% IF ( patron_attribute.repeatable ) %]
1587                                                                 <a href="#" class="clone_attribute"><i class="fa fa-fw fa-plus"></i> New</a>
1588                                                             [% END %]
1589                                                             [% IF patron_attribute.mandatory %]<span class="required">Required</span>[% END %]
1590                                                         </li>
1591                                                     [% END # /FOREACH patron_attribute %]
1592                                                     [% IF pa_loo.class %]</fieldset>[% END %]
1593                                                 </ol>
1594                                             [% END # /FOREACH pa_loo %]
1595                                         </fieldset> <!-- /#memberentry_patron_attributes -->
1596                                     [% END # UNLESS ( no_patron_attribute_types ) %]
1597                                 [% END # IF Koha.Preference('ExtendedPatronAttributes') %]
1598                             [% END # IF ( step_4 ) %]
1599
1600                             [% IF ( step_5 ) %]
1601                                 [% IF ( EnhancedMessagingPreferences ) %]
1602                                     <fieldset class="rows" id="memberentry_messaging_prefs">
1603                                         <legend id="patron_messaging_prefs_lgd">Patron messaging preferences</legend>
1604                                         <div id="messaging_prefs_loading" class="form-message" style="display:none">
1605                                             <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading new messaging defaults
1606                                         </div>
1607                                         <input type="hidden" name="setting_messaging_prefs" value="1" />
1608                                         [% INCLUDE 'messaging-preference-form.inc' %]
1609                                         [% IF ( SMSSendDriver ) %]
1610                                             <p>
1611                                                 <label for="SMSnumber">SMS number:</label>
1612                                                 <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber | html %]" />
1613                                                 <span class="hint sms_number_help">Please enter numbers only. Prefix the number with + or 00 if including the country code.</span>
1614                                             </p>
1615                                             [% IF SMSSendDriver == 'Email' && !nosms_provider_id %]
1616                                                 <p>
1617                                                     <label for="sms_provider_id">SMS provider:</label>
1618                                                     <select id="sms_provider_id" name="sms_provider_id">
1619                                                         <option value="">Unknown</option>
1620                                                         [% FOREACH s IN sms_providers %]
1621                                                             [% IF s.id == borrower_data.sms_provider_id %]
1622                                                                 <option value="[% s.id | html %]" selected="selected">[% s.name | html %]</option>
1623                                                             [% ELSE %]
1624                                                                 <option value="[% s.id | html %]">[% s.name | html %]</option>
1625                                                             [% END %]
1626                                                         [% END %]
1627                                                     </select>
1628                                                 </p>
1629                                             [% END # /UNLESS nosms_provider_id %]
1630                                         [% END # IF ( SMSSendDriver ) %]
1631                                     </fieldset>
1632                                 [% END # IF ( EnhancedMessagingPreferences ) %]
1633                             [% END # /IF step_5 %]
1634                         </form> <!-- /#entryform -->
1635
1636                         [% IF quickadd && opadd  && !check_member %]
1637                             <form id="quick_add_form" class="toggler">
1638                                 <fieldset class="rows quick_add"><legend>Quick add</legend>
1639                                     <ol id="quick_add_list">
1640                                     </ol>
1641                                 </fieldset>
1642                             </form>
1643                         [% END %]
1644
1645                     [% END # /UNLESS ( no_add ) %]
1646                 </main>
1647             </div> <!-- /.col-sm-10.col-sm-push-2 -->
1648
1649             [% UNLESS ( opadd ) %]
1650                 <div class="col-sm-2 col-sm-pull-10">
1651                     <aside>
1652                         [% INCLUDE 'circ-menu.inc' %]
1653                     </aside>
1654                 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1655             [% END %]
1656         </div> <!-- /.row -->
1657
1658 [% MACRO jsinclude BLOCK %]
1659     [% Asset.js("lib/hc-sticky.js") | $raw %]
1660     [% INCLUDE 'calendar.inc' %]
1661     [% INCLUDE 'str/members-menu.inc' %]
1662     [% Asset.js("js/members-menu.js") | $raw %]
1663     <script>
1664         function update_cardnumber_warning(size){
1665             var max_len = [% maxlength_cardnumber | html %];
1666             if ( size >= max_len ) {
1667                 $("#cn_max").show();
1668             } else {
1669                 $("#cn_max").hide();
1670             }
1671         }
1672         var Sticky;
1673         function showHideFields(){
1674             [% UNLESS step == 1 %]
1675                 [% IF fieldstohide.match('identity') %]
1676                     $("#memberentry_identity").find('legend').nextAll().toggle();
1677                 [% END %]
1678                 [% IF show_guarantor || guarantor %]
1679                     [% IF fieldstohide.match('guarantor') %]
1680                         $("#memberentry_guarantor").find('legend').nextAll().toggle();
1681                         $("#guarantor_template").toggle();
1682                     [% END %]
1683                 [% END %]
1684                 [% IF fieldstohide.match('primary_address') %]
1685                     $("#memberentry_mainaddress").find('legend').nextAll().toggle();
1686                 [% END %]
1687                 [% IF fieldstohide.match('primary_contact') %]
1688                     $("#memberentry_contact").find('legend').nextAll().toggle();
1689                 [% END %]
1690             [% END %]
1691             [% UNLESS step == 6 %]
1692                 [% IF fieldstohide.match('alt_address') %]
1693                     $("#memberentry_address").find('legend').nextAll().toggle();
1694                 [% END %]
1695             [% END %]
1696             [% UNLESS step == 2 %]
1697                 [% IF fieldstohide.match('alt_contact') %]
1698                     $("#memberentry_altaddress").find('legend').nextAll().toggle();
1699                 [% END %]
1700             [% END %]
1701             [% UNLESS step == 3 %]
1702                 [% IF fieldstohide.match('lib_mgmt') %]
1703                         $("#memberentry_library_management").find('legend').nextAll().toggle();
1704                 [% END %]
1705                 [% UNLESS nodateenrolled && noopacnote && noborrowernotes %]
1706                     [% IF fieldstohide.match('lib_setup') %]
1707                         $("#memberentry_subscription").find('legend').nextAll().toggle();
1708                     [% END %]
1709                 [% END %]
1710                 [% UNLESS nouserid && nopassword %]
1711                     [% IF fieldstohide.match('login') %]
1712                         $("#memberentry_userid").find('legend').nextAll().toggle();
1713                     [% END %]
1714                 [% END %]
1715                 [% UNLESS ( opadd || opduplicate ) %]
1716                     [% IF fieldstohide.match('flags') %]
1717                         $("#memberentry_account_flags").find('legend').nextAll().toggle();
1718                     [% END %]
1719                 [% END %]
1720                 [% IF fieldstohide.match('debarments') %]
1721                     $("#memberentry_restrictions").find('legend').nextAll().toggle();
1722                 [% END %]
1723             [% END %]
1724             [% UNLESS step == 7 %]
1725                 [% IF Koha.Preference('HouseboundModule') %]
1726                     [% IF fieldstohide.match('housebound') %]
1727                         $("#memberentry_housebound_roles").find('legend').nextAll().toggle();
1728                     [% END %]
1729                 [% END %]
1730             [% END %]
1731             [% UNLESS step == 4 %]
1732                 [% IF Koha.Preference('ExtendedPatronAttributes') %]
1733                     [% IF fieldstohide.match('additional') %]
1734                         $("#memberentry_patron_attributes").find('legend').nextAll().toggle();
1735                     [% END %]
1736                 [% END %]
1737             [% END %]
1738             [% UNLESS step == 5 %]
1739                 [% IF Koha.Preference('EnhancedMessagingPreferences') %]
1740                     [% IF fieldstohide.match('messaging') %]
1741                         $("#memberentry_messaging_prefs").find('legend').nextAll().toggle();
1742                         $("#messaging_prefs_loading").toggle();
1743                     [% END %]
1744                 [% END %]
1745             [% END %]
1746         }
1747
1748         $(document).ready(function() {
1749             showHideFields();
1750             $("#toggle_hidden_fields").change(function(){
1751                 showHideFields();
1752             });
1753
1754             $("legend").click(function(){
1755                 $(this).nextAll().toggle();
1756                 $("#messaging_prefs_loading").hide();
1757                 $("#guarantor_template").hide();
1758             });
1759
1760             $("#saverecord").css({ 'margin-left': 0 });
1761
1762             Sticky = $("#toolbar");
1763             Sticky.hcSticky({
1764                 stickTo: "main",
1765                 stickyClass: "floating"
1766             });
1767
1768             [% IF borrower_data.categorycode %]
1769                 update_category_code( "[% borrower_data.categorycode | html %]" );
1770             [% ELSE %]
1771                 if ( $("#categorycode_entry").length > 0 ){
1772                     var category_code = $("#categorycode_entry").find("option:selected").val();
1773                     update_category_code( category_code );
1774                 }
1775             [% END %]
1776
1777             [% IF new_guarantors %]
1778                 [% FOREACH g IN new_guarantors %]
1779                     select_user( '[% g.patron.borrowernumber | html %]', [% To.json( g.patron.unblessed ) | $raw %], '[% g.relationship | html %]' );
1780                 [% END %]
1781             [% END %]
1782
1783             $("#cn_max").hide();
1784             var content;
1785             $("#cardnumber").on("keydown", function(e){
1786                 content = $(this).val();
1787             });
1788             $("#cardnumber").on("keyup", function(e){
1789                 // .val() will return the value of the input after the key has been released
1790                 var l = $(this).val().length;
1791                 if ( l == content.length + 1 ) { l--; }
1792                 update_cardnumber_warning(l);
1793             });
1794             $("#cardnumber").bind("paste", function(e){
1795                 var pastedData = e.originalEvent.clipboardData.getData('text');
1796                 update_cardnumber_warning(pastedData.length - 1);
1797             } );
1798             var toggle_quick_add = $(".toggle_quick_add");
1799             $(toggle_quick_add).click(function(e){
1800                 toggle_quick_add.toggle();
1801                 e.preventDefault();
1802                 var toggle_to = '';
1803                 var toggle_from = '';
1804                 if( $("#entryform:visible").length ) {
1805                     toggle_to = "#quick_add_form label";
1806                     toggle_from = "#entryform label";
1807                     $("#memberentry_guarantor").appendTo("#quick_add_form");
1808                 } else {
1809                     toggle_to="#entryform label";
1810                     toggle_from = "#quick_add_form label";
1811                     $("#memberentry_guarantor").appendTo("#memberentry_guarantor_anchor");
1812                 }
1813                 $(toggle_from).each(function() {
1814                     var input_label = $(this).attr('for');
1815                     if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' || input_label == 'sex-other' ) {
1816                         $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') );
1817                         return;
1818                     }
1819                     $(toggle_to+"[for='"+input_label+"']").next().val(  $(this).next().val() );
1820                 });
1821
1822                 $(".toggler").toggle();
1823             });
1824
1825             $("#save_quick_add").click(function(){
1826                 $("#quick_add_form").validate();
1827                 if( $("#quick_add_form").valid()){
1828                     $('.toggle_quick_add').click();
1829                     $("#memberentry_guarantor").appendTo("#memberentry_guarantor_anchor");
1830                     $('#saverecord').click();
1831                 }
1832                 else {return false;}
1833             });
1834
1835             $("#saverecord").click(function(){
1836                 if( check_form_borrowers() ){
1837                     $("#entryform").submit();
1838                 }
1839             });
1840
1841             $('#duplicate').on('click', function() {
1842                 $("input[name='op']").val('modify');
1843                 $("input[name='borrowernumber']").val('[% check_member | html %]');
1844                 $("input[name='check_member']").val('');
1845                 $('#entryform').submit();
1846             });
1847
1848             $('#not-duplicate').on('click', function() {
1849                 $("input[name='nodouble']").val('1');
1850                 $('#entryform').submit();
1851             });
1852
1853             $(".popup_patronview").on("click", function(e){
1854                 e.preventDefault();
1855                 var url = $(this).attr("href");
1856                 openWindow( url, "patronview" );
1857             });
1858
1859             $("#dateofbirth").on("change", function(){
1860                  write_age();
1861             });
1862
1863             $("#debarred_comment, #debarred_expiration").on("change", function(){
1864                 $("#add_debarment").val(1);
1865             });
1866
1867             $("#clear_debarred_expiration").on("click", function(e){
1868                 e.preventDefault();
1869                 $('#debarred_expiration').val("");
1870             });
1871
1872             $("#memberentry_patron_attributes").on("click", ".clear_attribute", function(e){
1873                 e.preventDefault();
1874                 clear_entry( this );
1875             });
1876
1877             $("#memberentry_patron_attributes").on("click", ".clone_attribute", function(e){
1878                 e.preventDefault();
1879                 clone_entry( this );
1880             });
1881
1882             $("#categorycode_entry").on("change", function(){
1883                 update_category_code(this);
1884             });
1885         });
1886
1887         [% IF quickadd && opadd  && !check_member %]
1888             $(document).ready(function () {
1889
1890                 $("#entryform,#saverecord").hide();
1891                 [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
1892                 var qaddfields = [[% FOREACH field IN q_add_f.unique %]"[% field | html %]",[% END %]];
1893                 $("#entryform label").each(function () {
1894                     var input_label = $(this).attr('for');
1895                     if ( input_label == 'sex-female' ) {
1896                         input_label='sex';
1897                     }
1898                     else if ( input_label == 'btitle' ) {
1899                         input_label='title';
1900                     }
1901                     if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){
1902                        let orig_li = $(this).parent();
1903                        if( orig_li.attr('class') == 'radio' ){
1904                            let new_field = orig_li.clone();
1905                            new_field.children('label').each(function(){
1906                                 let child_input = $(this).children('input');
1907                                 child_input.attr("id",child_input.attr("id") + "_quick_add");
1908                             });
1909                            new_field.appendTo("#quick_add_list");
1910                        } else {
1911                            let orig_input_id = orig_li.children("input,textarea,select").attr("id");
1912                            let new_field = orig_li.clone();
1913                            new_field.children("#"+orig_input_id).attr("id",orig_input_id + "_quick_add");
1914                            new_field.appendTo("#quick_add_list");
1915                            [% UNLESS mandatorypassword %]
1916                                  if( input_label == 'password' ){
1917                                      let orig_p2 = $("#entryform label[for='password2']").parent();
1918                                      let new_p2  = orig_p2.clone();
1919                                      new_p2.find('input[id="password2"]').attr("id","password2_quick_add");
1920                                      new_p2.appendTo("#quick_add_list");
1921                                  }
1922                            [% END %]
1923                        }
1924                     }
1925                 });
1926                 if ( $("#memberentry_guarantor").length ) {
1927                     $("#memberentry_guarantor").appendTo("#quick_add_form");
1928                 }
1929                 $("#quick_add_form").show();
1930             });
1931         [% END %]
1932         $("#guarantor_template").hide();
1933
1934     </script>
1935     [% Asset.js("js/members.js") | $raw %]
1936     [% Asset.js("js/messaging-preference-form.js") | $raw %]
1937     [% 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 %]
1938 [% END %]
1939
1940 [% INCLUDE 'intranet-bottom.inc' %]