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