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