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