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