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