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