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