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