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