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