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