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