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