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