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