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