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