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