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