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