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