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