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