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