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