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