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