]> git.koha-community.org Git - koha.git/blob - koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
Bug 25070: Centralize member-alt-address-style
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / memberentrygen.tt
1 [% PROCESS 'i18n.inc' %]
2 [% USE raw %]
3 [% USE Asset %]
4 [% USE To %]
5 [% USE Koha %]
6 [% USE KohaDates %]
7 [% USE Branches %]
8 [% PROCESS 'member-alt-address-style.inc' %]
9 [% SET footerjs = 1 %]
10 [% INCLUDE 'doc-head-open.inc' %]
11     <title>Koha &rsaquo; Patrons &rsaquo;
12         [% UNLESS blocking_error %]
13             [% IF ( opadd ) %]
14                 Add patron
15             [% ELSIF ( opduplicate ) %]
16                 Duplicate patron
17             [% ELSE %]
18                 Modify patron
19             [% END %]
20             [% INCLUDE 'patron-title.inc' no_html = 1 %]
21             [% IF categoryname %]([% categoryname | html %])[% END %]
22         [% END %]
23     </title>
24 <style>
25 legend:hover {
26     cursor: pointer;
27 }
28 </style>
29 [% INCLUDE 'doc-head-close.inc' %]
30 </head>
31
32 <body id="pat_memberentrygen" class="pat">
33     [% INCLUDE 'header.inc' %]
34     [% INCLUDE 'patron-search.inc' %]
35
36     <div id="breadcrumbs">
37         <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
38         <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
39         [% UNLESS blocking_error %]
40             &rsaquo;
41             [% IF (firstname || surname ) %]
42                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | uri %]">
43                     [% INCLUDE 'patron-title.inc' %]
44                 </a>  &rsaquo;
45             [% END %]
46             <strong>
47                 [% IF ( opadd ) %]
48                     Add patron
49                 [% ELSIF ( opduplicate ) %]
50                     Duplicate patron
51                 [% ELSE %]
52                     Modify patron
53                 [% END %]
54                 [% IF categoryname %]([% categoryname | html %])[% END %]
55             </strong>
56         [% END %]
57     </div> <!-- /#breadcrumbs -->
58
59     <div class="main container-fluid">
60         <div class="row">
61             [% IF messages %]
62                 [% FOR message IN messages %]
63                     [% SWITCH message.error %]
64                         [% CASE 'error_on_insert_patron' %]
65                             <div class="dialog alert">Something went wrong when creating the patron. Check the logs.</div>
66                         [% CASE 'error_on_update_patron' %]
67                             <div class="dialog alert">Something went wrong when updating the patron. Check the logs.</div>
68                         [% CASE %]Unhandled error: [% message.error | html %]
69                     [% END %]
70                 [% END %]
71             [% END %]
72             [% IF ( opadd ) %]
73                 <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
74             [% ELSE %]
75                 <div class="col-sm-10 col-sm-push-2">
76             [% END %]
77                 <main class="clearfix">
78                     [% INCLUDE 'blocking_errors.inc' %]
79
80                     [% IF error_alert %]
81                         [% IF ( error_alert == "no_email" ) %]
82                             <div class="dialog alert">This member has no email</div>
83                         [% ELSE %]
84                             <div class="dialog alert">[% error_alert | html %]</div>
85                         [% END %]
86                     [% END %]
87                     [% IF info_alert %]
88                         <div class="dialog message">Email has been sent.</div>
89                     [% END %]
90
91                     [% INCLUDE 'noadd-warnings.inc' %]
92
93                     [% UNLESS ( no_add ) %]
94                         <h1>
95                             [% IF ( opadd ) %]
96                                 Add patron
97                             [% ELSIF ( opduplicate ) %]
98                                 Duplicate patron
99                             [% ELSE %]
100                                 Modify patron
101                             [% END %]
102                             [% INCLUDE 'patron-title.inc' %]
103                             [% IF categoryname %]([% categoryname | html %])[% END %]
104                         </h1>
105
106                         [% IF quickadd && opadd && !check_member %]
107                             <a href="#" class="toggle_quick_add"><i class="fa fa-plus-square"></i> Show full form</a>
108                             <a href="#" class="toggle_quick_add" style="display:none"><i class="fa fa-minus-square"></i> Show brief form</a>
109                         [% END %]
110
111                         [% IF ( check_member ) %]
112                             <div class="dialog alert">
113                                 <h3>Duplicate patron record?</h3>
114                                 <p><a class="popup_patronview" href="/cgi-bin/koha/members/moremember.pl?print=brief&amp;borrowernumber=[% check_member | uri %]"><i class="fa fa-window-restore"></i> View existing record</a></p>
115                                 <button id="duplicate" type="submit" class="new"> <i class="fa fa-pencil"></i> It is a duplicate. Edit existing record </button>
116                                 <button type="submit" id="not-duplicate" class="new"> <i class="fa fa-plus"></i> Not a duplicate. Save as new record </button>
117                             </div>
118                         [% END %]
119
120                         [% IF ( nok ) %]
121                             <div class="dialog alert">
122                                 <p>The following fields are wrong. Please fix them.</p>
123                                 <ul>
124                                     [% IF ( ERROR_login_exist ) %]
125                                         <li id="ERROR_login_exist">Username/password already exists.</li>
126                                     [% END %]
127                                     [% IF ERROR_cardnumber_already_exists %]
128                                         <li id="ERROR_cardnumber">Cardnumber already in use.</li>
129                                     [% END %]
130                                     [% IF ERROR_cardnumber_length %]
131                                         <li id="ERROR_cardnumber">Cardnumber length is incorrect.</li>
132                                     [% END %]
133                                     [% IF ( ERROR_age_limitations ) %]
134                                     <li id="ERROR_age_limitations">Patron's age is incorrect for their category.
135                                             Ages allowed are [% age_low | html %]-[% age_high | html %].</li>
136                                     [% END %]
137                                     [% IF ( ERROR_branch ) %]
138                                         <li id="ERROR_branch">Library is invalid.</li>
139                                     [% END %]
140                                     [% IF ( ERROR_dateofbirth ) %]
141                                         <li id="ERROR_dateofbirth">Date of birth is invalid.</li>
142                                     [% END %]
143                                     [% IF ( ERROR_dateenrolled ) %]
144                                         <li id="ERROR_dateenrolled">Date of enrollment is invalid.</li>
145                                     [% END %]
146                                     [% IF ( ERROR_dateexpiry ) %]
147                                         <li id="ERROR_dateexpiry">Date of expiration is invalid.</li>
148                                     [% END %]
149                                     [% IF ( ERROR_password_too_short ) %]
150                                         <li id="ERROR_short_password">Password must be at least [% minPasswordLength | html %] characters long.</li>
151                                     [% END %]
152                                     [% IF ( ERROR_password_too_weak ) %]
153                                         <li id="ERROR_weak_password">Password must contain at least one digit, one lowercase and one uppercase.</li>
154                                     [% END %]
155                                     [% IF ( ERROR_password_has_whitespaces ) %]
156                                         <li id="ERROR_weak_password">Password must not contain leading or trailing whitespaces.</li>
157                                     [% END %]
158                                     [% IF ( ERROR_password_mismatch ) %]
159                                         <li id="ERROR_password_mismatch">Passwords do not match.</li>
160                                     [% END %]
161                                     [% IF ( ERROR_extended_unique_id_failed ) %]
162                                         <li id="ERROR_extended_unique_id_failed"><strong>[% ERROR_extended_unique_id_failed_description | html %]:</strong> Attribute value "[% ERROR_extended_unique_id_failed_value | html %]" is already in use by another patron record.</li>
163                                     [% END %]
164                                     [% IF ERROR_bad_email %]
165                                         <li id="ERROR_bad_email">The primary email is invalid.</li>
166                                     [% END %]
167                                     [% IF ERROR_bad_email_secondary %]
168                                         <li id="ERROR_bad_email_secondary">The secondary email is invalid.</li>
169                                     [% END %]
170                                     [% IF ERROR_bad_email_alternative %]
171                                         <li id="ERROR_bad_email_alternative">The alternative email is invalid.</li>
172                                     [% END %]
173                                 </ul>
174                             </div>
175                         [% END %]
176
177                         [% SET fieldstohide = Koha.Preference('CollapseFieldsPatronAddForm') %]
178                         [% IF Koha.Preference('CollapseFieldsPatronAddForm') %][% UNLESS step %]
179                             <p id="selections">
180                                 <input type="checkbox" id="toggle_hidden_fields" title="These fields are collapsed by default by the CollapseFieldsPatronAddForm system preference"><strong>Show collapsed fields:</strong>
181                                 [% FOREACH field IN fieldstohide.split(',') %]
182                                     [% SWITCH field %]
183                                         [% CASE 'identity' %] Organization/Patron identity |
184                                         [% CASE 'guarantor' %] Guarantor information |
185                                         [% CASE 'primary_address' %] Main address |
186                                         [% CASE 'primary_contact' %] Contact information |
187                                         [% CASE 'alt_address' %] Alternate address |
188                                         [% CASE 'alt_contact' %] Alternate contact |
189                                         [% CASE 'lib_mgmt' %] Library management |
190                                         [% CASE 'lib_setup' %] Library setup |
191                                         [% CASE 'login' %] OPAC/Staff login |
192                                         [% CASE 'flags' %] Patron account flags |
193                                         [% CASE 'debarments' %] Patron restrictions |
194                                         [% CASE 'housebound' %] Housebound roles |
195                                         [% CASE 'additional' %] Additional attributes and identifiers |
196                                         [% CASE 'messaging' %] Patron messaging preferences |
197                                     [% END %]
198                                 [% END %]
199                             </p>
200                         [% END %][% END %]
201
202                         [% UNLESS ( check_member ) %]
203                             <div id="toolbar" class="btn-toolbar">
204                                 [% IF quickadd && opadd %]
205                                     <button class="btn btn-default toggler" id="save_quick_add" name="save"><i class="fa fa-save"></i> Save</button>
206                                 [% END %]
207                                 <button class="btn btn-default toggler" id="saverecord" name="save" ><i class="fa fa-save"></i> Save</button>
208                                 [% IF opadd %]
209                                     <a class="btn btn-default" href="/cgi-bin/koha/members/member.pl" class="toggler save_entryform">
210                                 [% ELSE %]
211                                     <a class="btn btn-default" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | html %]">
212                                 [% END %]
213                                     <i class="fa fa-times"></i> Cancel
214                                 </a>
215                             </div>
216                         [% END %]
217
218                         <form name="form" id="entryform" action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class="toggler">
219                             [% UNLESS ( check_member ) %]
220                                 <input type="hidden" name="nodouble"  value="[% nodouble | html %]" />
221                             [% END %]
222                             <!--    field always hidden in different form (1,2,3) -->
223                             <input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField | html %]" />
224                             <input type="hidden" name="category_type" value="[% category_type | html %]" />
225                             <input type="hidden" name="updtype" value="[% updtype | html %]" />
226                             <input type="hidden" name="destination" value="[% destination | html %]" />
227                             <input type="hidden" name="check_member" value="[% check_member | html %]" />
228                             <input type="hidden" name="borrowernumber" value="[% borrowernumber | html UNLESS opduplicate %]" />
229                             <input type="hidden" name="nodouble"  value="[% nodouble | html UNLESS opduplicate %]" />
230                             <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
231                             [% IF ( step ) %]
232                                 <input type="hidden" name="step"  value="[% step | html %]" />
233                             [% END %]
234                             [% IF ( opadd ) %]
235                                 <input type="hidden" name="op" value="insert" />
236                             [% ELSIF ( opduplicate ) %]
237                                 <input type="hidden" name="op" value="insert" />
238                             [% ELSE %]
239                                 <input type="hidden" name="op" value="save" />
240                                 [% IF step == 4 || step == 5 || step == 6 || step == 2 || step == 1 || step == 7 %]
241                                     [%# Only put the cardnumber if we arent showing it in the form later %]
242                                     [% IF cardnumber %]
243                                         <input type="hidden" name="cardnumber" value="[% cardnumber | html %]" />
244                                     [% END %]
245                                 [% END %]
246                             [% END %]
247
248                             [% IF ( step_1 ) %]
249                                 [% UNLESS notitle && nosurname && nofirstname && nodateofbirth && noinitials && noothernames &&nosex %]
250                                     <fieldset class="rows" id="memberentry_identity">
251                                         <legend id="identity_lgd">[% IF ( I ) %]Organization [% ELSE %]Patron [% END %]identity</legend>
252                                         <ol>
253                                             [% UNLESS ( I ) %]
254                                                 [% UNLESS notitle %]
255                                                     [% IF Koha.Preference('BorrowersTitles') %]
256                                                         <li>
257                                                             [% IF ( mandatorytitle ) %]
258                                                                 <label for="btitle" class="required">
259                                                             [% ELSE %]
260                                                                 <label for="btitle">
261                                                             [% END %]
262                                                             Salutation: </label>
263                                                             <select id="btitle" name="title">
264                                                                 <option value=""></option>
265                                                                 [% FOREACH t IN Koha.Preference('BorrowersTitles').split('\|') %]
266                                                                     [% IF btitle == t %]
267                                                                         <option value="[% t | html %]" selected="selected">[% t | html %]</option>
268                                                                     [% ELSE %]
269                                                                         <option value="[% t | html %]">[% t | html %]</option>
270                                                                     [% END %]
271                                                                 [% END %]
272                                                             </select>
273                                                             [% IF ( mandatorytitle ) %]
274                                                                 <span class="required">Required</span>
275                                                             [% END %]
276                                                         </li>
277                                                     [% END # /IF Koha.Preference('BorrowersTitles') %]
278                                                 [% END # /UNLESS notitle %]
279                                             [% END # /UNLESS ( I ) %]
280
281                                             [% UNLESS nosurname %]
282                                                 <li>
283                                                     [% IF ( I ) %]
284                                                         <label for="surname" class="required">
285                                                             Name:
286                                                         </label>
287                                                     [% ELSE %]
288                                                         [% IF ( mandatorysurname ) %]
289                                                             <label for="surname" class="required">
290                                                         [% ELSE %]
291                                                             <label for="surname">
292                                                         [% END %]
293                                                         Surname: </label>
294                                                     [% END %]
295
296                                                     [% IF ( uppercasesurnames ) %]
297                                                         <input style="text-transform:uppercase;" type="text" id="surname" name="surname" size="20"  value="[% surname | html %]" />
298                                                     [% ELSE %]
299                                                         <input type="text" id="surname" name="surname" size="20"  value="[% surname | html %]" />
300                                                     [% END %]
301                                                     [% IF ( mandatorysurname ) %]
302                                                         <span class="required">Required</span>
303                                                     [% END %]
304                                                 </li>
305                                             [% END # /UNLESS nosurname %]
306
307                                             [% UNLESS ( I ) %]
308                                                 [% UNLESS nofirstname %]
309                                                     <li>
310                                                         [% IF ( mandatoryfirstname ) %]
311                                                             <label for="firstname" class="required">
312                                                         [% ELSE %]
313                                                             <label for="firstname">
314                                                         [% END %]
315                                                             First name:
316                                                         </label>
317                                                         <input type="text" id="firstname" name="firstname" size="20"  value="[% firstname | html UNLESS opduplicate %]" />
318                                                         [% IF ( mandatoryfirstname ) %]
319                                                             <span class="required">Required</span>
320                                                         [% END %]
321                                                     </li>
322                                                 [% END #/UNLESS nofirstname %]
323                                                 [% UNLESS nodateofbirth %]
324                                                     <li>
325                                                         [% IF ( mandatorydateofbirth ) %]
326                                                             <label for="dateofbirth" class="required">
327                                                         [% ELSE %]
328                                                             <label for="dateofbirth">
329                                                         [% END %]
330                                                         Date of birth:
331                                                         </label>
332                                                         <input type="text" id="dateofbirth" name="dateofbirth" size="20" value="[% dateofbirth | html UNLESS opduplicate %]" class="datepicker" />
333                                                          [% IF ( mandatorydateofbirth ) %]
334                                                             <span class="required">Required</span>
335                                                         [% END %]
336                                                         [% IF ( ERROR_dateofbirth ) %]
337                                                             <span class="required">(Error)</span>
338                                                         [% END %]
339                                                         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
340                                                     </li>
341                                                 [% END # /UNLESS nodateofbirth %]
342                                                 [% UNLESS noinitials %]
343                                                     <li>
344                                                         [% IF ( mandatoryinitials ) %]
345                                                             <label for="initials" class="required">
346                                                         [% ELSE %]
347                                                             <label for="initials">
348                                                         [% END %]
349                                                             Initials:
350                                                         </label>
351                                                         <input type="text" id="initials" name="initials" size="20"  value="[% initials | html UNLESS opduplicate %]" />
352                                                         [% IF ( mandatoryinitials ) %]
353                                                             <span class="required">Required</span>
354                                                         [% END %]
355                                                     </li>
356                                                 [% END # /UNLESS noinitials %]
357                                             [% END #/UNLESS ( I ) %]
358                                             [% UNLESS noothernames %]
359                                                 <li>
360                                                     [% IF ( mandatoryothernames ) %]
361                                                         <label for="othernames" class="required">
362                                                     [% ELSE %]
363                                                         <label for="othernames">
364                                                     [% END %]
365                                                         Other name:
366                                                     </label>
367                                                     <input type="text" id="othernames" name="othernames" size="20"  value="[% othernames | html UNLESS opduplicate %]" />
368                                                     [% IF ( mandatoryothernames ) %]
369                                                         <span class="required">Required</span>
370                                                     [% END %]
371                                                     [% IF ( I ) %]<input type="hidden" name="sex" value="N" />[% END %]
372                                                 </li>
373                                             [% END #/UNLESS noothernames %]
374
375                                             [% UNLESS ( I ) %]
376                                                 [% UNLESS nosex %]
377                                                     <li class="radio">
378                                                         [% UNLESS ( opduplicate ) %]
379                                                             [% IF ( female ) %]
380                                                                 <label for="sex-female"><input type="radio" name="sex" id="sex-female" value="F" checked="checked" /> Female</label>
381                                                             [% ELSE %]
382                                                                 <label for="sex-female"><input type="radio" name="sex" id="sex-female" value="F" /> Female</label>
383                                                             [% END %]
384                                                             [% IF ( male ) %]
385                                                                 <label for="sex-male"><input type="radio" name="sex" id="sex-male" value="M" checked="checked" /> Male</label>
386                                                             [% ELSE %]
387                                                                 <label for="sex-male"><input type="radio" name="sex" id="sex-male" value="M" /> Male</label>
388                                                             [% END %]
389                                                             [% IF ( none ) %]
390                                                                 <label for="sex-none"><input type="radio" name="sex" id="sex-none" value=""  checked="checked" /> None specified</label>
391                                                             [% ELSE %]
392                                                                 <label for="sex-none"><input type="radio" name="sex" id="sex-none" value="" /> None specified</label>
393                                                             [% END %]
394                                                         [% ELSE %]
395                                                             <label for="sex-female">Female </label><input type="radio" name="sex" id="sex-female" value="F" />
396                                                             <label for="sex-male">Male </label><input type="radio" name="sex" id="sex-male" value="M" />
397                                                             <label for="sex-none">None specified </label><input type="radio" name="sex" id="sex-none" value="" checked="checked" />
398                                                         [% END # /UNLESS ( opduplicate )%]
399                                                     </li>
400                                                 [% END # /UNLESS nosex %]
401                                             [% END # /UNLESS ( I ) %]
402                                         </ol>
403                                     </fieldset> <!-- /#memberentry_identity -->
404                                 [% END # hide fieldset %]
405
406                                 [% IF show_guarantor || guarantor %]
407                                     [% SET possible_relationships = Koha.Preference('borrowerRelationship') %]
408                                     <span id="memberentry_guarantor_anchor">
409                                         <fieldset id="memberentry_guarantor" class="rows">
410                                             <legend>Guarantor information</legend>
411
412                                             <span id="guarantor_relationships">
413                                                 [% FOREACH r IN relationships %]
414                                                     <fieldset class="rows">
415                                                         <ol>
416                                                             [% IF category_type == 'I' %]
417                                                                 <li class="guarantor-details" data-borrowernumber="[% r.guarantor_id | $raw %]">
418                                                                     <span class="label">Organization #:</span> [% IF ( r.guarantor_id ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% r.guarantor_id | uri %]" target="blank">[% r.guarantor_id | html %]</a>[% END %]
419                                                                 </li>
420
421                                                                 <li>
422                                                                     <label for="guarantor_surname">Organization name: </label>
423                                                                     <span>[% r.guarantor.surname | html %]</span>
424                                                                 </li>
425                                                             [% ELSE %]
426                                                                 <li class="guarantor-details" data-borrowernumber="[% r.guarantor_id | $raw %]">
427                                                                     <span class="label">Patron card number:</span>
428                                                                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% r.guarantor_id | uri %]" target="blank">[% r.guarantor.cardnumber | html %]</a>
429                                                                 </li>
430
431                                                                 [% IF r.guarantor.surname %]
432                                                                     <li>
433                                                                         <label for="guarantor_surname">Surname: </label>
434                                                                         <span>[% r.guarantor.surname | html %]</span>
435                                                                     </li>
436                                                                 [% END %]
437
438                                                                 [% IF r.guarantor.firstname %]
439                                                                     <li>
440                                                                         <label for="guarantor_firstname">First name: </label>
441                                                                         <span>[% r.guarantor.firstname | html %]</span>
442                                                                     </li>
443                                                                 [% END %]
444
445                                                                 <li>
446                                                                     <label for="relationship">Relationship: </label>
447                                                                     <span>[% r.relationship | html %]</span>
448                                                                 </li>
449
450                                                                 <li>
451                                                                     <label for="delete_guarantor-[% r.id | uri %]">Remove: </label>
452                                                                     <input type="checkbox" id="delete_guarantor-[% r.id | uri %]" name="delete_guarantor" value="[% r.id | html %]" />
453                                                                 </li>
454                                                             [% END %]
455                                                         </ol>
456                                                     </fieldset>
457                                                 [% END # END relationships foreach %]
458                                                 [% IF guarantor && (!relationships) %]
459                                                     <fieldset class="rows">
460                                                         <ol>
461                                                             <li class="guarantor-details" data-borrowernumber="0">
462                                                                 <span class="label">Patron card number:</span>
463                                                                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.borrowernumber | uri %]" target="blank">[% guarantor.cardnumber | html %]</a>
464                                                                 <input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value="[% guarantor.borrowernumber | html %]"/>
465                                                             </li>
466
467                                                             <li>
468                                                                 <label for="guarantor_surname">Surname: </label>
469                                                                 <span class="new_guarantor_surname_text">[% guarantor.surname | html %]</span>
470                                                             </li>
471
472                                                             <li>
473                                                                 <label for="guarantor_firstname">First name: </label>
474                                                                 <span class="new_guarantor_firstname_text">[% guarantor.firstname | html %]</span>
475                                                             </li>
476
477                                                             <li>
478                                                                 <label for="guarantor_relationship">Relationship: </label>
479                                                                 <select class="new_guarantor_relationship" name="new_guarantor_relationship">
480                                                                     [% FOREACH pr IN possible_relationships.split('\|') %]
481                                                                         <option value="[% pr | html %]">[% pr | html %]</option>
482                                                                     [% END %]
483                                                                 </select>
484                                                             </li>
485
486                                                             <li>
487                                                                 <label for="guarantor_cancel">&nbsp;</label>
488                                                                 <span><a href="#" class="guarantor_cancel">Remove</a></span>
489                                                             </li>
490                                                         </ol>
491                                                     </fieldset>
492                                                 [% END %]
493                                             </span> <!-- #/guarantor_relationships -->
494
495                                             <fieldset class="rows guarantor" id="guarantor_template">
496                                                 <ol>
497                                                     <li class="guarantor-details" data-borrowernumber="0">
498                                                         <span class="label">Patron card number:</span>
499                                                         <span class="new_guarantor_id_text"></span>
500                                                         <input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value=""/>
501                                                     </li>
502
503                                                     <li>
504                                                         <label for="guarantor_surname">Surname: </label>
505                                                         <span class="new_guarantor_surname_text"></span>
506                                                     </li>
507
508                                                     <li>
509                                                         <label for="guarantor_firstname">First name: </label>
510                                                         <span class="new_guarantor_firstname_text"></span>
511                                                     </li>
512
513                                                     <li>
514                                                         <label for="guarantor_relationship">Relationship: </label>
515                                                         <select class="new_guarantor_relationship" name="new_guarantor_relationship">
516                                                             [% FOREACH pr IN possible_relationships.split('\|') %]
517                                                                 <option value="[% pr | html %]">[% pr | html %]</option>
518                                                             [% END %]
519                                                         </select>
520                                                     </li>
521
522                                                     <li>
523                                                         <label for="guarantor_cancel">&nbsp;</label>
524                                                         <span><a href="#" class="guarantor_cancel">Remove</a></span>
525                                                     </li>
526                                                 </ol>
527                                             </fieldset>
528
529                                             <ol>
530                                                 <input type="hidden" id="guarantor_id" value="" />
531                                                 <input name="guarantor_surname" id="guarantor_surname" type="hidden" />
532                                                 <input name="guarantor_firstname" id="guarantor_firstname" type="hidden" />
533
534                                                 <li>
535                                                     <a href="#" id="guarantor_search" class="btn btn-default"><i class="fa fa-plus"></i> Search to add</a>
536                                                 </li>
537
538                                                 [% IF relationships && Koha.Preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') %]
539                                                     <li>
540                                                         <label for="privacy_guarantor_checkouts">Show checkouts to guarantors</label>
541                                                         <select name="privacy_guarantor_checkouts" id="privacy_guarantor_checkouts">
542                                                             [% IF privacy_guarantor_checkouts %]
543                                                                 <option value="0">No</option>
544                                                                 <option value="1" selected>Yes</option>
545                                                             [% ELSE %]
546                                                                 <option value="0" selected>No</option>
547                                                                 <option value="1">Yes</option>
548                                                             [% END %]
549                                                         </select>
550                                                         <div class="hint">Allow guarantors of this patron to view this patron's checkouts from the OPAC</div>
551                                                     </li>
552                                                 [% END %]
553                                                 [% IF relationships && Koha.Preference('AllowStaffToSetFinesVisibilityForGuarantor') %]
554                                                     <li>
555                                                         <label for="privacy_guarantor_fines">Show fines to guarantors</label>
556                                                         <select name="privacy_guarantor_fines" id="privacy_guarantor_fines">
557                                                             [% IF privacy_guarantor_fines %]
558                                                                 <option value="0">No</option>
559                                                                 <option value="1" selected>Yes</option>
560                                                             [% ELSE %]
561                                                                 <option value="0" selected>No</option>
562                                                                 <option value="1">Yes</option>
563                                                             [% END %]
564                                                         </select>
565                                                         <div class="hint">Allow guarantors of this patron to view this patron's fines from the OPAC</div>
566                                                     </li>
567                                                 [% END %]
568                                             </ol>
569                                         </fieldset> <!-- /#memberentry_guarantor -->
570                                     </span> <!-- #/memberentry_guarantor_anchor -->
571                                 [% END # /IF show_guarantor || guarantor  %]
572
573                                 [% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %]
574                                     [% IF Koha.Preference( 'AddressFormat' ) %]
575                                         [% INCLUDE "member-main-address-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %]
576                                     [% ELSE %]
577                                         [% INCLUDE 'member-main-address-style-us.inc' %]
578                                     [% END %]
579                                 [% END # /UNLESS nostreet && nocity etc group%]
580
581                                 [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
582                                     <fieldset class="rows" id="memberentry_contact">
583                                         <legend id="contact_lgd">Contact</legend>
584                                         <ol>
585                                             [% UNLESS nocontactname %]
586                                                 <li>
587                                                     [% IF ( mandatorycontactname ) %]
588                                                         <label for="contactname" class="required">
589                                                     [% ELSE %]
590                                                         <label for="contactname">
591                                                     [% END %]
592                                                         Guarantor surname:
593                                                     </label>
594                                                     <input type="text" id="contactname" name="contactname" value="[% patron.contactname | html %]" />
595                                                     [% IF ( mandatorycontactname ) %]
596                                                         <span class="required">Required</span>
597                                                     [% END %]
598                                                     <div class="hint">Non-patron guarantor surname</div>
599                                                 </li>
600                                             [% END # /UNLESS nocontactname %]
601
602                                             [% UNLESS nocontactfirstname %]
603                                                 <li>
604                                                     [% IF ( mandatorycontactfirstname ) %]
605                                                         <label for="contactfirstname" class="required">
606                                                     [% ELSE %]
607                                                         <label for="contactfirstname">
608                                                     [% END %]
609                                                         Guarantor first name:
610                                                     </label>
611                                                     <input type="text" id="contactfirstname" name="contactfirstname" value="[% patron.contactfirstname | html %]" />
612                                                     [% IF ( mandatorycontactfirstname ) %]
613                                                         <span class="required">Required</span>
614                                                     [% END %]
615                                                     <div class="hint">Non-patron guarantor first name</div>
616                                                 </li>
617                                             [% END # /UNLESS noaltcontactfirstname %]
618
619                                             [% UNLESS norelationship %]
620                                                 [% IF possible_relationships %]
621                                                     <li>
622                                                         <label for="relationship">Relationship: </label>
623                                                         <select class="relationship" name="relationship">
624                                                             <option value=""></option>
625                                                             [% FOREACH pr IN possible_relationships.split('\|') %]
626                                                                 [% IF pr == relationship %]
627                                                                     <option value="[% pr | html %]" selected="selected">[% pr | html %]</option>
628                                                                 [% ELSE %]
629                                                                     <option value="[% pr | html %]">[% pr | html %]</option>
630                                                                 [% END %]
631                                                             [% END %]
632                                                         </select>
633                                                     </li>
634                                                 [% END #/IF possible_relationships %]
635                                             [% END # /UNLESS norelationship %]
636
637                                             [% UNLESS nophone %]
638                                                 <li>
639                                                     [% IF ( mandatoryphone ) %]
640                                                         <label for="phone" class="required">
641                                                     [% ELSE %]
642                                                         <label for="phone">
643                                                     [% END %]
644                                                         Primary phone:
645                                                     </label>
646                                                     <input type="text" id="phone" name="phone" value="[% patron.phone | html %]" />
647                                                     [% IF ( mandatoryphone ) %]
648                                                         <span class="required">Required</span>
649                                                     [% END %]
650                                                     <div class="hint">Shows on transit slips</div>
651                                                 </li>
652                                             [% END # /UNLESS nophone %]
653
654                                             [% UNLESS nophonepro %]
655                                                 <li>
656                                                     [% IF ( mandatoryphonepro ) %]
657                                                         <label for="phonepro" class="required">
658                                                     [% ELSE %]
659                                                         <label for="phonepro">
660                                                     [% END %]
661                                                         Secondary phone:
662                                                     </label>
663                                                     <input type="text" id="phonepro" name="phonepro" value="[% patron.phonepro | html %]" />
664                                                     [% IF ( mandatoryphonepro ) %]
665                                                         <span class="required">Required</span>
666                                                     [% END %]
667                                                 </li>
668                                             [% END # /UNLESS nophonepro %]
669
670                                             [% UNLESS nomobile %]
671                                                 <li>
672                                                     [% IF ( mandatorymobile ) %]
673                                                         <label for="mobile" class="required">
674                                                     [% ELSE %]
675                                                         <label for="mobile">
676                                                     [% END %]
677                                                         Other phone:
678                                                     </label>
679                                                     <input type="text" id="mobile" name="mobile" value="[% patron.mobile | html %]" />
680                                                     [% IF ( mandatorymobile ) %]
681                                                         <span class="required">Required</span>
682                                                     [% END %]
683                                                 </li>
684                                             [% END # /UNLESS nomobile %]
685
686                                             [% UNLESS noemail %]
687                                                 <li>
688                                                     [% IF ( mandatoryemail ) %]
689                                                         <label for="email" class="required">
690                                                     [% ELSE %]
691                                                         <label for="email">
692                                                     [% END %]
693                                                         Primary email:
694                                                     </label>
695                                                     <input type="text" id="email" name="email" size="45" value="[% patron.email | html %]" />
696                                                     [% IF ( mandatoryemail ) %]
697                                                         <span class="required">Required</span>
698                                                     [% END %]
699                                                     <div class="hint">Shows on transit slips</div>
700                                                 </li>
701                                             [% END #/UNLESS noemail %]
702
703                                             [% UNLESS noemailpro %]
704                                                 <li>
705                                                     [% IF ( mandatoryemailpro ) %]
706                                                         <label for="emailpro" class="required">
707                                                     [% ELSE %]
708                                                         <label for="emailpro">
709                                                     [% END %]
710                                                         Secondary email:
711                                                     </label>
712                                                     <input type="text" id="emailpro" name="emailpro" size="45" value="[% patron.emailpro | html %]" />
713                                                     [% IF ( mandatoryemailpro ) %]
714                                                         <span class="required">Required</span>
715                                                     [% END %]
716                                                 </li>
717                                             [% END # /UNLESS noemailpro %]
718
719                                             [% UNLESS nofax %]
720                                                 <li>
721                                                     [% IF ( mandatoryfax ) %]
722                                                         <label for="fax" class="required">
723                                                     [% ELSE %]
724                                                         <label for="fax">
725                                                     [% END %]
726                                                         Fax:
727                                                     </label>
728                                                     <input type="text" id="fax" name="fax" value="[% patron.fax | html %]" />
729                                                     [% IF ( mandatoryfax ) %]
730                                                         <span class="required">Required</span>
731                                                     [% END %]
732                                                 </li>
733                                             [% END #/UNLESS nofax %]
734                                         </ol>
735                                     </fieldset> <!-- /#memberentry_contact -->
736                                 [% END # hide fieldset %]
737
738                                 <!-- ************************ STEP_1 *********************** -->
739                             [% END # /IF ( step_1 ) %]
740
741                             [% IF ( step_6 ) %]
742                                 [% UNLESS noB_address && noB_address2 && noB_city && noB_zipcode && noB_state && noB_country &&nocontactnote && noB_phone && noB_email %]
743                                     [% PROCESS 'alt-address-style' %]
744                                 [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %]
745                             [% END # /IF ( step_6 ) %]
746
747                             [% IF ( step_2 ) %]
748                                 [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactaddress2 && noaltcontactaddress3 && noaltcontactstate && noaltcontactzipcode && noaltcontactcountry && noaltcontactphone %]
749                                     [% IF Koha.Preference( 'AddressFormat' ) %]
750                                         [% INCLUDE "member-alt-contact-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %]
751                                     [% ELSE %]
752                                         [% INCLUDE 'member-alt-contact-style-us.inc' %]
753                                     [% END %]
754                                 [% END # UNLESS noaltcontactsurname && noaltcontactfirstname etc %]
755                             [% END # /IF ( step_2 ) %]
756
757                             [% IF ( step_3 ) %]
758                                 [% SET autoMemberNum = Koha.Preference('autoMemberNum') %]
759                                 <fieldset class="rows" id="memberentry_library_management">
760                                     <legend id="library_management_lgd">Library management</legend>
761                                     <ol>
762                                         [% UNLESS nocardnumber %]
763                                             <li>
764                                                 [% IF mandatorycardnumber %]
765                                                     <label for="cardnumber" class="required">
766                                                 [% ELSE %]
767                                                     <label for="cardnumber" class="validated">
768                                                 [% END %]
769                                                     Card number:
770                                                 </label>
771
772                                                 <!-- NOTE: div.hint closing tag isn't on the same line -->
773                                                 [% IF minlength_cardnumber == maxlength_cardnumber %]
774                                                     <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" minlength="[% minlength_cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
775                                                     [% IF mandatorycardnumber %]
776                                                         <span class="required">Required</span>
777                                                     [% END %]
778                                                     <span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber | html %] characters.</span>
779                                                     <div class="hint">Card number must be exactly [% minlength_cardnumber | html %] characters.
780                                                 [% ELSIF minlength_cardnumber && maxlength_cardnumber %]
781                                                     <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" minlength="[% minlength_cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
782                                                     [% IF mandatorycardnumber %]
783                                                         <span class="required">Required</span>
784                                                     [% END %]
785                                                     <span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber | html %] characters.</span>
786                                                     <div class="hint">Card number must be between [% minlength_cardnumber | html %] and [% maxlength_cardnumber | html %] characters.
787                                                 [% ELSIF maxlength_cardnumber %]
788                                                     <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
789                                                     [% IF mandatorycardnumber %]
790                                                         <span class="required">Required</span>
791                                                     [% END %]
792                                                     <span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber | html %] characters.</span>
793                                                     <div class="hint">Card number can be up to [% maxlength_cardnumber | html %] characters.
794                                                 [% ELSE %]
795                                                     <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" />
796                                                     [% IF mandatorycardnumber %]
797                                                         <span class="required">Required</span>
798                                                     [% END %]
799                                                     <div class="hint">There is no minimum or maximum character length.
800                                                 [% END %]
801                                                 [% IF autoMemberNum %]
802                                                     [% IF mandatorycardnumber %]
803                                                         <br/><span class="error">AutoMemberNum is set to enabled, but cardnumber is marked as mandatory in BorrowerMandatoryField: auto calc has been disabled.</span>
804                                                     [% ELSE %]
805                                                         <br/>Leave blank for auto calc during registration
806                                                     [% END %]
807                                                 [% END %]
808                                                 </div><!--/div.hint -->
809                                             </li>
810                                         [% END # /UNLESS nocardnumber %]
811
812                                         [% UNLESS nobranchcode %]
813                                             <li>
814                                                 <label for="libraries" class="required">Library:</label>
815                                                 <select name="branchcode" size="1" id="libraries">
816                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => userbranch, only_from_group => 1 ) %]
817                                                 </select>
818                                                 <span class="required">Required</span>
819                                             </li>
820                                         [% END %]
821
822                                         <li>
823                                             <label for="categorycode_entry" class="required">Category: </label>
824                                             <select id="categorycode_entry" name="categorycode">
825                                                 [% FOREACH typeloo IN typeloop %]
826                                                     [% FOREACH categoryloo IN typeloo.categoryloop %]
827                                                         [% IF ( loop.first ) %]
828                                                             [% IF ( typeloo.typename_C ) %]<optgroup label="Child">[% END %]
829                                                             [% IF ( typeloo.typename_A ) %]<optgroup label="Adult">[% END %]
830                                                             [% IF ( typeloo.typename_S ) %]<optgroup label="Staff">[% END %]
831                                                             [% IF ( typeloo.typename_I ) %]<optgroup label="Organization">[% END %]
832                                                             [% IF ( typeloo.typename_P ) %]<optgroup label="Professional">[% END %]
833                                                             [% IF ( typeloo.typename_X ) %]<optgroup label="Statistical">[% END %]
834                                                         [% END %]
835                                                         [% IF ( categoryloo.categorycodeselected ) %]
836                                                             <option value="[% categoryloo.categorycode | html %]" selected="selected" data-typename="[% typeloo.typename | html %]">[% categoryloo.categoryname | html %]</option>
837                                                         [% ELSE %]
838                                                             <option value="[% categoryloo.categorycode | html %]" data-typename="[% typeloo.typename | html %]">[% categoryloo.categoryname | html %]</option>
839                                                         [% END %]
840                                                         [% IF ( loop.last ) %]
841                                                             </optgroup>
842                                                         [% END %]
843                                                     [% END # /FOREACH categoryloo %]
844                                                 [% END # /FOREACH typeloo %]
845                                             </select>
846                                             <span class="required">Required</span>
847                                         </li>
848
849                                         [% UNLESS nosort1 %]
850                                             <li>
851                                                 [% IF ( mandatorysort1 ) %]
852                                                     <label for="sort1" class="required">
853                                                 [% ELSE %]
854                                                     <label for="sort1">
855                                                 [% END %]
856                                                     Sort 1:
857                                                 </label>
858                                                 [% PROCESS 'av-build-dropbox.inc' name="sort1", category="Bsort1", default=sort1, empty=1, size = 20 %]
859                                                 [% IF ( mandatorysort1 ) %]
860                                                     <span class="required">Required</span>
861                                                 [% END %]
862                                             </li>
863                                         [% END # /UNLESS nosort1 %]
864
865                                         [% UNLESS nosort2 %]
866                                             <li>
867                                                 [% IF ( mandatorysort2 ) %]
868                                                     <label for="sort2" class="required">
869                                                 [% ELSE %]
870                                                     <label for="sort2">
871                                                 [% END %]
872                                                     Sort 2:
873                                                 </label>
874                                                 [% PROCESS 'av-build-dropbox.inc' name="sort2", category="Bsort2", default=sort2, empty=1, size = 20 %]
875                                                 [% IF ( mandatorysort2 ) %]
876                                                     <span class="required">Required</span>
877                                                 [% END %]
878                                             </li>
879                                         [% END # /UNLESS nosort2 %]
880
881                                         [% UNLESS noautorenew_checkouts %]
882                                             <li class="radio">
883                                                 <label for="yes-autorenew_checkouts">
884                                                     Allow auto-renewal of items:
885                                                 </label>
886                                                     [% IF ( autorenew_checkouts || opadd ) %]
887                                                         <label for="yes-autorenew_checkouts">
888                                                             Yes
889                                                             <input type="radio" id="yes-autorenew_checkouts" name="autorenew_checkouts" value="1" checked="checked" />
890                                                         </label>
891                                                         <label for="no-autorenew_checkouts">
892                                                             No
893                                                             <input type="radio" id="no-autorenew_checkouts" name="autorenew_checkouts" value="0" />
894                                                         </label>
895                                                     [% ELSE %]
896                                                         <label for="yes-autorenew_checkouts">
897                                                             Yes
898                                                             <input type="radio" id="yes-autorenew_checkouts" name="autorenew_checkouts" value="1" />
899                                                         </label>
900                                                         <label for="no-autorenew_checkouts">
901                                                             No
902                                                             <input type="radio" id="no-autorenew_checkouts" name="autorenew_checkouts" value="0" checked="checked" />
903                                                         </label>
904                                                     [% END %]
905                                             </li>
906                                         [% END %]
907
908                                         [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
909                                             <li>
910                                                 <label for="checkprevcheckout">Check for previous checkouts: </label>
911                                                 <select name="checkprevcheckout" id="checkprevcheckout">
912                                                     [% IF ( checkprevcheckout == 'yes' ) %]
913                                                         <option value="yes" selected="selected">Yes if settings allow it</option>
914                                                         <option value="no">No if settings allow it</option>
915                                                         <option value="inherit">Inherit from settings</option>
916                                                     [% ELSIF ( checkprevcheckout == 'no' ) %]
917                                                         <option value="yes">Yes if settings allow it</option>
918                                                         <option value="no" selected="selected">No if settings allow it</option>
919                                                         <option value="inherit">Inherit from settings</option>
920                                                     [% ELSE %]
921                                                         <option value="yes">Yes if settings allow it</option>
922                                                         <option value="no">No if settings allow it</option>
923                                                         <option value="inherit" selected="selected">Inherit from settings</option>
924                                                     [% END %]
925                                                 </select>
926                                             </li>
927                                         [% END # /IF ( Koha.Preference('CheckPrevCheckout') %]
928
929                                         [% IF Koha.Preference('TranslateNotices') %]
930                                             <li>
931                                                 <label for="lang">Preferred language for notices: </label>
932                                                 <select id="lang" name="lang">
933                                                     <option value="default">Default</option>
934                                                     [% FOR language IN languages %]
935                                                         [% FOR sublanguage IN language.sublanguages_loop %]
936                                                             [% IF language.plural %]
937                                                                 [% IF sublanguage.rfc4646_subtag == lang %]
938                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
939                                                                 [% ELSE %]
940                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
941                                                                 [% END %]
942                                                             [% ELSE %]
943                                                                 [% IF sublanguage.rfc4646_subtag == lang %]
944                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
945                                                                 [% ELSE %]
946                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
947                                                                 [% END %]
948                                                             [% END # /IF language.plural %]
949                                                         [% END # /FOR sublanguage %]
950                                                     [% END #/FOR language %]
951                                                 </select> <!-- /#lang -->
952                                             </li>
953                                         [% END #/IF Koha.Preference('TranslateNotices') %]
954                                     </ol>
955                                 </fieldset> <!-- /#memberentry_library_management -->
956
957                                 [% UNLESS nodateenrolled &&  noopacnote && noborrowernotes %]
958                                     <fieldset class="rows" id="memberentry_subscription">
959                                         <legend id="library_setup_lgd">Library set-up</legend><ol>
960                                         [% UNLESS nodateenrolled %]
961                                             <li>
962                                                 [% IF ( mandatorydateenrolled ) %]
963                                                     <label for="from" class="required">
964                                                 [% ELSE %]
965                                                     <label for="from">
966                                                 [% END %]
967                                                     Registration date:
968                                                 </label>
969                                                 <input type="text" id="from" name="dateenrolled"  maxlength="10" size="10" value="[% dateenrolled | html %]" class="datepickerfrom" />
970                                                 [% IF ( mandatorydateenrolled ) %]
971                                                     <span class="required">Required</span>
972                                                 [% END %]
973                                                 [% IF ( ERROR_dateenrolled ) %]
974                                                     <span class="required">(Error)</span>
975                                                 [% END %]
976                                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
977                                             </li>
978                                         [% END # /UNLESS nodateenrolled %]
979
980                                         [% UNLESS nodateexpiry %]
981                                             <li>
982                                         [% ELSE %]
983                                             <li style="display:none">
984                                         [% END %]
985                                             [% IF ( mandatorydateexpiry ) %]
986                                                 <label for="to" class="required">
987                                             [% ELSE %]
988                                                 <label for="to">
989                                             [% END %]
990                                                     Expiry date (leave blank for auto calc):
991                                                 </label>
992                                                 [% UNLESS ( opadd ) %]
993                                                     <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% dateexpiry | html UNLESS opduplicate %]" class="datepickerto" />
994                                                 [% ELSE %]
995                                                     <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% dateexpiry | html %]" class="datepickerto" />
996                                                 [% END %]
997                                                 [% IF ( mandatorydateexpiry ) %]
998                                                     <span class="required">Required</span>
999                                                 [% END %]
1000                                                 [% IF ( ERROR_dateexpiry ) %]
1001                                                     <span class="required">(Error)</span>
1002                                                 [% END %]
1003                                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1004                                             </li>
1005
1006                                             [% UNLESS noopacnote %]
1007                                                 <li>
1008                                                     [% IF ( mandatoryopacnote ) %]
1009                                                         <label for="opacnote" class="required">
1010                                                     [% ELSE %]
1011                                                         <label for="opacnote">
1012                                                     [% END %]
1013                                                         OPAC note:
1014                                                     </label>
1015                                                     <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% opacnote | html UNLESS opduplicate %]</textarea>
1016                                                     <div class="hint">This message appears on this patron's user page in the OPAC</div>
1017                                                     [% IF ( mandatoryopacnote ) %]
1018                                                         <span class="required">Required</span>
1019                                                     [% END %]
1020                                                 </li>
1021                                             [% END # /UNLESS noopacnote %]
1022
1023                                             [% UNLESS noborrowernotes %]
1024                                                 <li>
1025                                                     [% IF ( mandatoryborrowernotes ) %]
1026                                                         <label for="borrowernotes" class="required">
1027                                                     [% ELSE %]
1028                                                         <label for="borrowernotes">
1029                                                     [% END %]
1030                                                         Circulation note:
1031                                                     </label>
1032                                                     <textarea id="borrowernotes" name="borrowernotes" cols="55" rows="5">[% borrowernotes | html UNLESS opduplicate %]</textarea>
1033                                                     <div class="hint">This message displays when checking out to this patron</div>
1034                                                     [% IF ( mandatoryborrowernotes ) %]
1035                                                         <span class="required">Required</span>
1036                                                     [% END %]
1037                                                 </li>
1038                                             [% END # /UNLESS noborrowernotes %]
1039                                         </ol>
1040                                     </fieldset> <!-- /#memberentry_subscription -->
1041                                 [% END # hide fieldset %]
1042
1043                                 [% UNLESS nouserid && nopassword %]
1044                                     <fieldset class="rows" id="memberentry_userid">
1045                                         <legend id="opac_staff_login_lgd">OPAC/Staff login</legend>
1046                                         <ol>
1047                                             [% UNLESS nouserid %]
1048                                                 <li>
1049                                                     [% IF ( mandatoryuserid ) %]
1050                                                         <label for="userid" class="required">
1051                                                     [% ELSE %]
1052                                                         <label for="userid">
1053                                                     [% END %]
1054                                                         Username:
1055                                                     </label>
1056
1057                                                     [% IF ( NoUpdateLogin ) %]
1058                                                         [% IF ( opduplicate ) %]
1059                                                             <input type="text" id="userid" name="userid" size="20" disabled="disabled" />
1060                                                         [% ELSE %]
1061                                                             <input type="text" id="userid" name="userid" size="20" disabled="disabled" value="[% userid | html %]" />
1062                                                         [% END %]
1063                                                     [% ELSE %]
1064                                                         [% IF ( opduplicate ) %]
1065                                                             <input type="text" id="userid" name="userid" size="20" value="" />
1066                                                         [% ELSE %]
1067                                                             <input type="text" id="userid" name="userid" size="20" value="[% userid | html %]" />
1068                                                         [% END %]
1069                                                     [% END # /IF ( NoUpdateLogin ) %]
1070
1071                                                     [%# Dummy input to avoid Firefox from using userid/password saved for authentication %]
1072                                                     <input type="text" disabled="disabled" style="display:none" />
1073
1074                                                     [% IF ( mandatoryuserid ) %]
1075                                                         <span class="required">Required</span>
1076                                                     [% END %]
1077                                                 </li>
1078                                             [% END # /UNLESS nouserid %]
1079
1080                                             [% UNLESS nopassword %]
1081                                                 <li>
1082                                                     [% IF ( mandatorypassword ) %]
1083                                                         <label for="password" class="required">
1084                                                     [% ELSE %]
1085                                                         <label for="password">
1086                                                     [% END %]
1087                                                         Password:
1088                                                     </label>
1089                                                     [% IF ( opadd ) %]
1090                                                         [% IF ( NoUpdateLogin ) %]
1091                                                             [% IF ( opduplicate ) %]
1092                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" />
1093                                                             [% ELSE %]
1094                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" value="[% password | html %]" />
1095                                                             [% END %]
1096                                                         [% ELSE %]
1097                                                             [% IF ( opduplicate ) %]
1098                                                                 <input type="password" id="password" name="password" size="20" />
1099                                                             [% ELSE %]
1100                                                                 <input type="password" id="password" name="password" size="20" value="[% password | html %]" />
1101                                                             [% END %]
1102                                                         [% END # /IF ( NoUpdateLogin ) %]
1103                                                     [% ELSE # IF ( opadd ) %]
1104
1105                                                         [% IF ( password ) %]
1106                                                             [% IF ( NoUpdateLogin ) %]
1107                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" value="****" />
1108                                                             [% ELSE %]
1109                                                                 [% IF ( opduplicate ) %]
1110                                                                     <input type="password" id="password" name="password" size="20" />
1111                                                                 [% ELSE %]
1112                                                                     <input type="password" id="password" name="password" size="20" value="****" />
1113                                                                 [% END %]
1114                                                             [% END %]
1115                                                         [% ELSE %]
1116                                                             [% IF ( NoUpdateLogin ) %]
1117                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" value="" />
1118                                                             [% ELSE %]
1119                                                                 <input type="password" id="password" name="password" size="20" value="" />
1120                                                             [% END %]
1121                                                         [% END # /IF ( password ) %]
1122                                                     [% END # /IF ( opadd )  %]
1123                                                     [% IF ( mandatorypassword ) %]
1124                                                         <span class="required">Required</span>
1125                                                     [% END %]
1126                                                     [% IF ( ERROR_password_too_short ) %]
1127                                                         <span class="required">Password is too short</span>
1128                                                     [% END %]
1129                                                     [% IF ( ERROR_password_too_weak ) %]
1130                                                         <span class="required">Password is too weak</span>
1131                                                     [% END %]
1132                                                     [% IF ( ERROR_password_has_whitespaces ) %]
1133                                                         <span class="required">Password has leading or trailing whitespaces</span>
1134                                                     [% END %]
1135                                                     <div class="hint">Minimum password length: [% minPasswordLength | html %]</div>
1136                                                 </li>
1137
1138                                                 <li>
1139                                                     [% IF ( mandatorypassword ) %]
1140                                                         <label for="password2" class="required">
1141                                                     [% ELSE %]
1142                                                         <label for="password2">
1143                                                     [% END %]
1144                                                         Confirm password:
1145                                                     </label>
1146                                                     [% IF ( opadd ) %]
1147                                                         [% IF ( NoUpdateLogin ) %]
1148                                                             [% IF ( opduplicate ) %]
1149                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" />
1150                                                             [% ELSE %]
1151                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="[% password | html %]" />
1152                                                             [% END %]
1153                                                         [% ELSE %]
1154                                                             [% IF ( opduplicate ) %]
1155                                                                 <input type="password" id="password2" name="password2" size="20" />
1156                                                             [% ELSE %]
1157                                                                 <input type="password" id="password2" name="password2" size="20" value="[% password | html %]" />
1158                                                             [% END %]
1159                                                         [% END %]
1160                                                     [% ELSE # IF ( opadd ) %]
1161                                                         [% IF ( password ) %]
1162                                                             [% IF ( NoUpdateLogin ) %]
1163                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="****" />
1164                                                             [% ELSE %]
1165                                                                 [% IF ( opduplicate ) %]
1166                                                                     <input type="password" id="password2" name="password2" size="20" />
1167                                                                 [% ELSE %]
1168                                                                     <input type="password" id="password2" name="password2" size="20" value="****" />
1169                                                                 [% END %]
1170                                                             [% END %]
1171                                                         [% ELSE %]
1172                                                             [% IF ( NoUpdateLogin ) %]
1173                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="" />
1174                                                             [% ELSE %]
1175                                                                 <input type="password" id="password2" name="password2" size="20" value="" />
1176                                                             [% END %]
1177                                                         [% END %]
1178                                                     [% END # /IF ( opadd ) %]
1179
1180                                                     [% IF ( mandatorypassword ) %]
1181                                                         <span class="required">Required</span>
1182                                                     [% END %]
1183                                                     [% IF ( ERROR_password_mismatch ) %]
1184                                                         <span class="required">Passwords do not match</span>
1185                                                     [% END %]
1186                                                 </li>
1187                                             [% END # /UNLESS nopassword %]
1188                                         </ol>
1189                                     </fieldset> <!-- /#memberentry_userid -->
1190                                 [% END # UNLESS nouserid && nopassword %]
1191
1192                                 <!--this zones are not necessary in modif mode -->
1193                                 [% UNLESS ( opadd || opduplicate ) %]
1194                                     <fieldset class="rows" id="memberentry_account_flags">
1195                                         <legend id="account_flags_lgd">Patron account flags</legend>
1196                                         <ol class="radio">
1197                                             [% FOREACH flagloo IN flagloop %]
1198                                                 <li>
1199                                                     <label class="radio" for="yes[% flagloo.name | html %]">
1200                                                         [% IF ( flagloo.key == 'gonenoaddress' ) %]Gone no address:[% END %]
1201                                                         [% IF ( flagloo.key == 'lost' ) %]Lost card:[% END %]
1202                                                     </label>
1203                                                     [% IF CAN_user_circulate_manage_restrictions %]
1204                                                         <label for="yes[% flagloo.name | html %]">
1205                                                             [% IF ( flagloo.yes ) %]
1206                                                                 <input type="radio" id="yes[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="1" checked="checked" />
1207                                                             [% ELSE %]
1208                                                                 <input type="radio" id="yes[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="1" />
1209                                                             [% END %]
1210                                                                 Yes
1211                                                         </label>
1212                                                         <label for="no[% flagloo.name | html %]">
1213                                                             [% IF ( flagloo.no ) %]
1214                                                                 <input type="radio" id="no[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="0" checked="checked"/>
1215                                                             [% ELSE %]
1216                                                                 <input type="radio" id="no[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="0" />
1217                                                             [% END %]
1218                                                                 No
1219                                                         </label>
1220                                                     [% ELSE %]
1221                                                         [% IF flagloo.yes %]Yes[% ELSE %]No[% END %]
1222                                                     [% END # /IF CAN_user_circulate_manage_restrictions %]
1223                                                 </li>
1224                                             [% END # /FOREACH flagloo %]
1225                                         </ol>
1226                                     </fieldset> <!-- /#memberentry_account_flags -->
1227
1228                                     <fieldset class="rows" id="memberentry_restrictions">
1229                                         <legend id="restrictions_lgd">Patron restrictions</legend>
1230                                         [% IF ( debarments ) %]
1231                                             <table>
1232                                                 <thead>
1233                                                     <tr>
1234                                                          <th>Type</th>
1235                                                          <th>Comment</th>
1236                                                          <th>Expiration</th>
1237                                                          <th>[% tp('patron restriction created on', 'Created') | html %]</th>
1238                                                          [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1239                                                            <th>Remove?</th>
1240                                                          [% END %]
1241                                                     </tr>
1242                                                 </thead>
1243                                                 <tbody>
1244                                                     [% FOREACH d IN debarments %]
1245                                                         <tr>
1246                                                             <td>[% d.type | html %]</td>
1247                                                             <td>
1248                                                                 [% IF d.comment.search('OVERDUES_PROCESS') %]
1249                                                                     Restriction added by overdues process [% d.comment.remove('OVERDUES_PROCESS ') | $raw %]
1250                                                                 [% ELSE %]
1251                                                                     [% d.comment | $raw %]
1252                                                                 [% END %]
1253                                                             </td>
1254                                                             <td>
1255                                                                 [% IF d.expiration %]
1256                                                                     [% d.expiration | $KohaDates %]
1257                                                                 [% ELSE %]
1258                                                                     <i>Indefinite</i>
1259                                                                 [% END %]
1260                                                             </td>
1261                                                             <td>[% d.created | $KohaDates %]</td>
1262                                                             [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1263                                                                 <td>
1264                                                                     <input type="checkbox" id="debarment_[% d.borrower_debarment_id | html %]" name="remove_debarment" value="[% d.borrower_debarment_id | html %]" />
1265                                                                 </td>
1266                                                             [% END %]
1267                                                         </tr>
1268                                                     [% END # /FOREACH d %]
1269                                                 </tbody>
1270                                             </table>
1271                                         [% ELSE %]
1272                                             <p>Patron is currently unrestricted.</p>
1273                                         [% END # /IF ( debarments ) %]
1274
1275                                         [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1276                                             <p><a href="#" id="add_manual_restriction">Add manual restriction</a></p>
1277                                             <fieldset id="manual_restriction_form">
1278                                                 <input type="hidden" id="add_debarment" name="add_debarment" value="0" />
1279                                                 <legend id="manual_restriction_lgd">Add manual restriction</legend>
1280                                                 <ol>
1281                                                     <li>
1282                                                         <label for="debarred_comment">Comment: </label>
1283                                                         <input type="text" id="debarred_comment" name="debarred_comment" />
1284                                                     </li>
1285                                                     <li>
1286                                                         <label for="debarred_expiration">Expiration: </label>
1287                                                         <input name="debarred_expiration" id="debarred_expiration" size="10" value="" class="datepicker" type="text" />
1288                                                         <a href="#" id="clear_debarred_expiration">Clear date</a>
1289                                                     </li>
1290                                                 </ol>
1291                                                 <p>
1292                                                     <a class="cancel" id="cancel_manual_restriction" href="#">Cancel</a>
1293                                                 </p>
1294                                             </fieldset> <!-- /#manual_restriction_form -->
1295                                         [% END # /IF CAN_user_borrowers_edit_borrowers %]
1296                                     </fieldset> <!-- /#memberentry_restrictions -->
1297                                 [% END # /UNLESS ( opadd || opduplicate ) %]
1298                             [% END # /IF ( step_3 ) %]
1299
1300                             [% IF ( step_7 ) %]
1301                                 [% IF Koha.Preference('HouseboundModule') %]
1302                                     <fieldset class="rows" id="memberentry_housebound_roles">
1303                                         <legend id="housebound_roles">Housebound roles</legend>
1304                                         <ol class="radio">
1305                                             <li>
1306                                                 <label class="radio" for="housebound_chooser">
1307                                                     Chooser:
1308                                                 </label>
1309                                                 [% IF ( housebound_role.housebound_chooser == 1 ) %]
1310                                                     <label for="yes_housebound_chooser">Yes </label>
1311                                                     <input type="radio" id="yes_housebound_chooser" name="housebound_chooser" value="1" checked="checked" />
1312                                                     <label for="no_housebound_chooser">No </label>
1313                                                     <input type="radio" id="no_housebound_chooser" name="housebound_chooser" value="0" />
1314                                                 [% ELSE %]
1315                                                     <label for="yes_housebound_chooser">Yes </label>
1316                                                     <input type="radio" id="yes_housebound_chooser" name="housebound_chooser" value="1" />
1317                                                     <label for="no_housebound_chooser">No </label>
1318                                                     <input type="radio" id="no_housebound_chooser" name="housebound_chooser" value="0" checked="checked" />
1319                                                 [% END %]
1320                                             </li>
1321                                             <li>
1322                                                 <label class="radio" for="housebound_deliverer">Deliverer:</label>
1323                                                 [% IF ( housebound_role.housebound_deliverer == 1 ) %]
1324                                                     <label for="yes_housebound_deliverer">Yes </label>
1325                                                     <input type="radio" id="yes_housebound_deliverer" name="housebound_deliverer" value="1" checked="checked" />
1326                                                     <label for="no_housebound_deliverer">No </label>
1327                                                     <input type="radio" id="no_housebound_deliverer" name="housebound_deliverer" value="0" />
1328                                                 [% ELSE %]
1329                                                     <label for="yes_housebound_deliverer">Yes </label>
1330                                                     <input type="radio" id="yes_housebound_deliverer" name="housebound_deliverer" value="1" />
1331                                                     <label for="no_housebound_deliverer">No </label>
1332                                                     <input type="radio" id="no_housebound_deliverer" name="housebound_deliverer" value="0" checked="checked" />
1333                                                 [% END %]
1334                                             </li>
1335                                         </ol> <!-- /ol.radio -->
1336                                     </fieldset> <!-- /#memberentry_housebound_roles -->
1337                                 [% END # hide fieldset %]
1338                             [% END # IF step_7 %]
1339
1340                             [% IF ( step_4 ) %]
1341                                 [% IF Koha.Preference('ExtendedPatronAttributes') %]
1342                                     [% UNLESS ( no_patron_attribute_types ) %]
1343                                         <fieldset class="rows" id="memberentry_patron_attributes">
1344                                             <legend id="patron_attributes_lgd">Additional attributes and identifiers</legend>
1345                                             <input type="hidden" name="setting_extended_patron_attributes" value="1" />
1346                                             [% FOREACH pa_loo IN patron_attributes %]
1347                                                 <ol class="attributes_table">
1348                                                     [% IF pa_loo.class %]
1349                                                         <fieldset id="aai_[% pa_loo.class | html %]">
1350                                                         <legend id="[% pa_loo.class | html %]_lgd">[% pa_loo.lib | html %]</legend>
1351                                                     [% END %]
1352                                                     [% FOREACH patron_attribute IN pa_loo.items %]
1353                                                         <li data-category_code="[% patron_attribute.category_code | html %]">
1354                                                             <label for="[% patron_attribute.form_id | html %]">
1355                                                                 [% patron_attribute.description | html %]:
1356                                                             </label>
1357                                                             [% IF ( patron_attribute.use_dropdown ) %]
1358                                                                 <select id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">
1359                                                                     <option value=""></option>
1360                                                                     [% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %]
1361                                                                         [% IF auth_val_loo.authorised_value == patron_attribute.value %]
1362                                                                             <option value="[% auth_val_loo.authorised_value | html %]" selected="selected">
1363                                                                                 [% auth_val_loo.lib | html %]
1364                                                                             </option>
1365                                                                         [% ELSE %]
1366                                                                             <option value="[% auth_val_loo.authorised_value | html %]" >
1367                                                                                 [% auth_val_loo.lib | html %]
1368                                                                             </option>
1369                                                                         [% END %]
1370                                                                     [% END %]
1371                                                                 </select>
1372                                                             [% ELSE %]
1373                                                                 <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">[% patron_attribute.value | html %]</textarea>
1374                                                             [% END # /IF ( patron_attribute.use_dropdown ) %]
1375                                                             <input type="hidden" id="[% patron_attribute.form_id | html %]_code" name="[% patron_attribute.form_id | html %]_code" value="[% patron_attribute.code | html %]" />
1376                                                             <a href="#" class="clear_attribute"><i class="fa fa-fw fa-trash"></i> Clear</a>
1377                                                             [% IF ( patron_attribute.repeatable ) %]
1378                                                                 <a href="#" class="clone_attribute"><i class="fa fa-fw fa-plus"></i> New</a>
1379                                                             [% END %]
1380                                                         </li>
1381                                                     [% END # /FOREACH patron_attribute %]
1382                                                     [% IF pa_loo.class %]</fieldset>[% END %]
1383                                                 </ol>
1384                                             [% END # /FOREACH pa_loo %]
1385                                         </fieldset> <!-- /#memberentry_patron_attributes -->
1386                                     [% END # UNLESS ( no_patron_attribute_types ) %]
1387                                 [% END # IF Koha.Preference('ExtendedPatronAttributes') %]
1388                             [% END # IF ( step_4 ) %]
1389
1390                             [% IF ( step_5 ) %]
1391                                 [% IF ( EnhancedMessagingPreferences ) %]
1392                                     <fieldset class="rows" id="memberentry_messaging_prefs">
1393                                         <legend id="patron_messaging_prefs_lgd">Patron messaging preferences</legend>
1394                                         <div id="messaging_prefs_loading" class="form-message" style="display:none">
1395                                             <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading new messaging defaults
1396                                         </div>
1397                                         <input type="hidden" name="setting_messaging_prefs" value="1" />
1398                                         [% INCLUDE 'messaging-preference-form.inc' %]
1399                                         [% IF ( SMSSendDriver ) %]
1400                                             <p>
1401                                                 <label for="SMSnumber">SMS number:</label>
1402                                                 <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber | html %]" />
1403                                                 <span class="hint">SMS number should be in the format 1234567890 or +11234567890</span>
1404                                             </p>
1405                                             [% UNLESS nosms_provider_id %]
1406                                                 <p>
1407                                                     <label for="sms_provider_id">SMS provider:</label>
1408                                                     <select id="sms_provider_id" name="sms_provider_id">
1409                                                         <option value="">Unknown</option>
1410                                                         [% FOREACH s IN sms_providers %]
1411                                                             [% IF s.id == sms_provider_id %]
1412                                                                 <option value="[% s.id | html %]" selected="selected">[% s.name | html %]</option>
1413                                                             [% ELSE %]
1414                                                                 <option value="[% s.id | html %]">[% s.name | html %]</option>
1415                                                             [% END %]
1416                                                         [% END %]
1417                                                     </select>
1418                                                 </p>
1419                                             [% END # /UNLESS nosms_provider_id %]
1420                                         [% END # IF ( SMSSendDriver ) %]
1421                                     </fieldset>
1422                                 [% END # IF ( EnhancedMessagingPreferences ) %]
1423                             [% END # /IF step_5 %]
1424                         </form> <!-- /#entryform -->
1425
1426                         [% IF quickadd && opadd  && !check_member %]
1427                             <form id="quick_add_form" class="toggler">
1428                                 <fieldset class="rows quick_add"><legend>Quick add</legend>
1429                                     <ol id="quick_add_list">
1430                                     </ol>
1431                                 </fieldset>
1432                             </form>
1433                         [% END %]
1434
1435                     [% END # /UNLESS ( no_add ) %]
1436                 </main>
1437             </div> <!-- /.col-sm-10.col-sm-push-2 -->
1438
1439             [% UNLESS ( opadd ) %]
1440                 <div class="col-sm-2 col-sm-pull-10">
1441                     <aside>
1442                         [% INCLUDE 'circ-menu.inc' %]
1443                     </aside>
1444                 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1445             [% END %]
1446         </div> <!-- /.row -->
1447
1448 [% MACRO jsinclude BLOCK %]
1449     [% Asset.js("lib/hc-sticky.js") | $raw %]
1450     [% INCLUDE 'calendar.inc' %]
1451     [% INCLUDE 'str/members-menu.inc' %]
1452     [% Asset.js("js/members-menu.js") | $raw %]
1453     <script>
1454         function update_cardnumber_warning(size){
1455             var max_len = [% maxlength_cardnumber | html %];
1456             if ( size >= max_len ) {
1457                 $("#cn_max").show();
1458             } else {
1459                 $("#cn_max").hide();
1460             }
1461         }
1462         var Sticky;
1463         function showHideFields(){
1464             [% UNLESS step == 1 %]
1465                 [% IF fieldstohide.match('identity') %]
1466                     $("#memberentry_identity").find('legend').nextAll().toggle();
1467                 [% END %]
1468                 [% IF show_guarantor || guarantor %]
1469                     [% IF fieldstohide.match('guarantor') %]
1470                         $("#memberentry_guarantor").find('legend').nextAll().toggle();
1471                         $("#guarantor_template").toggle();
1472                     [% END %]
1473                 [% END %]
1474                 [% IF fieldstohide.match('primary_address') %]
1475                     $("#memberentry_mainaddress").find('legend').nextAll().toggle();
1476                 [% END %]
1477                 [% IF fieldstohide.match('primary_contact') %]
1478                     $("#memberentry_contact").find('legend').nextAll().toggle();
1479                 [% END %]
1480             [% END %]
1481             [% UNLESS step == 6 %]
1482                 [% IF fieldstohide.match('alt_address') %]
1483                     $("#memberentry_address").find('legend').nextAll().toggle();
1484                 [% END %]
1485             [% END %]
1486             [% UNLESS step == 2 %]
1487                 [% IF fieldstohide.match('alt_contact') %]
1488                     $("#memberentry_altaddress").find('legend').nextAll().toggle();
1489                 [% END %]
1490             [% END %]
1491             [% UNLESS step == 3 %]
1492                 [% IF fieldstohide.match('lib_mgmt') %]
1493                         $("#memberentry_library_management").find('legend').nextAll().toggle();
1494                 [% END %]
1495                 [% UNLESS nodateenrolled && noopacnote && noborrowernotes %]
1496                     [% IF fieldstohide.match('lib_setup') %]
1497                         $("#memberentry_subscription").find('legend').nextAll().toggle();
1498                     [% END %]
1499                 [% END %]
1500                 [% UNLESS nouserid && nopassword %]
1501                     [% IF fieldstohide.match('login') %]
1502                         $("#memberentry_userid").find('legend').nextAll().toggle();
1503                     [% END %]
1504                 [% END %]
1505                 [% UNLESS ( opadd || opduplicate ) %]
1506                     [% IF fieldstohide.match('flags') %]
1507                         $("#memberentry_account_flags").find('legend').nextAll().toggle();
1508                     [% END %]
1509                 [% END %]
1510                 [% IF fieldstohide.match('debarments') %]
1511                     $("#memberentry_restrictions").find('legend').nextAll().toggle();
1512                 [% END %]
1513             [% END %]
1514             [% UNLESS step == 7 %]
1515                 [% IF Koha.Preference('HouseboundModule') %]
1516                     [% IF fieldstohide.match('housebound') %]
1517                         $("#memberentry_housebound_roles").find('legend').nextAll().toggle();
1518                     [% END %]
1519                 [% END %]
1520             [% END %]
1521             [% UNLESS step == 4 %]
1522                 [% IF Koha.Preference('ExtendedPatronAttributes') %]
1523                     [% IF fieldstohide.match('additional') %]
1524                         $("#memberentry_patron_attributes").find('legend').nextAll().toggle();
1525                     [% END %]
1526                 [% END %]
1527             [% END %]
1528             [% UNLESS step == 5 %]
1529                 [% IF Koha.Preference('EnhancedMessagingPreferences') %]
1530                     [% IF fieldstohide.match('messaging') %]
1531                         $("#memberentry_messaging_prefs").find('legend').nextAll().toggle();
1532                         $("#messaging_prefs_loading").toggle();
1533                     [% END %]
1534                 [% END %]
1535             [% END %]
1536         }
1537
1538         $(document).ready(function() {
1539             showHideFields();
1540             $("#toggle_hidden_fields").change(function(){
1541                 showHideFields();
1542             });
1543
1544             $("legend").click(function(){
1545                 $(this).nextAll().toggle();
1546                 $("#messaging_prefs_loading").hide();
1547             });
1548
1549             $("#saverecord").css({ 'margin-left': 0 });
1550
1551             Sticky = $("#toolbar");
1552             Sticky.hcSticky({
1553                 stickTo: "main",
1554                 stickyClass: "floating"
1555             });
1556
1557             [% IF categorycode %]
1558                 update_category_code( "[% categorycode | html %]" );
1559             [% ELSE %]
1560                 if ( $("#categorycode_entry").length > 0 ){
1561                     var category_code = $("#categorycode_entry").find("option:selected").val();
1562                     update_category_code( category_code );
1563                 }
1564             [% END %]
1565
1566             [% IF new_guarantors %]
1567                 [% FOREACH g IN new_guarantors %]
1568                     select_user( '[% g.patron.borrowernumber | html %]', [% To.json( g.patron.unblessed ) | $raw %], '[% g.relationship | html %]' );
1569                 [% END %]
1570             [% END %]
1571
1572             $("#cn_max").hide();
1573             var content;
1574             $("#cardnumber").on("keydown", function(e){
1575                 content = $(this).val();
1576             });
1577             $("#cardnumber").on("keyup", function(e){
1578                 // .val() will return the value of the input after the key has been released
1579                 var l = $(this).val().length;
1580                 if ( l == content.length + 1 ) { l--; }
1581                 update_cardnumber_warning(l);
1582             });
1583             $("#cardnumber").bind("paste", function(e){
1584                 var pastedData = e.originalEvent.clipboardData.getData('text');
1585                 update_cardnumber_warning(pastedData.length - 1);
1586             } );
1587             var toggle_quick_add = $(".toggle_quick_add");
1588             $(toggle_quick_add).click(function(e){
1589                 toggle_quick_add.toggle();
1590                 e.preventDefault();
1591                 var toggle_to = '';
1592                 var toggle_from = '';
1593                 if( $("#entryform:visible").length ) {
1594                     toggle_to = "#quick_add_form label";
1595                     toggle_from = "#entryform label";
1596                     $("#memberentry_guarantor").appendTo("#quick_add_form");
1597                 } else {
1598                     toggle_to="#entryform label";
1599                     toggle_from = "#quick_add_form label";
1600                     $("#memberentry_guarantor").appendTo("#memberentry_guarantor_anchor");
1601                 }
1602                 $(toggle_from).each(function() {
1603                     var input_label = $(this).attr('for');
1604                     if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) {
1605                         $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') );
1606                         return;
1607                     }
1608                     $(toggle_to+"[for='"+input_label+"']").next().val(  $(this).next().val() );
1609                 });
1610
1611                 $(".toggler").toggle();
1612             });
1613
1614             $("#save_quick_add").click(function(){
1615                 $("#quick_add_form").validate();
1616                 if( $("#quick_add_form").valid()){
1617                     $('.toggle_quick_add').click();
1618                     $("#memberentry_guarantor").appendTo("#memberentry_guarantor_anchor");
1619                     $('#saverecord').click();
1620                 }
1621                 else {return false;}
1622             });
1623
1624             $("#saverecord").click(function(){
1625                 if( check_form_borrowers() ){
1626                     $("#entryform").submit();
1627                 }
1628             });
1629
1630             $('#duplicate').on('click', function() {
1631                 $("input[name='op']").val('modify');
1632                 $("input[name='borrowernumber']").val('[% check_member | html %]');
1633                 $("input[name='check_member']").val('');
1634                 $('#entryform').submit();
1635             });
1636
1637             $('#not-duplicate').on('click', function() {
1638                 $("input[name='nodouble']").val('1');
1639                 $('#entryform').submit();
1640             });
1641
1642             $(".popup_patronview").on("click", function(e){
1643                 e.preventDefault();
1644                 var url = $(this).attr("href");
1645                 openWindow( url, "patronview" );
1646             });
1647
1648             $("#dateofbirth").on("change", function(){
1649                  write_age();
1650             });
1651
1652             $("#debarred_comment, #debarred_expiration").on("change", function(){
1653                 $("#add_debarment").val(1);
1654             });
1655
1656             $("#clear_debarred_expiration").on("click", function(e){
1657                 e.preventDefault();
1658                 $('#debarred_expiration').val("");
1659             });
1660
1661             $("#memberentry_patron_attributes").on("click", ".clear_attribute", function(e){
1662                 e.preventDefault();
1663                 clear_entry( this );
1664             });
1665
1666             $("#memberentry_patron_attributes").on("click", ".clone_attribute", function(e){
1667                 e.preventDefault();
1668                 clone_entry( this );
1669             });
1670
1671             $("#categorycode_entry").on("change", function(){
1672                 update_category_code(this);
1673             });
1674         });
1675
1676         var MSG_SEPARATOR = _("Separator must be / in field %s");
1677         var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
1678         var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s");
1679         var MSG_INCORRECT_YEAR = _("Invalid year entered in field %s");
1680         var MSG_DUPLICATE_PATRON = _("Warning: Duplicate patron");
1681         var MSG_DUPLICATE_ORGANIZATION = _("Warning: Duplicate organization");
1682         var MSG_LATE_EXPIRY = _("Warning: Expiration date falls before enrollment date");
1683         var MSG_DUPLICATE_SUSPICION = _("Please confirm whether this is a duplicate patron");
1684         var MSG_MONTH = _("%s month")
1685         var MSG_MONTHS = _("%s months")
1686         var MSG_YEAR = _("%s year")
1687         var MSG_YEARS = _("%s years")
1688         var LABEL_CHANGE = _("Change");
1689         var LABEL_SET_TO_PATRON = _("Set to patron");
1690         var LABEL_AGE = _("Age");
1691         var MSG_MESSAGING_DFEAULTS = _("Change messaging preferences to default for this category?");
1692
1693         [% IF quickadd && opadd  && !check_member %]
1694             $(document).ready(function () {
1695
1696                 $("#entryform,#saverecord").hide();
1697                 [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
1698                 var qaddfields = [[% FOREACH field IN q_add_f.unique %]"[% field | html %]",[% END %]];
1699                 $("#entryform label").each(function () {
1700                     var input_label = $(this).attr('for');
1701                     if ( input_label == 'sex-female' ) {
1702                         input_label='sex';
1703                     }
1704                     else if ( input_label == 'btitle' ) {
1705                         input_label='title';
1706                     }
1707                     if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){
1708                        $(this).parent().clone().appendTo("#quick_add_list");
1709                        [% UNLESS mandatorypassword %]
1710                              if( input_label == 'password' ) $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list");
1711                        [% END %]
1712                     }
1713                 });
1714                 if ( $("#memberentry_guarantor").length ) {
1715                     $("#memberentry_guarantor").appendTo("#quick_add_form");
1716                 }
1717                 $("#quick_add_form").show();
1718             });
1719         [% END %]
1720         $("#guarantor_template").hide();
1721
1722     </script>
1723     [% Asset.js("js/members.js") | $raw %]
1724     [% Asset.js("js/messaging-preference-form.js") | $raw %]
1725     [% PROCESS 'password_check.inc' %]
1726     [% PROCESS 'add_password_check' new_password => 'password' %]
1727 [% END %]
1728
1729 [% INCLUDE 'intranet-bottom.inc' %]