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