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