Bug 18403: Guarantors
[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>
464      [% IF guarantorid %]
465         [% IF logged_in_user.can_see_patron_infos( guarantor ) %]
466             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantorid %]" target="blank">[% guarantorid | html %]</a>
467         [% ELSE %]
468             [% guarantorid | html %]
469         [% END %]
470     [% END %]
471  </li>
472         [% UNLESS nocontactname %]
473  <li>
474      <label for="contactname">Surname: </label>
475      [% IF ( guarantorid ) %]
476      <span>[% contactname %]</span>
477      <input name="contactname" id="contactname" type="hidden" size="20" value="[% contactname | html %]" />
478      [% ELSE %]
479         <input name="contactname" id="contactname" type="text" size="20" value="[% contactname | html %]" />
480      [% END %]
481  </li>
482         [% END %]
483         [% UNLESS nocontactfirstname %]
484  <li>
485      <label for="contactfirstname">First name: </label>
486      [% IF ( guarantorid ) %]
487      <span>[% contactfirstname %]</span>
488      <input name="contactfirstname" id="contactfirstname" type="hidden" size="20" value="[% contactfirstname | html %]" />
489      [% ELSE %]
490         <input name="contactfirstname" id="contactfirstname" type="text" size="20" value="[% contactfirstname | html %]" />
491      [% END %]
492  </li>
493         [% END %]
494  [% IF ( relshiploop ) %]
495  <li>
496      <label for="relationship">Relationship: </label>
497      <select name="relationship" id="relationship" >
498          [% FOREACH relshiploo IN relshiploop %]
499          [% IF ( relshiploo.selected ) %]
500          <option value="[% relshiploo.relationship %]" selected="selected" >[% relshiploo.relationship %]</option>
501          [% ELSE %]
502          <option value="[% relshiploo.relationship %]">[% relshiploo.relationship %]</option>
503          [% END %]
504          [% END %]
505      </select>
506  </li>
507  [% END %]
508  [% END %]
509 [% END %]
510         <li>
511             <span class="label">&nbsp;</span>
512             [% IF ( guarantorid ) %]
513             <input id="guarantorsearch" type="button" value="Change" onclick="Dopopguarantor('guarantor_search.pl');" />
514             [% ELSE %]
515             <input id="guarantorsearch" type="button" value="Set to patron" onclick="Dopopguarantor('guarantor_search.pl');" />
516             [% END %]
517             <input id="guarantordelete" type="button" value="Delete" />
518         </li>
519     [% IF guarantorid && Koha.Preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') %]
520         <li>
521             <label for="privacy_guarantor_checkouts">Show checkouts to guarantor</label>
522             <select name="privacy_guarantor_checkouts" id="privacy_guarantor_checkouts">
523                 [% IF privacy_guarantor_checkouts %]
524                     <option value="0">No</option>
525                     <option value="1" selected>Yes</option>
526                 [% ELSE %]
527                     <option value="0" selected>No</option>
528                     <option value="1">Yes</option>
529                 [% END %]
530             </select>
531             <div class="hint">Allow guarantor of this patron to view this patron's checkouts from the OPAC</div>
532         </li>
533     [% END %]
534         </ol>
535     </fieldset>
536
537 [% END %]
538 [% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %]
539     [% IF Koha.Preference( 'AddressFormat' ) %]
540         [% INCLUDE "member-main-address-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %]
541     [% ELSE %]
542         [% INCLUDE 'member-main-address-style-us.inc' %]
543     [% END %]
544 [% END # nostreet && nocity etc group%]
545
546 [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
547   <fieldset class="rows" id="memberentry_contact">
548     <legend id="contact_lgd">Contact</legend><ol>
549         [% UNLESS nophone %]
550       <li>
551       [% IF ( mandatoryphone ) %]
552       <label for="phone" class="required">
553       [% ELSE %]
554       <label for="phone">
555       [% END %]
556       Primary phone: </label>
557         <input type="text" id="phone" name="phone" value="[% phone | html %]" />
558           [% IF ( mandatoryphone ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div>
559
560     </li>
561         [% END %]
562         [% UNLESS nophonepro %]
563     <li>
564       [% IF ( mandatoryphonepro ) %]
565       <label for="phonepro" class="required">
566       [% ELSE %]
567       <label for="phonepro">
568       [% END %]
569       Secondary phone: </label>
570     <input type="text" id="phonepro" name="phonepro" value="[% phonepro | html %]" />
571           [% IF ( mandatoryphonepro ) %]<span class="required">Required</span>[% END %]
572     </li>
573         [% END %]
574         [% UNLESS nomobile %]
575     <li>
576       [% IF ( mandatorymobile ) %]
577       <label for="mobile" class="required">
578       [% ELSE %]
579       <label for="mobile">
580       [% END %]
581       Other phone: </label>
582         <input type="text" id="mobile" name="mobile" value="[% mobile | html %]" />
583           [% IF ( mandatorymobile ) %]<span class="required">Required</span>[% END %]
584     </li>
585         [% END %]
586         [% UNLESS noemail %]
587     <li>
588       [% IF ( mandatoryemail ) %]
589       <label for="email" class="required">
590       [% ELSE %]
591       <label for="email">
592       [% END %]
593       Primary email: </label>
594         <input type="text" id="email" name="email" size="45" value="[% email | html %]" />
595           [% IF ( mandatoryemail ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div>
596
597     </li>
598         [% END %]
599         [% UNLESS noemailpro %]
600     <li>
601       [% IF ( mandatoryemailpro ) %]
602       <label for="emailpro" class="required">
603       [% ELSE %]
604       <label for="emailpro">
605       [% END %]
606       Secondary email: </label>
607         <input type="text" id="emailpro" name="emailpro" size="45" value="[% emailpro | html %]" />
608           [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %]
609     </li>
610         [% END %]
611         [% UNLESS nofax %]
612     <li>
613       [% IF ( mandatoryfax ) %]
614       <label for="fax" class="required">
615       [% ELSE %]
616       <label for="fax">
617       [% END %]
618       Fax: </label>
619         <input type="text" id="fax" name="fax" value="[% fax | html %]" />
620           [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
621     </li>
622         [% END %]
623         </ol>
624   </fieldset>
625 [%END # hide fieldset %]
626
627 <!-- ************************ STEP_1 *********************** -->
628 [% END %]
629 [% IF ( step_6 ) %]
630
631     [% UNLESS noB_address && noB_address2 && noB_city && noB_zipcode && noB_state && noB_country &&nocontactnote && noB_phone && noB_email %]
632         [% IF Koha.Preference( 'AddressFormat' ) %]
633             [% INCLUDE "member-alt-address-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %]
634         [% ELSE %]
635             [% INCLUDE 'member-alt-address-style-us.inc' %]
636         [% END %]
637     [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %]
638 [% END %]
639 [% IF ( step_2 ) %]
640     [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactaddress2 && noaltcontactaddress3 && noaltcontactstate && noaltcontactzipcode && noaltcontactcountry && noaltcontactphone %]
641         [% IF Koha.Preference( 'AddressFormat' ) %]
642             [% INCLUDE "member-alt-contact-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %]
643         [% ELSE %]
644             [% INCLUDE 'member-alt-contact-style-us.inc' %]
645         [% END %]
646     [% END # UNLESS noaltcontactsurname && noaltcontactfirstname etc %]
647
648 [% END %]
649 [% IF ( step_3 ) %]
650
651   [% SET autoMemberNum = Koha.Preference('autoMemberNum') %]
652   <fieldset class="rows" id="memberentry_library_management">
653     <legend id="library_management_lgd">Library management</legend><ol>
654       [% UNLESS nocardnumber %]
655         <li>
656           [% IF mandatorycardnumber and not autoMemberNum %]
657             <label for="cardnumber" class="required">
658           [% ELSE %]
659             <label for="cardnumber" class="validated">
660           [% END %]
661           [% IF autoMemberNum %]
662               Card number<br>(<u>leave blank for auto calc during registration</u>): </label>
663           [% ELSE %]
664               Card number: </label>
665           [% END %]
666           [% IF minlength_cardnumber == maxlength_cardnumber %]
667                 <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" minlength="[% minlength_cardnumber %]" maxlength="[% maxlength_cardnumber %]" />
668                 [% 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>
669                 <div class="hint">Card number must be exactly [% minlength_cardnumber %] characters.</div>
670           [% ELSIF minlength_cardnumber && maxlength_cardnumber %]
671                 <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" minlength="[% minlength_cardnumber %]" maxlength="[% maxlength_cardnumber %]" />
672                 [% 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>
673                 <div class="hint">Card number must be between [% minlength_cardnumber %] and [% maxlength_cardnumber %] characters.</div>
674           [% ELSIF maxlength_cardnumber %]
675                 <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" maxlength="[% maxlength_cardnumber %]" />
676                 [% 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>
677                 <div class="hint">Card number can be up to [% maxlength_cardnumber %] characters.</div>
678           [% ELSE %]
679                 <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" />
680                 [% IF mandatorycardnumber and not autoMemberNum %]<span class="required">Required</span>[% END %]
681                 <div class="hint">There is no minimum or maximum character length.</div>
682           [% END %]
683         </li>
684       [% END %]
685       [% UNLESS nobranchcode %]
686     <li>
687         <label for="libraries" class="required">Library:</label>
688         <select name="branchcode" size="1" id="libraries">
689             [% PROCESS options_for_libraries libraries => Branches.all( selected => userbranch, only_from_group => 1 ) %]
690         </select>
691         <span class="required">Required</span>
692     </li>
693         [% END %]
694     <li>
695         <label for="categorycode_entry" class="required">Category: </label>
696         <select id="categorycode_entry" name="categorycode" onchange="update_category_code(this);">
697         [% FOREACH typeloo IN typeloop %]
698             [% FOREACH categoryloo IN typeloo.categoryloop %]
699                 [% IF ( loop.first ) %]
700                     [% IF ( typeloo.typename_C ) %]<optgroup label="Child">[% END %]
701                     [% IF ( typeloo.typename_A ) %]<optgroup label="Adult">[% END %]
702                     [% IF ( typeloo.typename_S ) %]<optgroup label="Staff">[% END %]
703                     [% IF ( typeloo.typename_I ) %]<optgroup label="Organization">[% END %]
704                     [% IF ( typeloo.typename_P ) %]<optgroup label="Professional">[% END %]
705                     [% IF ( typeloo.typename_X ) %]<optgroup label="Statistical">[% END %]
706                 [% END %]
707                 [% IF ( categoryloo.categorycodeselected ) %]
708                     <option value="[% categoryloo.categorycode %]" selected="selected" data-typename="[% typeloo.typename %]">[% categoryloo.categoryname %]</option>
709                 [% ELSE %]
710                     <option value="[% categoryloo.categorycode %]" data-typename="[% typeloo.typename %]">[% categoryloo.categoryname %]</option>
711                 [% END %]
712                 [% IF ( loop.last ) %]
713                     </optgroup>
714                 [% END %]
715             [% END %]
716        [% END %]
717        </select>
718        <span class="required">Required</span>
719     </li>
720         [% UNLESS nosort1 %]
721     <li>
722       [% IF ( mandatorysort1 ) %]
723         <label for="sort1" class="required">
724       [% ELSE %]
725         <label for="sort1">
726       [% END %]
727       Sort 1: </label>
728       [% PROCESS 'av-build-dropbox.inc' name="sort1", category="Bsort1", default=sort1, size = 20 %]
729       [% IF ( mandatorysort1 ) %]<span class="required">Required</span>[% END %]
730     </li>
731         [% END %]
732         [% UNLESS nosort2 %]
733     <li>
734     [% IF ( mandatorysort2 ) %]
735     <label for="sort2" class="required">
736     [% ELSE %]
737     <label for="sort2">
738     [% END %]
739     Sort 2: </label>
740     [% PROCESS 'av-build-dropbox.inc' name="sort2", category="Bsort2", default=sort2, size = 20 %]
741     [% IF ( mandatorysort2 ) %]<span class="required">Required</span>[% END %]
742     </li>
743         [% END %]
744     [% IF ( Koha.Preference( 'NorwegianPatronDBEnable' ) == 1 ) %]
745         <li>
746             <label for="sort2">Sync with the Norwegian national patron database:</label>
747             [% IF ( sync == 0 ) %]
748                 <input type="radio" id="sync" name="sync" value="1"> Yes
749                 <input type="radio" id="sync" name="sync" value="0" checked> No
750             [% ELSE %]
751                 <input type="radio" id="sync" name="sync" value="1" checked> Yes
752                 <input type="radio" id="sync" name="sync" value="0"> No
753             [% END %]
754         </li>
755     [% END %]
756     [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
757       <li><label for="checkprevcheckout">Check for previous checkouts: </label>
758         <select name="checkprevcheckout" id="checkprevcheckout">
759         [% IF ( checkprevcheckout == 'yes' ) %]
760           <option value="yes" selected="selected">Yes if settings allow it</option>
761           <option value="no">No if settings allow it</option>
762           <option value="inherit">Inherit from settings</option>
763         [% ELSIF ( checkprevcheckout == 'no' ) %]
764           <option value="yes">Yes if settings allow it</option>
765           <option value="no" selected="selected">No if settings allow it</option>
766           <option value="inherit">Inherit from settings</option>
767         [% ELSE %]
768           <option value="yes">Yes if settings allow it</option>
769           <option value="no">No if settings allow it</option>
770           <option value="inherit" selected="selected">Inherit from settings</option>
771         [% END %]
772         </select>
773        </li>
774      [% END %]
775     [% IF Koha.Preference('TranslateNotices') %]
776         <li>
777             <label for="lang">Preferred language for notices: </label>
778             <select id="lang" name="lang">
779                 <option value="default">Default</option>
780                 [% FOR language IN languages %]
781                     [% FOR sublanguage IN language.sublanguages_loop %]
782                         [% IF language.plural %]
783                             [% IF sublanguage.rfc4646_subtag == lang %]
784                                 <option value="[% sublanguage.rfc4646_subtag %]" selected="selected">[% sublanguage.native_description %] [% sublanguage.region_description %] ([% sublanguage.rfc4646_subtag %])</option>
785                             [% ELSE %]
786                                 <option value="[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] [% sublanguage.region_description %] ([% sublanguage.rfc4646_subtag %])</option>
787                             [% END %]
788                         [% ELSE %]
789                             [% IF sublanguage.rfc4646_subtag == lang %]
790                                 <option value="[% sublanguage.rfc4646_subtag %]" selected="selected">[% sublanguage.native_description %] ([% sublanguage.rfc4646_subtag %])</option>
791                             [% ELSE %]
792                                 <option value="[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] ([% sublanguage.rfc4646_subtag %])</option>
793                             [% END %]
794                         [% END %]
795                     [% END %]
796                 [% END %]
797             </select>
798         </li>
799     [% END %]
800    </ol>
801   </fieldset>
802     [% UNLESS nodateenrolled &&  noopacnote && noborrowernotes %]
803         <fieldset class="rows" id="memberentry_subscription">
804         <legend id="library_setup_lgd">Library set-up</legend><ol>
805         [% UNLESS nodateenrolled %]
806                 <li>
807                         [% IF ( mandatorydateenrolled ) %]
808             <label for="from" class="required">
809                         [% ELSE %]
810             <label for="from">
811                         [% END %]
812                         Registration date: </label>
813             [% IF ( dateformat == "metric" ) %]
814                 <input type="text" id="from" name="dateenrolled"  maxlength="10" size="10" onchange="CheckDate(document.form.dateenrolled);check_manip_date('verify');" value="[% dateenrolled %]" class="datepickerfrom" />
815             [% ELSE %]
816                 <input type="text" id="from" name="dateenrolled"  maxlength="10" size="10" value="[% dateenrolled %]" class="datepickerfrom" />
817             [% END %]
818                 [% IF ( mandatorydateenrolled ) %]<span class="required">Required</span>[% END %]
819                 [% IF ( ERROR_dateenrolled ) %]<span class="required">(Error)</span>[% END %]
820                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
821                 </li>
822         [% END %]
823         [% UNLESS nodateexpiry %]
824                 <li>
825         [% ELSE %]
826                 <li style="display:none">
827         [% END %]
828                         [% IF ( mandatorydateexpiry ) %]
829             <label for="to" class="required">
830                         [% ELSE %]
831             <label for="to">
832                         [% END %]
833                         Expiry date (leave blank for auto calc): </label>
834             [% IF ( dateformat == "metric" ) %]
835                                 [% UNLESS ( opadd ) %]
836                     <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" />
837                                 [% ELSE %]
838                     <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" onchange="CheckDate(document.form.dateexpiry);check_manip_date('verify');" class="datepickerto" />
839                                 [% END %]
840                         [% ELSE %]
841                                 [% UNLESS ( opadd ) %]
842                 <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% dateexpiry UNLESS opduplicate %]" class="datepickerto" />
843                                 [% ELSE %]
844                 <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% dateexpiry %]" class="datepickerto" />
845                                 [% END %]
846                         [% END %]
847                 [% IF ( mandatorydateexpiry ) %]<span class="required">Required</span>[% END %]
848                 [% IF ( ERROR_dateexpiry ) %]<span class="required">(Error)</span>[% END %]
849                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
850                 </li>
851         [% UNLESS noopacnote %]
852                 <li>
853                         [% IF ( mandatoryopacnote ) %]
854                                 <label for="opacnote" class="required">
855                         [% ELSE %]
856                                 <label for="opacnote">
857             [% END %]
858                         OPAC note: </label>
859             <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% opacnote | html UNLESS opduplicate %]</textarea>
860                         <div class="hint">This message appears on this patron's user page in the OPAC</div>
861           [% IF ( mandatoryopacnote ) %]<span class="required">Required</span>[% END %]
862                 </li>
863         [% END %]
864         [% UNLESS noborrowernotes %]
865                 <li>
866             [% IF ( mandatoryborrowernotes ) %]
867                                 <label for="borrowernotes" class="required">
868                         [% ELSE %]
869                                 <label for="borrowernotes">
870                         [% END %]
871                         Circulation note: </label>
872             <textarea id="borrowernotes" name="borrowernotes" cols="55" rows="5">[% borrowernotes | html UNLESS opduplicate %]</textarea>
873                         <div class="hint">This message displays when checking out to this patron</div>
874           [% IF ( mandatoryborrowernotes ) %]<span class="required">Required</span>[% END %]
875                 </li>
876         [% END %]
877                 </ol>
878         </fieldset>
879     [% END # hide fieldset %]
880
881     [% UNLESS nouserid && nopassword %]
882         <fieldset class="rows" id="memberentry_userid">
883         <legend id="opac_staff_login_lgd">OPAC/Staff login</legend><ol>
884         [% UNLESS nouserid %]
885                 <li>
886                         [% IF ( mandatoryuserid ) %]
887                         <label for="userid" class="required">
888                         [% ELSE %]
889                         <label for="userid">
890                         [% END %]
891                         Username: </label>
892
893 [% IF ( NoUpdateLogin ) %]
894         [% IF ( opduplicate ) %]
895                 <input type="text" id="userid" name="userid" size="20" disabled="disabled" />
896         [% ELSE %]
897                 <input type="text" id="userid" name="userid" size="20" disabled="disabled" value="[% userid %]" />
898         [% END %]
899 [% ELSE %]
900         [% IF ( opduplicate ) %]
901                 <input type="text" id="userid" name="userid" size="20" value="" />
902         [% ELSE %]
903                 <input type="text" id="userid" name="userid" size="20" value="[% userid %]" />
904         [% END %]
905 [% END %]
906
907 [%# Dummy input to avoid Firefox from using userid/password saved for authentication %]
908 <input type="text" disabled="disabled" style="display:none" />
909
910           [% IF ( mandatoryuserid ) %]<span class="required">Required</span>[% END %]
911                 </li>
912         [%END %]
913         [% UNLESS nopassword %]
914                 <li>
915                         [% IF ( mandatorypassword ) %]
916                         <label for="password" class="required">
917                         [% ELSE %]
918                         <label for="password">
919                         [% END %]
920                         Password: </label>
921                         [% IF ( opadd ) %]
922                         [% IF ( NoUpdateLogin ) %]
923                                 [% IF ( opduplicate ) %]
924                                         <input type="password" id="password" name="password" size="20"  disabled="disabled" />
925                                 [% ELSE %]
926                                         <input type="password" id="password" name="password" size="20"  disabled="disabled" value="[% password %]" />
927                                 [% END %]
928 [% ELSE %]
929                                 [% IF ( opduplicate ) %]
930                                         <input type="password" id="password" name="password" size="20" />
931                                 [% ELSE %]
932                                         <input type="password" id="password" name="password" size="20" value="[% password %]" />
933                                 [% END %]
934 [% END %]
935                         [% ELSE %]
936                         [% IF ( password ) %]
937                                 [% IF ( NoUpdateLogin ) %]
938                                         <input type="password" id="password" name="password" size="20"  disabled="disabled" value="****" />
939                                 [% ELSE %]
940                                         [% IF ( opduplicate ) %]
941                                                 <input type="password" id="password" name="password" size="20" />
942                                         [% ELSE %]
943                                                 <input type="password" id="password" name="password" size="20" value="****" />
944                                         [% END %]
945                                 [% END %]
946                         [% ELSE %]
947                                 [% IF ( NoUpdateLogin ) %]
948                                         <input type="password" id="password" name="password" size="20"  disabled="disabled" value="" />
949                                 [% ELSE %]
950                                         <input type="password" id="password" name="password" size="20" value="" />
951                                 [% END %]
952                         [% END %]
953                         [% END %]
954             [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %]
955             [% IF ( ERROR_password_too_short ) %]<span class="required">Password is too short</span>[% END %]
956             [% IF ( ERROR_password_too_weak ) %]<span class="required">Password is too weak</span>[% END %]
957             [% IF ( ERROR_password_has_whitespaces ) %]<span class="required">Password has leading or trailing whitespaces</span>[% END %]
958             <div class="hint">Minimum password length: [% minPasswordLength %]</div>
959                 </li>
960                 <li>
961                         [% IF ( mandatorypassword ) %]
962                         <label for="password2" class="required">
963                         [% ELSE %]
964                         <label for="password2">
965                         [% END %]
966                         Confirm password: </label>
967                         [% IF ( opadd ) %]
968                         [% IF ( NoUpdateLogin ) %]
969                                 [% IF ( opduplicate ) %]
970                                         <input type="password" id="password2" name="password2" size="20"  disabled="disabled" />
971                                 [% ELSE %]
972                                         <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="[% password %]" />
973                                 [% END %]
974 [% ELSE %]
975                                 [% IF ( opduplicate ) %]
976                                         <input type="password" id="password2" name="password2" size="20" />
977                                 [% ELSE %]
978                                         <input type="password" id="password2" name="password2" size="20" value="[% password %]" />
979                                 [% END %]
980 [% END %]
981                         [% ELSE %]
982                         [% IF ( password ) %]
983                                 [% IF ( NoUpdateLogin ) %]
984                                         <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="****" />
985                                 [% ELSE %]
986                                         [% IF ( opduplicate ) %]
987                                                 <input type="password" id="password2" name="password2" size="20" />
988                                         [% ELSE %]
989                                                 <input type="password" id="password2" name="password2" size="20" value="****" />
990                                         [% END %]
991                                 [% END %]
992                         [% ELSE %]
993                                 [% IF ( NoUpdateLogin ) %]
994                                         <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="" />
995                                 [% ELSE %]
996                                         <input type="password" id="password2" name="password2" size="20" value="" />
997                                 [% END %]
998                         [% END %]
999                         [% END %]
1000           [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %]
1001                 </li>
1002                 </ol>
1003                 </fieldset>
1004         [% END # hide fieldset %][% END %]
1005                 <!--this zones are not necessary in modif mode -->
1006         [% UNLESS ( opadd || opduplicate ) %]
1007         <fieldset class="rows" id="memberentry_account_flags">
1008             <legend id="account_flags_lgd">Patron account flags</legend>
1009                         <ol class="radio">
1010                         [% FOREACH flagloo IN flagloop %]
1011                                 <li><label class="radio" for="yes[% flagloo.name %]">
1012                 [% IF ( flagloo.key == 'gonenoaddress' ) %]Gone no address:[% END %]
1013                 [% IF ( flagloo.key == 'lost' ) %]Lost card:[% END %]
1014                 </label>
1015                 [% IF CAN_user_circulate_manage_restrictions %]
1016                             <label for="yes[% flagloo.name %]">
1017                                 [% IF ( flagloo.yes ) %]
1018                                 <input type="radio" id="yes[% flagloo.name %]" name="[% flagloo.name %]" value="1" checked="checked" />
1019                                 [% ELSE %]
1020                                 <input type="radio" id="yes[% flagloo.name %]" name="[% flagloo.name %]" value="1" />
1021                                 [% END %]
1022                             Yes </label>
1023                             <label for="no[% flagloo.name %]">
1024                                 [% IF ( flagloo.no ) %]
1025                                 <input type="radio" id="no[% flagloo.name %]" name="[% flagloo.name %]" value="0" checked="checked"/>
1026                                 [% ELSE %]
1027                                 <input type="radio" id="no[% flagloo.name %]" name="[% flagloo.name %]" value="0" />
1028                                 [% END %]
1029                             No </label>
1030                 [% ELSE %]
1031                   [% IF flagloo.yes %]Yes[% ELSE %]No[% END %]
1032                 [% END %]
1033
1034             </li>
1035                         [% END %]
1036
1037                         </ol>
1038                         </fieldset>
1039
1040               <fieldset class="rows" id="memberentry_restrictions">
1041                 <legend id="restrictions_lgd">Patron restrictions</legend>
1042
1043                 [% IF ( debarments ) %]
1044                     <table>
1045                         <thead>
1046                             <tr>
1047                                  <th>Type</th>
1048                                  <th>Comment</th>
1049                                  <th>Expiration</th>
1050                                  <th>Created</th>
1051                                  [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1052                                    <th>Remove?</th>
1053                                  [% END %]
1054                             </tr>
1055                         </thead>
1056
1057                         <tbody>
1058                             [% FOREACH d IN debarments %]
1059                                 <tr>
1060                                     <td>[% d.type %]</td>
1061                                     <td>
1062                                     [% IF d.comment.search('OVERDUES_PROCESS') %]
1063                                         Restriction added by overdues process [% d.comment.remove('OVERDUES_PROCESS ') %]
1064                                     [% ELSE %]
1065                                         [% d.comment %]
1066                                     [% END %]
1067                                     </td>
1068                                     <td>[% IF d.expiration %] [% d.expiration | $KohaDates %] [% ELSE %] <i>Indefinite</i> [% END %]</td>
1069                                     <td>[% d.created | $KohaDates %]</td>
1070                                     [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1071                                       <td>
1072                                         <input type="checkbox" id="debarment_[% d.borrower_debarment_id %]" name="remove_debarment" value="[% d.borrower_debarment_id %]" />
1073                                       </td>
1074                                     [% END %]
1075                                 </tr>
1076                             [% END %]
1077                         </tbody>
1078                     </table>
1079                 [% ELSE %]
1080                     <p>Patron is currently unrestricted.</p>
1081                 [% END %]
1082
1083                 [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1084                     <p><a href="#" id="add_manual_restriction">Add manual restriction</a></p>
1085                     <fieldset id="manual_restriction_form">
1086                         <input type="hidden" id="add_debarment" name="add_debarment" value="0" />
1087                         <legend id="manual_restriction_lgd">Add manual restriction</legend>
1088                         <ol>
1089                             <li><label for="debarred_comment">Comment: </label><input type="text" id="debarred_comment" name="debarred_comment" onchange="$('#add_debarment').val(1);" /></li>
1090                             <li><label for="debarred_expiration">Expiration: </label><input name="debarred_expiration" id="debarred_expiration" size="10" value="" class="datepicker" onchange="$('#add_debarment').val(1);" />
1091                                     <a href='javascript:void(0)' onclick="$('#debarred_expiration').val('');">Clear date</a></li>
1092
1093                         </ol>
1094                         <p>
1095                             <a class="cancel" id="cancel_manual_restriction" href="#">Cancel</a>
1096                         </p>
1097                     </fieldset>
1098                 [% END %]
1099             </fieldset>
1100                 [% END %]
1101
1102 [% END %]
1103
1104 [% IF ( step_4 ) %]
1105 [% IF Koha.Preference('HouseboundModule') %]
1106   <fieldset class="rows" id="memberentry_housebound_roles">
1107     <legend id="housebound_roles">Housebound roles</legend>
1108     <ol class="radio">
1109       <li>
1110         <label class="radio" for="housebound_chooser">
1111           Chooser:
1112         </label>
1113         [% IF ( housebound_role.housebound_chooser == 1 ) %]
1114         <label for="yes_housebound_chooser">Yes </label>
1115         <input type="radio" id="yes_housebound_chooser"
1116                name="housebound_chooser" value="1"
1117                checked="checked" />
1118         <label for="no_housebound_chooser">No </label>
1119         <input type="radio" id="no_housebound_chooser"
1120                name="housebound_chooser" value="0" />
1121         [% ELSE %]
1122         <label for="yes_housebound_chooser">Yes </label>
1123         <input type="radio" id="yes_housebound_chooser"
1124                name="housebound_chooser" value="1" />
1125         <label for="no_housebound_chooser">No </label>
1126         <input type="radio" id="no_housebound_chooser"
1127                name="housebound_chooser" value="0"
1128                checked="checked" />
1129         [% END %]
1130       </li>
1131       <li>
1132         <label class="radio" for="housebound_deliverer">Deliverer:</label>
1133         [% IF ( housebound_role.housebound_deliverer == 1 ) %]
1134         <label for="yes_housebound_deliverer">Yes </label>
1135         <input type="radio" id="yes_housebound_deliverer"
1136                name="housebound_deliverer" value="1"
1137                checked="checked" />
1138         <label for="no_housebound_deliverer">No </label>
1139         <input type="radio" id="no_housebound_deliverer"
1140                name="housebound_deliverer" value="0" />
1141         [% ELSE %]
1142         <label for="yes_housebound_deliverer">Yes </label>
1143         <input type="radio" id="yes_housebound_deliverer"
1144                name="housebound_deliverer" value="1" />
1145         <label for="no_housebound_deliverer">No </label>
1146         <input type="radio" id="no_housebound_deliverer"
1147                name="housebound_deliverer" value="0"
1148                checked="checked" />
1149         [% END %]
1150       </li>
1151     </ol>
1152   </fieldset>
1153 [% END # hide fieldset %]
1154 [% IF ( ExtendedPatronAttributes ) %][% UNLESS ( no_patron_attribute_types ) %]
1155   <fieldset class="rows" id="memberentry_patron_attributes">
1156     <legend id="patron_attributes_lgd">Additional attributes and identifiers</legend>
1157     <input type="hidden" name="setting_extended_patron_attributes" value="1" />
1158     [% FOREACH pa_loo IN patron_attributes %]
1159         [% IF pa_loo.class %]
1160             <fieldset id="aai_[% pa_loo.class %]">
1161             <legend id="[% pa_loo.class %]_lgd">[% pa_loo.lib %]</legend>
1162         [% END %]
1163         <ol class="attributes_table">
1164             [% FOREACH patron_attribute IN pa_loo.items %]
1165                 <li data-category_code="[% patron_attribute.category_code %]">
1166                     <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
1167                         [% IF ( patron_attribute.use_dropdown ) %]
1168                             <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
1169                                 <option value=""></option>
1170                                 [% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %]
1171                                     [% IF auth_val_loo.authorised_value == patron_attribute.value %]
1172                                         <option value="[% auth_val_loo.authorised_value %]" selected="selected">
1173                                             [% auth_val_loo.lib %]
1174                                         </option>
1175                                     [% ELSE %]
1176                                         <option value="[% auth_val_loo.authorised_value %]" >
1177                                             [% auth_val_loo.lib %]
1178                                         </option>
1179                                     [% END %]
1180                                 [% END %]
1181                             </select>
1182                         [% ELSE %]
1183                             <textarea rows="2" cols="30" id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">[% patron_attribute.value %]</textarea>
1184                         [% END %]
1185                         <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
1186                         <a href="#" onclick="clear_entry(this); return false;"><i class="fa fa-fw fa-trash"></i> Clear</a>
1187                         [% IF ( patron_attribute.repeatable ) %]
1188                         <a href="#" onclick="clone_entry(this); return false;"><i class="fa fa-fw fa-plus"></i> New</a>
1189                         [% END %]
1190                 </li>
1191             [% END %]
1192         </ol>
1193         [% IF pa_loo.class %]</fieldset>[% END %]
1194     [% END %]
1195   </fieldset>
1196 [% END %][% END %][% END %]
1197
1198 [% IF ( step_5 ) %][% IF ( EnhancedMessagingPreferences ) %]
1199   <fieldset class="rows" id="memberentry_messaging_prefs">
1200     <legend id="patron_messaging_prefs_lgd">Patron messaging preferences</legend>
1201     [% IF ( opadd ) %]
1202     <!-- handle changing prefs if creating new patron and changing
1203          the patron category
1204     -->
1205     <script type="text/javascript">//<![CDATA[
1206        $(document).ready(function(){
1207             var message_prefs_dirty = false;
1208             $('#memberentry_messaging_prefs > *').change(function() {
1209                 message_prefs_dirty = true;
1210             });
1211             $('#categorycode_entry').change(function() {
1212                 var categorycode = $(this).val();
1213                 if (message_prefs_dirty) {
1214                     if (!confirm(_("Change messaging preferences to default for this category?"))) {
1215                         return;
1216                     }
1217                 }
1218                 $.getJSON('/cgi-bin/koha/members/default_messageprefs.pl?categorycode=' + categorycode,
1219                     function(data) {
1220                         $.each(data.messaging_preferences, function(i, item) {
1221                             var attrid = item.message_attribute_id;
1222                             var transports = ['email', 'rss', 'sms'];
1223                             $.each(transports, function(j, transport) {
1224                                 if (item['transports_' + transport] == 1) {
1225                                     $('#' + transport + attrid).prop('checked', true);
1226                                 } else {
1227                                     $('#' + transport + attrid).prop('checked', false);
1228                                 }
1229                             });
1230                             if (item.digest && item.digest != ' ') {
1231                                 $('#digest' + attrid).prop('checked', true);
1232                             } else {
1233                                 $('#digest' + attrid).prop('checked', false);
1234                             }
1235                             if (item.takes_days == '1') {
1236                                 $('[name=' + attrid + '-DAYS]').val('' + item.days_in_advance);
1237                             }
1238                         });
1239                         message_prefs_dirty = false;
1240                     }
1241                 );
1242             });
1243         });
1244     //]]>
1245     </script>
1246     [% END %]
1247     <input type="hidden" name="setting_messaging_prefs" value="1" />
1248     [% INCLUDE 'messaging-preference-form.inc' %]
1249     [% IF ( SMSSendDriver ) %]
1250         <p><label for="SMSnumber">SMS number:</label>
1251             <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber %]" />
1252         </p>
1253         [% UNLESS nosms_provider_id %]
1254         <p>
1255             <label for="sms_provider_id">SMS provider:</label>
1256             <select id="sms_provider_id" name="sms_provider_id"/>
1257                 <option value="">Unknown</option>
1258                 [% FOREACH s IN sms_providers %]
1259                     [% IF s.id == sms_provider_id %]
1260                         <option value="[% s.id %]" selected="selected">[% s.name %]</option>
1261                     [% ELSE %]
1262                         <option value="[% s.id %]">[% s.name %]</option>
1263                     [% END %]
1264                 [% END %]
1265             </select>
1266         </p>
1267         [% END %]
1268     [% END %]
1269   </fieldset>
1270 [% END %] [% END %]
1271
1272 </form>
1273
1274 [% IF quickadd && opadd  && !check_member %]
1275     <form id="quick_add_form" class="toggler">
1276         <fieldset class="rows quick_add"><legend>Quick add</legend>
1277             <ol id="quick_add_list">
1278             </ol>
1279         </fieldset>
1280     </form>
1281     <script>
1282         $(document).ready(function () {
1283
1284             $("#entryform,#saverecord").hide();
1285             [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
1286             var qaddfields = [[% FOREACH field IN q_add_f.unique %]"[% field %]",[% END %]];
1287             var skipped_fields = ["contactname","contactfirstname","relationship"]; //Guarantor form is pulled as a whole, ignore individual fields
1288             $("#entryform label").each(function () {
1289                 var input_label = $(this).attr('for');
1290                 if ( input_label == 'sex-female' ) {
1291                     input_label='sex';
1292                 }
1293                 else if ( input_label == 'btitle' ) {
1294                     input_label='title';
1295                 }
1296                 if ( skipped_fields.indexOf( input_label ) != -1 ) { input_label=""; }
1297                 if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){
1298                    $(this).parent().clone().appendTo("#quick_add_list");
1299                    [% UNLESS mandatorypassword %]
1300                          if( input_label == 'password' ) $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list");
1301                    [% END %]
1302                 }
1303             });
1304                 if( $("#memberentry_guarantor").length ) {
1305                     $("#memberentry_guarantor").clone().appendTo("#quick_add_list").css("margin",0);
1306                     $("#quick_add_form #memberentry_guarantor").append("<p>" + _("Note: Quick add guarantor form populates address fields in full form") + "</p>");
1307                     $("#quick_add_list #guarantordelete").prop('id','qagd');
1308                 }
1309             $("#qagd").click(function() { $("#guarantordelete").click(); });
1310             $("#quick_add_form").show();
1311         });
1312     </script>
1313 [% END %]
1314 </div>
1315 </div>
1316
1317 [% UNLESS ( opadd ) %]<div class="yui-b">
1318 [% INCLUDE 'members-menu.inc' %]
1319 </div>[% END %]
1320 [% END %]
1321 </div>
1322 [% INCLUDE 'intranet-bottom.inc' %]
1323 [% PROCESS 'password_check.inc' %]
1324 [% PROCESS 'add_password_check' new_password => 'password' %]