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