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