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