Bug 20691: Add ability to turn feature on and off
[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     <fieldset class="rows">
324         <legend>Guarantor information</legend>
325
326         <span id="guarantor_relationships">
327             [% FOREACH r IN relationships %]
328                 <fieldset class="rows">
329                     <ol>
330                         [% IF category_type == 'I' %]
331                             <li class="guarantor-details" data-borrowernumber="[% r.guarantor_id | $raw %]">
332                                 <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 %]
333                             </li>
334
335                             <li>
336                                 <label for="guarantor_surname">Organization name: </label>
337                                 <span>[% r.guarantor.surname | html %]</span>
338                             </li>
339                         [% ELSE %]
340                             <li class="guarantor-details" data-borrowernumber="[% r.guarantor_id | $raw %]">
341                                 <span class="label">Patron #:</span>
342                                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% r.guarantor_id | uri %]" target="blank">[% r.guarantor_id | html %]</a>
343                             </li>
344
345                             [% IF r.guarantor.surname %]
346                                 <li>
347                                     <label for="guarantor_surname">Surname: </label>
348                                     <span>[% r.guarantor.surname | html %]</span>
349                                 </li>
350                             [% END %]
351
352                             [% IF r.guarantor.firstname %]
353                                 <li>
354                                     <label for="guarantor_firstname">First name: </label>
355                                     <span>[% r.guarantor.firstname | html %]</span>
356                                 </li>
357                             [% END %]
358
359                             <li>
360                                 <label for="relationship">Relationship: </label>
361                                 <span>[% r.relationship | html %]</span>
362                             </li>
363
364                             <li>
365                                 <label for="delete_guarantor-[% r.id | uri %]">Remove: </label>
366                                 <input type="checkbox" id="delete_guarantor-[% r.id | uri %]" name="delete_guarantor" value="[% r.id | html %]" />
367                             </li>
368                         [% END %]
369                     </ol>
370                 </fieldset>
371             [% END # END relationships foreach %]
372         </span>
373
374         <fieldset class="rows guarantor" id="guarantor_template">
375             <ol>
376                 <li class="guarantor-details" data-borrowernumber="0">
377                     <span class="label">Patron #:</span>
378                     <span class="new_guarantor_id_text"></span>
379                     <input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value=""/>
380                 </li>
381
382                 <li>
383                     <label for="guarantor_surname">Surname: </label>
384                     <span class="new_guarantor_surname_text"></span>
385                 </li>
386
387                 <li>
388                     <label for="guarantor_firstname">First name: </label>
389                     <span class="new_guarantor_firstname_text"></span>
390                 </li>
391
392                 <li>
393                     <label for="guarantor_relationship">Relationship: </label>
394                     <select class="new_guarantor_relationship" name="new_guarantor_relationship">
395                         [% FOREACH pr IN possible_relationships.split('\|') %]
396                             <option value="[% pr | html %]">[% pr | html %]</option>
397                         [% END %]
398                     </select>
399                 </li>
400
401                 <li>
402                     <label for="guarantor_cancel">&nbsp;</label>
403                     <span><a href="#" class="guarantor_cancel">Remove</a></span>
404                 </li>
405             </ol>
406         </fieldset>
407
408             <ol>
409                 <input type="hidden" id="guarantor_id" value="" />
410                 <input name="guarantor_surname" id="guarantor_surname" type="hidden" />
411                 <input name="guarantor_firstname" id="guarantor_firstname" type="hidden" />
412
413                 <li>
414                     <a href="#" id="guarantor_search" class="btn btn-default"><i class="fa fa-plus"></i> Search to add</a>
415                 </li>
416
417                 [% IF relationships && Koha.Preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') %]
418                     <li>
419                         <label for="privacy_guarantor_checkouts">Show checkouts to guarantors</label>
420                         <select name="privacy_guarantor_checkouts" id="privacy_guarantor_checkouts">
421                             [% IF privacy_guarantor_checkouts %]
422                                 <option value="0">No</option>
423                                 <option value="1" selected>Yes</option>
424                             [% ELSE %]
425                                 <option value="0" selected>No</option>
426                                 <option value="1">Yes</option>
427                             [% END %]
428                         </select>
429                         <div class="hint">Allow guarantors of this patron to view this patron's checkouts from the OPAC</div>
430                     </li>
431                 [% END %]
432                 [% IF relationships && Koha.Preference('AllowStaffToSetFinesVisibilityForGuarantor') %]
433                     <li>
434                         <label for="privacy_guarantor_fines">Show fines to guarantors</label>
435                         <select name="privacy_guarantor_fines" id="privacy_guarantor_fines">
436                             [% IF privacy_guarantor_fines %]
437                                 <option value="0">No</option>
438                                 <option value="1" selected>Yes</option>
439                             [% ELSE %]
440                                 <option value="0" selected>No</option>
441                                 <option value="1">Yes</option>
442                             [% END %]
443                         </select>
444                         <div class="hint">Allow guarantors of this patron to view this patron's fines from the OPAC</div>
445                     </li>
446                 [% END %]
447             </ol>
448     </fieldset>
449 [% END %]
450
451
452 [% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %]
453     [% IF Koha.Preference( 'AddressFormat' ) %]
454         [% INCLUDE "member-main-address-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %]
455     [% END %]
456 [% END # nostreet && nocity etc group%]
457
458 [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
459     <fieldset class="rows" id="memberentry_contact">
460         <legend id="contact_lgd">Contact</legend><ol>
461
462         [% UNLESS nocontactname %]
463             <li>
464                 [% IF ( mandatorycontactname ) %]
465                     <label for="contactname" class="required">
466                 [% ELSE %]
467                     <label for="contactname">
468                 [% END %]
469                 Guarantor surname: </label>
470                 <input type="text" id="contactname" name="contactname" value="[% contactname | html %]" />
471                 [% IF ( mandatorycontactname ) %]<span class="required">Required</span>[% END %]<div class="hint">Non-patron guarantor surname</div>
472             </li>
473         [% END %]
474
475         [% UNLESS nocontactfirstname %]
476             <li>
477                 [% IF ( mandatorycontactfirstname ) %]
478                     <label for="contactfirstname" class="required">
479                 [% ELSE %]
480                     <label for="contactfirstname">
481                 [% END %]
482                 Guarantor first name: </label>
483                 <input type="text" id="contactfirstname" name="contactfirstname" value="[% contactfirstname | html %]" />
484                 [% IF ( mandatorycontactfirstname ) %]<span class="required">Required</span>[% END %]<div class="hint">Non-patron guarantor first name</div>
485             </li>
486         [% END %]
487
488         [% UNLESS norelationship %]
489             [% IF possible_relationships %]
490                 <li>
491                     <label for="relationship">Relationship: </label>
492                     <select class="relationship" name="relationship">
493                         <option value=""></option>
494                         [% FOREACH pr IN possible_relationships.split('\|') %]
495                             [% IF pr == relationship %]
496                                 <option value="[% pr | html %]" selected="selected">[% pr | html %]</option>
497                             [% ELSE %]
498                                 <option value="[% pr | html %]">[% pr | html %]</option>
499                             [% END %]
500                         [% END %]
501                     </select>
502                 </li>
503             [% END %]
504         [% END %]
505
506         [% UNLESS nophone %]
507             <li>
508                 [% IF ( mandatoryphone ) %]
509                     <label for="phone" class="required">
510                 [% ELSE %]
511                     <label for="phone">
512                 [% END %]
513                 Primary phone: </label>
514                 <input type="text" id="phone" name="phone" value="[% phone | html %]" />
515                 [% IF ( mandatoryphone ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div>
516             </li>
517         [% END %]
518
519         [% UNLESS nophonepro %]
520             <li>
521                 [% IF ( mandatoryphonepro ) %]
522                     <label for="phonepro" class="required">
523                 [% ELSE %]
524                     <label for="phonepro">
525                 [% END %]
526                 Secondary phone: </label>
527                 <input type="text" id="phonepro" name="phonepro" value="[% phonepro | html %]" />
528                 [% IF ( mandatoryphonepro ) %]<span class="required">Required</span>[% END %]
529             </li>
530         [% END %]
531
532         [% UNLESS nomobile %]
533             <li>
534                 [% IF ( mandatorymobile ) %]
535                     <label for="mobile" class="required">
536                 [% ELSE %]
537                     <label for="mobile">
538                 [% END %]
539                 Other phone: </label>
540                 <input type="text" id="mobile" name="mobile" value="[% mobile | html %]" />
541                 [% IF ( mandatorymobile ) %]<span class="required">Required</span>[% END %]
542             </li>
543         [% END %]
544
545         [% UNLESS noemail %]
546             <li>
547                 [% IF ( mandatoryemail ) %]
548                     <label for="email" class="required">
549                 [% ELSE %]
550                     <label for="email">
551                 [% END %]
552                 Primary email: </label>
553                 <input type="text" id="email" name="email" size="45" value="[% email | html %]" />
554                 [% IF ( mandatoryemail ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div>
555             </li>
556         [% END %]
557
558         [% UNLESS noemailpro %]
559             <li>
560                 [% IF ( mandatoryemailpro ) %]
561                     <label for="emailpro" class="required">
562                 [% ELSE %]
563                     <label for="emailpro">
564                 [% END %]
565                 Secondary email: </label>
566                 <input type="text" id="emailpro" name="emailpro" size="45" value="[% emailpro | html %]" />
567                 [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %]
568             </li>
569         [% END %]
570
571         [% UNLESS nofax %]
572             <li>
573                 [% IF ( mandatoryfax ) %]
574                     <label for="fax" class="required">
575                 [% ELSE %]
576                     <label for="fax">
577                 [% END %]
578                 Fax: </label>
579                 <input type="text" id="fax" name="fax" value="[% fax | html %]" />
580                 [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
581             </li>
582         [% END %]
583     </ol>
584 </fieldset>
585 [%END # hide fieldset %]
586
587 <!-- ************************ STEP_1 *********************** -->
588 [% END %]
589 [% IF ( step_6 ) %]
590
591     [% UNLESS noB_address && noB_address2 && noB_city && noB_zipcode && noB_state && noB_country &&nocontactnote && noB_phone && noB_email %]
592     [% SWITCH Koha.Preference( 'AddressFormat' ) %]
593         [% CASE 'de' %]
594             [% INCLUDE 'member-alt-address-style-de.inc' %]
595         [% CASE # us %]
596             [% INCLUDE 'member-alt-address-style-us.inc' %]
597      [% END %]
598
599     [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %]
600 [% END %]
601 [% IF ( step_2 ) %]
602     [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactaddress2 && noaltcontactaddress3 && noaltcontactstate && noaltcontactzipcode && noaltcontactcountry && noaltcontactphone %]
603     [% SWITCH Koha.Preference( 'AddressFormat' ) %]
604         [% CASE 'de' %]
605             [% INCLUDE 'member-alt-contact-style-de.inc' %]
606         [% CASE # us %]
607             [% INCLUDE 'member-alt-contact-style-us.inc' %]
608      [% END %]
609     [% END # UNLESS noaltcontactsurname && noaltcontactfirstname etc %]
610
611 [% END %]
612 [% IF ( step_3 ) %]
613
614   [% SET autoMemberNum = Koha.Preference('autoMemberNum') %]
615   <fieldset class="rows" id="memberentry_library_management">
616     <legend id="library_management_lgd">Library management</legend><ol>
617       [% UNLESS nocardnumber %]
618         <li>
619           [% IF mandatorycardnumber %]
620             <label for="cardnumber" class="required">
621           [% ELSE %]
622             <label for="cardnumber" class="validated">
623           [% END %]
624             Card number: </label>
625
626           <!-- NOTE: div.hint closing tag isn't on the same line -->
627           [% IF minlength_cardnumber == maxlength_cardnumber %]
628                 <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" minlength="[% minlength_cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
629                 [% 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>
630                 <div class="hint">Card number must be exactly [% minlength_cardnumber | html %] characters.
631           [% ELSIF minlength_cardnumber && maxlength_cardnumber %]
632                 <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" minlength="[% minlength_cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
633                 [% 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>
634                 <div class="hint">Card number must be between [% minlength_cardnumber | html %] and [% maxlength_cardnumber | html %] characters.
635           [% ELSIF maxlength_cardnumber %]
636                 <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
637                 [% 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>
638                 <div class="hint">Card number can be up to [% maxlength_cardnumber | html %] characters.
639           [% ELSE %]
640                 <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" />
641                 [% IF mandatorycardnumber %]<span class="required">Required</span>[% END %]
642                 <div class="hint">There is no minimum or maximum character length.
643           [% END %]
644           [% IF autoMemberNum %]
645                 [% IF mandatorycardnumber %]
646                     <br/><span class="error">AutoMemberNum is set to enabled, but cardnumber is marked as mandatory in BorrowerMandatoryField: auto calc has been disabled.</span>
647                 [% ELSE %]
648                     <br/>Leave blank for auto calc during registration
649                 [% END %]
650           [% END %]
651                 </div><!--/hint div -->
652         </li>
653       [% END %]
654       [% UNLESS nobranchcode %]
655     <li>
656         <label for="libraries" class="required">Library:</label>
657         <select name="branchcode" size="1" id="libraries">
658             [% PROCESS options_for_libraries libraries => Branches.all( selected => userbranch, only_from_group => 1 ) %]
659         </select>
660         <span class="required">Required</span>
661     </li>
662         [% END %]
663     <li>
664         <label for="categorycode_entry" class="required">Category: </label>
665         <select id="categorycode_entry" name="categorycode" onchange="update_category_code(this);">
666         [% FOREACH typeloo IN typeloop %]
667             [% FOREACH categoryloo IN typeloo.categoryloop %]
668                 [% IF ( loop.first ) %]
669                     [% IF ( typeloo.typename_C ) %]<optgroup label="Child">[% END %]
670                     [% IF ( typeloo.typename_A ) %]<optgroup label="Adult">[% END %]
671                     [% IF ( typeloo.typename_S ) %]<optgroup label="Staff">[% END %]
672                     [% IF ( typeloo.typename_I ) %]<optgroup label="Organization">[% END %]
673                     [% IF ( typeloo.typename_P ) %]<optgroup label="Professional">[% END %]
674                     [% IF ( typeloo.typename_X ) %]<optgroup label="Statistical">[% END %]
675                 [% END %]
676                 [% IF ( categoryloo.categorycodeselected ) %]
677                     <option value="[% categoryloo.categorycode | html %]" selected="selected" data-typename="[% typeloo.typename | html %]">[% categoryloo.categoryname | html %]</option>
678                 [% ELSE %]
679                     <option value="[% categoryloo.categorycode | html %]" data-typename="[% typeloo.typename | html %]">[% categoryloo.categoryname | html %]</option>
680                 [% END %]
681                 [% IF ( loop.last ) %]
682                     </optgroup>
683                 [% END %]
684             [% END %]
685        [% END %]
686        </select>
687        <span class="required">Required</span>
688     </li>
689         [% UNLESS nosort1 %]
690     <li>
691       [% IF ( mandatorysort1 ) %]
692         <label for="sort1" class="required">
693       [% ELSE %]
694         <label for="sort1">
695       [% END %]
696       Sort 1: </label>
697       [% PROCESS 'av-build-dropbox.inc' name="sort1", category="Bsort1", default=sort1, size = 20 %]
698       [% IF ( mandatorysort1 ) %]<span class="required">Required</span>[% END %]
699     </li>
700         [% END %]
701         [% UNLESS nosort2 %]
702     <li>
703     [% IF ( mandatorysort2 ) %]
704     <label for="sort2" class="required">
705     [% ELSE %]
706     <label for="sort2">
707     [% END %]
708     Sort 2: </label>
709     [% PROCESS 'av-build-dropbox.inc' name="sort2", category="Bsort2", default=sort2, size = 20 %]
710     [% IF ( mandatorysort2 ) %]<span class="required">Required</span>[% END %]
711     </li>
712         [% END %]
713     [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
714       <li><label for="checkprevcheckout">Check for previous checkouts: </label>
715         <select name="checkprevcheckout" id="checkprevcheckout">
716         [% IF ( checkprevcheckout == 'yes' ) %]
717           <option value="yes" selected="selected">Yes if settings allow it</option>
718           <option value="no">No if settings allow it</option>
719           <option value="inherit">Inherit from settings</option>
720         [% ELSIF ( checkprevcheckout == 'no' ) %]
721           <option value="yes">Yes if settings allow it</option>
722           <option value="no" selected="selected">No if settings allow it</option>
723           <option value="inherit">Inherit from settings</option>
724         [% ELSE %]
725           <option value="yes">Yes if settings allow it</option>
726           <option value="no">No if settings allow it</option>
727           <option value="inherit" selected="selected">Inherit from settings</option>
728         [% END %]
729         </select>
730        </li>
731      [% END %]
732     [% IF Koha.Preference('TranslateNotices') %]
733         <li>
734             <label for="lang">Preferred language for notices: </label>
735             <select id="lang" name="lang">
736                 <option value="default">Default</option>
737                 [% FOR language IN languages %]
738                     [% FOR sublanguage IN language.sublanguages_loop %]
739                         [% IF language.plural %]
740                             [% IF sublanguage.rfc4646_subtag == lang %]
741                                 <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
742                             [% ELSE %]
743                                 <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
744                             [% END %]
745                         [% ELSE %]
746                             [% IF sublanguage.rfc4646_subtag == lang %]
747                                 <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
748                             [% ELSE %]
749                                 <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
750                             [% END %]
751                         [% END %]
752                     [% END %]
753                 [% END %]
754             </select>
755         </li>
756     [% END %]
757    </ol>
758   </fieldset>
759     [% UNLESS nodateenrolled &&  noopacnote && noborrowernotes %]
760         <fieldset class="rows" id="memberentry_subscription">
761         <legend id="library_setup_lgd">Library set-up</legend><ol>
762         [% UNLESS nodateenrolled %]
763                 <li>
764                         [% IF ( mandatorydateenrolled ) %]
765             <label for="from" class="required">
766                         [% ELSE %]
767             <label for="from">
768                         [% END %]
769                         Registration date: </label>
770             [% IF ( dateformat == "metric" ) %]
771                 <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" />
772             [% ELSE %]
773                 <input type="text" id="from" name="dateenrolled"  maxlength="10" size="10" value="[% dateenrolled | html %]" class="datepickerfrom" />
774             [% END %]
775                 [% IF ( mandatorydateenrolled ) %]<span class="required">Required</span>[% END %]
776                 [% IF ( ERROR_dateenrolled ) %]<span class="required">(Error)</span>[% END %]
777                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
778                 </li>
779         [% END %]
780         [% UNLESS nodateexpiry %]
781                 <li>
782         [% ELSE %]
783                 <li style="display:none">
784         [% END %]
785                         [% IF ( mandatorydateexpiry ) %]
786             <label for="to" class="required">
787                         [% ELSE %]
788             <label for="to">
789                         [% END %]
790                         Expiry date (leave blank for auto calc): </label>
791             [% IF ( dateformat == "metric" ) %]
792                                 [% UNLESS ( opadd ) %]
793                     <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" />
794                                 [% ELSE %]
795                     <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" onchange="CheckDate(document.form.dateexpiry);check_manip_date('verify');" class="datepickerto" />
796                                 [% END %]
797                         [% ELSE %]
798                                 [% UNLESS ( opadd ) %]
799                 <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% dateexpiry | html UNLESS opduplicate %]" class="datepickerto" />
800                                 [% ELSE %]
801                 <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% dateexpiry | html %]" class="datepickerto" />
802                                 [% END %]
803                         [% END %]
804                 [% IF ( mandatorydateexpiry ) %]<span class="required">Required</span>[% END %]
805                 [% IF ( ERROR_dateexpiry ) %]<span class="required">(Error)</span>[% END %]
806                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
807                 </li>
808         [% UNLESS noopacnote %]
809                 <li>
810                         [% IF ( mandatoryopacnote ) %]
811                                 <label for="opacnote" class="required">
812                         [% ELSE %]
813                                 <label for="opacnote">
814             [% END %]
815                         OPAC note: </label>
816             <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% opacnote | html UNLESS opduplicate %]</textarea>
817                         <div class="hint">This message appears on this patron's user page in the OPAC</div>
818           [% IF ( mandatoryopacnote ) %]<span class="required">Required</span>[% END %]
819                 </li>
820         [% END %]
821         [% UNLESS noborrowernotes %]
822                 <li>
823             [% IF ( mandatoryborrowernotes ) %]
824                                 <label for="borrowernotes" class="required">
825                         [% ELSE %]
826                                 <label for="borrowernotes">
827                         [% END %]
828                         Circulation note: </label>
829             <textarea id="borrowernotes" name="borrowernotes" cols="55" rows="5">[% borrowernotes | html UNLESS opduplicate %]</textarea>
830                         <div class="hint">This message displays when checking out to this patron</div>
831           [% IF ( mandatoryborrowernotes ) %]<span class="required">Required</span>[% END %]
832                 </li>
833         [% END %]
834                 </ol>
835         </fieldset>
836     [% END # hide fieldset %]
837
838     [% UNLESS nouserid && nopassword %]
839         <fieldset class="rows" id="memberentry_userid">
840         <legend id="opac_staff_login_lgd">OPAC/Staff login</legend><ol>
841         [% UNLESS nouserid %]
842                 <li>
843                         [% IF ( mandatoryuserid ) %]
844                         <label for="userid" class="required">
845                         [% ELSE %]
846                         <label for="userid">
847                         [% END %]
848                         Username: </label>
849
850 [% IF ( NoUpdateLogin ) %]
851         [% IF ( opduplicate ) %]
852                 <input type="text" id="userid" name="userid" size="20" disabled="disabled" />
853         [% ELSE %]
854                 <input type="text" id="userid" name="userid" size="20" disabled="disabled" value="[% userid | html %]" />
855         [% END %]
856 [% ELSE %]
857         [% IF ( opduplicate ) %]
858                 <input type="text" id="userid" name="userid" size="20" value="" />
859         [% ELSE %]
860                 <input type="text" id="userid" name="userid" size="20" value="[% userid | html %]" />
861         [% END %]
862 [% END %]
863
864 [%# Dummy input to avoid Firefox from using userid/password saved for authentication %]
865 <input type="text" disabled="disabled" style="display:none" />
866
867           [% IF ( mandatoryuserid ) %]<span class="required">Required</span>[% END %]
868                 </li>
869         [%END %]
870         [% UNLESS nopassword %]
871                 <li>
872                         [% IF ( mandatorypassword ) %]
873                         <label for="password" class="required">
874                         [% ELSE %]
875                         <label for="password">
876                         [% END %]
877                         Password: </label>
878                         [% IF ( opadd ) %]
879                         [% IF ( NoUpdateLogin ) %]
880                                 [% IF ( opduplicate ) %]
881                                         <input type="password" id="password" name="password" size="20"  disabled="disabled" />
882                                 [% ELSE %]
883                                         <input type="password" id="password" name="password" size="20"  disabled="disabled" value="[% password | html %]" />
884                                 [% END %]
885 [% ELSE %]
886                                 [% IF ( opduplicate ) %]
887                                         <input type="password" id="password" name="password" size="20" />
888                                 [% ELSE %]
889                                         <input type="password" id="password" name="password" size="20" value="[% password | html %]" />
890                                 [% END %]
891 [% END %]
892                         [% ELSE %]
893                         [% IF ( password ) %]
894                                 [% IF ( NoUpdateLogin ) %]
895                                         <input type="password" id="password" name="password" size="20"  disabled="disabled" value="****" />
896                                 [% ELSE %]
897                                         [% IF ( opduplicate ) %]
898                                                 <input type="password" id="password" name="password" size="20" />
899                                         [% ELSE %]
900                                                 <input type="password" id="password" name="password" size="20" value="****" />
901                                         [% END %]
902                                 [% END %]
903                         [% ELSE %]
904                                 [% IF ( NoUpdateLogin ) %]
905                                         <input type="password" id="password" name="password" size="20"  disabled="disabled" value="" />
906                                 [% ELSE %]
907                                         <input type="password" id="password" name="password" size="20" value="" />
908                                 [% END %]
909                         [% END %]
910                         [% END %]
911             [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %]
912             [% IF ( ERROR_password_too_short ) %]<span class="required">Password is too short</span>[% END %]
913             [% IF ( ERROR_password_too_weak ) %]<span class="required">Password is too weak</span>[% END %]
914             [% IF ( ERROR_password_has_whitespaces ) %]<span class="required">Password has leading or trailing whitespaces</span>[% END %]
915             <div class="hint">Minimum password length: [% minPasswordLength | html %]</div>
916                 </li>
917                 <li>
918                         [% IF ( mandatorypassword ) %]
919                         <label for="password2" class="required">
920                         [% ELSE %]
921                         <label for="password2">
922                         [% END %]
923                         Confirm password: </label>
924                         [% IF ( opadd ) %]
925                         [% IF ( NoUpdateLogin ) %]
926                                 [% IF ( opduplicate ) %]
927                                         <input type="password" id="password2" name="password2" size="20"  disabled="disabled" />
928                                 [% ELSE %]
929                                         <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="[% password | html %]" />
930                                 [% END %]
931 [% ELSE %]
932                                 [% IF ( opduplicate ) %]
933                                         <input type="password" id="password2" name="password2" size="20" />
934                                 [% ELSE %]
935                                         <input type="password" id="password2" name="password2" size="20" value="[% password | html %]" />
936                                 [% END %]
937 [% END %]
938                         [% ELSE %]
939                         [% IF ( password ) %]
940                                 [% IF ( NoUpdateLogin ) %]
941                                         <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="****" />
942                                 [% ELSE %]
943                                         [% IF ( opduplicate ) %]
944                                                 <input type="password" id="password2" name="password2" size="20" />
945                                         [% ELSE %]
946                                                 <input type="password" id="password2" name="password2" size="20" value="****" />
947                                         [% END %]
948                                 [% END %]
949                         [% ELSE %]
950                                 [% IF ( NoUpdateLogin ) %]
951                                         <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="" />
952                                 [% ELSE %]
953                                         <input type="password" id="password2" name="password2" size="20" value="" />
954                                 [% END %]
955                         [% END %]
956                         [% END %]
957           [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %]
958                 </li>
959                 </ol>
960                 </fieldset>
961         [% END # hide fieldset %][% END %]
962                 <!--this zones are not necessary in modif mode -->
963         [% UNLESS ( opadd || opduplicate ) %]
964         <fieldset class="rows" id="memberentry_account_flags">
965             <legend id="account_flags_lgd">Patron account flags</legend>
966                         <ol class="radio">
967                         [% FOREACH flagloo IN flagloop %]
968                                 <li><label class="radio" for="yes[% flagloo.name | html %]">
969                 [% IF ( flagloo.key == 'gonenoaddress' ) %]Gone no address:[% END %]
970                 [% IF ( flagloo.key == 'lost' ) %]Lost card:[% END %]
971                 </label>
972                 [% IF CAN_user_circulate_manage_restrictions %]
973                             <label for="yes[% flagloo.name | html %]">
974                                 [% IF ( flagloo.yes ) %]
975                                 <input type="radio" id="yes[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="1" checked="checked" />
976                                 [% ELSE %]
977                                 <input type="radio" id="yes[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="1" />
978                                 [% END %]
979                             Yes </label>
980                             <label for="no[% flagloo.name | html %]">
981                                 [% IF ( flagloo.no ) %]
982                                 <input type="radio" id="no[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="0" checked="checked"/>
983                                 [% ELSE %]
984                                 <input type="radio" id="no[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="0" />
985                                 [% END %]
986                             No </label>
987                 [% ELSE %]
988                   [% IF flagloo.yes %]Yes[% ELSE %]No[% END %]
989                 [% END %]
990
991             </li>
992                         [% END %]
993
994                         </ol>
995                         </fieldset>
996
997               <fieldset class="rows" id="memberentry_restrictions">
998                 <legend id="restrictions_lgd">Patron restrictions</legend>
999
1000                 [% IF ( debarments ) %]
1001                     <table>
1002                         <thead>
1003                             <tr>
1004                                  <th>Type</th>
1005                                  <th>Comment</th>
1006                                  <th>Expiration</th>
1007                                  <th>Created</th>
1008                                  [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1009                                    <th>Remove?</th>
1010                                  [% END %]
1011                             </tr>
1012                         </thead>
1013
1014                         <tbody>
1015                             [% FOREACH d IN debarments %]
1016                                 <tr>
1017                                     <td>[% d.type | html %]</td>
1018                                     <td>
1019                                     [% IF d.comment.search('OVERDUES_PROCESS') %]
1020                                         Restriction added by overdues process [% d.comment.remove('OVERDUES_PROCESS ') | $raw %]
1021                                     [% ELSE %]
1022                                         [% d.comment | $raw %]
1023                                     [% END %]
1024                                     </td>
1025                                     <td>[% IF d.expiration %] [% d.expiration | $KohaDates %] [% ELSE %] <i>Indefinite</i> [% END %]</td>
1026                                     <td>[% d.created | $KohaDates %]</td>
1027                                     [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1028                                       <td>
1029                                         <input type="checkbox" id="debarment_[% d.borrower_debarment_id | html %]" name="remove_debarment" value="[% d.borrower_debarment_id | html %]" />
1030                                       </td>
1031                                     [% END %]
1032                                 </tr>
1033                             [% END %]
1034                         </tbody>
1035                     </table>
1036                 [% ELSE %]
1037                     <p>Patron is currently unrestricted.</p>
1038                 [% END %]
1039
1040                 [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1041                     <p><a href="#" id="add_manual_restriction">Add manual restriction</a></p>
1042                     <fieldset id="manual_restriction_form">
1043                         <input type="hidden" id="add_debarment" name="add_debarment" value="0" />
1044                         <legend id="manual_restriction_lgd">Add manual restriction</legend>
1045                         <ol>
1046                             <li><label for="debarred_comment">Comment: </label><input type="text" id="debarred_comment" name="debarred_comment" onchange="$('#add_debarment').val(1);" /></li>
1047                             <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" />
1048                                     <a href='javascript:void(0)' onclick="$('#debarred_expiration').val('');">Clear date</a></li>
1049
1050                         </ol>
1051                         <p>
1052                             <a class="cancel" id="cancel_manual_restriction" href="#">Cancel</a>
1053                         </p>
1054                     </fieldset>
1055                 [% END %]
1056             </fieldset>
1057                 [% END %]
1058
1059 [% END %]
1060
1061 [% IF ( step_7 ) %]
1062 [% IF Koha.Preference('HouseboundModule') %]
1063   <fieldset class="rows" id="memberentry_housebound_roles">
1064     <legend id="housebound_roles">Housebound roles</legend>
1065     <ol class="radio">
1066       <li>
1067         <label class="radio" for="housebound_chooser">
1068           Chooser:
1069         </label>
1070         [% IF ( housebound_role.housebound_chooser == 1 ) %]
1071         <label for="yes_housebound_chooser">Yes </label>
1072         <input type="radio" id="yes_housebound_chooser"
1073                name="housebound_chooser" value="1"
1074                checked="checked" />
1075         <label for="no_housebound_chooser">No </label>
1076         <input type="radio" id="no_housebound_chooser"
1077                name="housebound_chooser" value="0" />
1078         [% ELSE %]
1079         <label for="yes_housebound_chooser">Yes </label>
1080         <input type="radio" id="yes_housebound_chooser"
1081                name="housebound_chooser" value="1" />
1082         <label for="no_housebound_chooser">No </label>
1083         <input type="radio" id="no_housebound_chooser"
1084                name="housebound_chooser" value="0"
1085                checked="checked" />
1086         [% END %]
1087       </li>
1088       <li>
1089         <label class="radio" for="housebound_deliverer">Deliverer:</label>
1090         [% IF ( housebound_role.housebound_deliverer == 1 ) %]
1091         <label for="yes_housebound_deliverer">Yes </label>
1092         <input type="radio" id="yes_housebound_deliverer"
1093                name="housebound_deliverer" value="1"
1094                checked="checked" />
1095         <label for="no_housebound_deliverer">No </label>
1096         <input type="radio" id="no_housebound_deliverer"
1097                name="housebound_deliverer" value="0" />
1098         [% ELSE %]
1099         <label for="yes_housebound_deliverer">Yes </label>
1100         <input type="radio" id="yes_housebound_deliverer"
1101                name="housebound_deliverer" value="1" />
1102         <label for="no_housebound_deliverer">No </label>
1103         <input type="radio" id="no_housebound_deliverer"
1104                name="housebound_deliverer" value="0"
1105                checked="checked" />
1106         [% END %]
1107       </li>
1108     </ol>
1109   </fieldset>
1110 [% END # hide fieldset %]
1111 [% END # IF step_7 %]
1112
1113 [% IF ( step_4 ) %]
1114 [% IF Koha.Preference('ExtendedPatronAttributes') %][% UNLESS ( no_patron_attribute_types ) %]
1115   <fieldset class="rows" id="memberentry_patron_attributes">
1116     <legend id="patron_attributes_lgd">Additional attributes and identifiers</legend>
1117     <input type="hidden" name="setting_extended_patron_attributes" value="1" />
1118     [% FOREACH pa_loo IN patron_attributes %]
1119         <ol class="attributes_table">
1120             [% IF pa_loo.class %]
1121                 <fieldset id="aai_[% pa_loo.class | html %]">
1122                 <legend id="[% pa_loo.class | html %]_lgd">[% pa_loo.lib | html %]</legend>
1123             [% END %]
1124             [% FOREACH patron_attribute IN pa_loo.items %]
1125                 <li data-category_code="[% patron_attribute.category_code | html %]">
1126                     <label for="[% patron_attribute.form_id | html %]">[% patron_attribute.description | html %]: </label>
1127                         [% IF ( patron_attribute.use_dropdown ) %]
1128                             <select id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">
1129                                 <option value=""></option>
1130                                 [% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %]
1131                                     [% IF auth_val_loo.authorised_value == patron_attribute.value %]
1132                                         <option value="[% auth_val_loo.authorised_value | html %]" selected="selected">
1133                                             [% auth_val_loo.lib | html %]
1134                                         </option>
1135                                     [% ELSE %]
1136                                         <option value="[% auth_val_loo.authorised_value | html %]" >
1137                                             [% auth_val_loo.lib | html %]
1138                                         </option>
1139                                     [% END %]
1140                                 [% END %]
1141                             </select>
1142                         [% ELSE %]
1143                             <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">[% patron_attribute.value | html %]</textarea>
1144                         [% END %]
1145                         <input type="hidden" id="[% patron_attribute.form_id | html %]_code" name="[% patron_attribute.form_id | html %]_code" value="[% patron_attribute.code | html %]" />
1146                         <a href="#" onclick="clear_entry(this); return false;"><i class="fa fa-fw fa-trash"></i> Clear</a>
1147                         [% IF ( patron_attribute.repeatable ) %]
1148                         <a href="#" onclick="clone_entry(this); return false;"><i class="fa fa-fw fa-plus"></i> New</a>
1149                         [% END %]
1150                 </li>
1151             [% END %]
1152             [% IF pa_loo.class %]</fieldset>[% END %]
1153         </ol>
1154     [% END %]
1155   </fieldset>
1156 [% END %][% END %][% END %]
1157
1158 [% IF ( step_5 ) %][% IF ( EnhancedMessagingPreferences ) %]
1159   <fieldset class="rows" id="memberentry_messaging_prefs">
1160     <legend id="patron_messaging_prefs_lgd">Patron messaging preferences</legend>
1161     <div id="messaging_prefs_loading" class="form-message" style="display:none">
1162         <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading new messaging defaults
1163     </div>
1164     <input type="hidden" name="setting_messaging_prefs" value="1" />
1165     [% INCLUDE 'messaging-preference-form.inc' %]
1166     [% IF ( SMSSendDriver ) %]
1167         <p><label for="SMSnumber">SMS number:</label>
1168             <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber | html %]" />
1169             <span class="hint">SMS number should be in the format 1234567890 or +11234567890</span>
1170         </p>
1171         [% UNLESS nosms_provider_id %]
1172         <p>
1173             <label for="sms_provider_id">SMS provider:</label>
1174             <select id="sms_provider_id" name="sms_provider_id">
1175                 <option value="">Unknown</option>
1176                 [% FOREACH s IN sms_providers %]
1177                     [% IF s.id == sms_provider_id %]
1178                         <option value="[% s.id | html %]" selected="selected">[% s.name | html %]</option>
1179                     [% ELSE %]
1180                         <option value="[% s.id | html %]">[% s.name | html %]</option>
1181                     [% END %]
1182                 [% END %]
1183             </select>
1184         </p>
1185         [% END %]
1186     [% END %]
1187   </fieldset>
1188 [% END %] [% END %]
1189
1190 </form>
1191
1192 [% IF quickadd && opadd  && !check_member %]
1193     <form id="quick_add_form" class="toggler">
1194         <fieldset class="rows quick_add"><legend>Quick add</legend>
1195             <ol id="quick_add_list">
1196             </ol>
1197         </fieldset>
1198     </form>
1199 [% END %]
1200
1201 [% END %]
1202             </main>
1203         </div> <!-- /.col-sm-10.col-sm-push-2 -->
1204
1205         [% UNLESS ( opadd ) %]
1206             <div class="col-sm-2 col-sm-pull-10">
1207                 <aside>
1208                     [% INCLUDE 'circ-menu.inc' %]
1209                 </aside>
1210             </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1211         [% END %]
1212      </div> <!-- /.row -->
1213
1214 [% MACRO jsinclude BLOCK %]
1215     [% Asset.js("lib/hc-sticky.js") | $raw %]
1216     [% INCLUDE 'calendar.inc' %]
1217     [% INCLUDE 'str/members-menu.inc' %]
1218     [% Asset.js("js/members-menu.js") | $raw %]
1219     <script>
1220         function update_cardnumber_warning(size){
1221             var max_len = [% maxlength_cardnumber | html %];
1222             if ( size >= max_len ) {
1223                 $("#cn_max").show();
1224             } else {
1225                 $("#cn_max").hide();
1226             }
1227         }
1228         var Sticky;
1229         $(document).ready(function() {
1230
1231                 $("#saverecord").css({ 'margin-left': 0 });
1232
1233             Sticky = $("#toolbar");
1234             Sticky.hcSticky({
1235                 stickTo: "main",
1236                 stickyClass: "floating"
1237             });
1238
1239             [% IF categorycode %]
1240                 update_category_code( "[% categorycode | html %]" );
1241             [% ELSE %]
1242                 if ( $("#categorycode_entry").length > 0 ){
1243                     var category_code = $("#categorycode_entry").find("option:selected").val();
1244                     update_category_code( category_code );
1245                 }
1246             [% END %]
1247
1248             [% IF guarantor %]
1249                 select_user( '[% guarantor.borrowernumber | html %]', [% To.json( guarantor.unblessed ) | $raw %] );
1250             [% END %]
1251
1252             $("#cn_max").hide();
1253             var content;
1254             $("#cardnumber").on("keydown", function(e){
1255                 content = $(this).val();
1256             });
1257             $("#cardnumber").on("keyup", function(e){
1258                 // .val() will return the value of the input after the key has been released
1259                 var l = $(this).val().length;
1260                 if ( l == content.length + 1 ) { l--; }
1261                 update_cardnumber_warning(l);
1262             });
1263             $("#cardnumber").bind("paste", function(e){
1264                 var pastedData = e.originalEvent.clipboardData.getData('text');
1265                 update_cardnumber_warning(pastedData.length - 1);
1266             } );
1267             var toggle_quick_add = $(".toggle_quick_add");
1268             $(toggle_quick_add).click(function(e){
1269                 toggle_quick_add.toggle();
1270                 e.preventDefault();
1271                 var toggle_to = '';
1272                 var toggle_from = '';
1273                 if( $("#entryform:visible").length ) {
1274                     toggle_to = "#quick_add_form label";
1275                     toggle_from = "#entryform label";
1276                 } else {
1277                     toggle_to="#entryform label";
1278                     toggle_from = "#quick_add_form label";
1279                 }
1280                 $(toggle_from).each(function() {
1281                     var input_label = $(this).attr('for');
1282                     if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) {
1283                         $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') );
1284                         return;
1285                     }
1286                     $(toggle_to+"[for='"+input_label+"']").next().val(  $(this).next().val() );
1287                 });
1288
1289                 $(".toggler").toggle();
1290             });
1291
1292             $("#save_quick_add").click(function(){
1293                 $("#quick_add_form").validate();
1294                 if( $("#quick_add_form").valid()){
1295                     $('.toggle_quick_add').click();
1296                     $('#saverecord').click();
1297                 }
1298                 else {return false;}
1299             });
1300
1301             $("#saverecord").click(function(){
1302                 if( check_form_borrowers() ){
1303                     $("#entryform").submit();
1304                 }
1305             });
1306
1307             $('#duplicate').on('click', function() {
1308                 $("input[name='op']").val('modify');
1309                 $("input[name='borrowernumber']").val('[% check_member | html %]');
1310                 $("input[name='check_member']").val('');
1311                 $('#entryform').submit();
1312             });
1313
1314             $('#not-duplicate').on('click', function() {
1315                 $("input[name='nodouble']").val('1');
1316                 $('#entryform').submit();
1317             });
1318         });
1319
1320         var MSG_SEPARATOR = _("Separator must be / in field %s");
1321         var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
1322         var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s");
1323         var MSG_INCORRECT_YEAR = _("Invalid year entered in field %s");
1324         var MSG_DUPLICATE_PATRON = _("Warning: Duplicate patron");
1325         var MSG_DUPLICATE_ORGANIZATION = _("Warning: Duplicate organization");
1326         var MSG_LATE_EXPIRY = _("Warning: Expiration date falls before enrollment date");
1327         var MSG_DUPLICATE_SUSPICION = _("Please confirm whether this is a duplicate patron");
1328         var MSG_MONTH = _("%s month")
1329         var MSG_MONTHS = _("%s months")
1330         var MSG_YEAR = _("%s year")
1331         var MSG_YEARS = _("%s years")
1332         var LABEL_CHANGE = _("Change");
1333         var LABEL_SET_TO_PATRON = _("Set to patron");
1334         var LABEL_AGE = _("Age");
1335         var MSG_MESSAGING_DFEAULTS = _("Change messaging preferences to default for this category?");
1336
1337         [% IF quickadd && opadd  && !check_member %]
1338             $(document).ready(function () {
1339
1340                 $("#entryform,#saverecord").hide();
1341                 [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
1342                 var qaddfields = [[% FOREACH field IN q_add_f.unique %]"[% field | html %]",[% END %]];
1343                 var skipped_fields = ["contactname","contactfirstname","relationship"]; //Guarantor form is pulled as a whole, ignore individual fields
1344                 $("#entryform label").each(function () {
1345                     var input_label = $(this).attr('for');
1346                     if ( input_label == 'sex-female' ) {
1347                         input_label='sex';
1348                     }
1349                     else if ( input_label == 'btitle' ) {
1350                         input_label='title';
1351                     }
1352                     if ( skipped_fields.indexOf( input_label ) != -1 ) { input_label=""; }
1353                     if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){
1354                        $(this).parent().clone().appendTo("#quick_add_list");
1355                        [% UNLESS mandatorypassword %]
1356                              if( input_label == 'password' ) $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list");
1357                        [% END %]
1358                     }
1359                 });
1360                     if( $("#memberentry_guarantor").length ) {
1361                         $("#memberentry_guarantor").clone().appendTo("#quick_add_list").css("margin",0);
1362                         $("#quick_add_form #memberentry_guarantor").append("<p>" + _("Note: Quick add guarantor form populates address fields in full form") + "</p>");
1363                         $("#quick_add_list #guarantordelete").prop('id','qagd');
1364                     }
1365                 $("#qagd").click(function() { $("#guarantordelete").click(); });
1366                 $("#quick_add_form").show();
1367             });
1368         [% END %]
1369
1370     </script>
1371     [% Asset.js("js/members.js") | $raw %]
1372     [% Asset.js("js/messaging-preference-form.js") | $raw %]
1373     [% PROCESS 'password_check.inc' %]
1374     [% PROCESS 'add_password_check' new_password => 'password' %]
1375 [% END %]
1376
1377 [% INCLUDE 'intranet-bottom.inc' %]