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