20ddc7602623e8d128901be8c810360cadbde7cd
[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 collapsed by default by the CollapseFieldsPatronAddForm system preference"><strong>Show collapsed 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 card number:</span>
420                                                                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% r.guarantor_id | uri %]" target="blank">[% r.guarantor.cardnumber | 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                                                 [% IF guarantor && (!relationships) %]
451                                                     <fieldset class="rows">
452                                                         <ol>
453                                                             <li class="guarantor-details" data-borrowernumber="0">
454                                                                 <span class="label">Patron card number:</span>
455                                                                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.borrowernumber | uri %]" target="blank">[% guarantor.cardnumber | html %]</a>
456                                                                 <input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value="[% guarantor.borrowernumber | html %]"/>
457                                                             </li>
458
459                                                             <li>
460                                                                 <label for="guarantor_surname">Surname: </label>
461                                                                 <span class="new_guarantor_surname_text">[% guarantor.surname | html %]</span>
462                                                             </li>
463
464                                                             <li>
465                                                                 <label for="guarantor_firstname">First name: </label>
466                                                                 <span class="new_guarantor_firstname_text">[% guarantor.firstname | html %]</span>
467                                                             </li>
468
469                                                             <li>
470                                                                 <label for="guarantor_relationship">Relationship: </label>
471                                                                 <select class="new_guarantor_relationship" name="new_guarantor_relationship">
472                                                                     [% FOREACH pr IN possible_relationships.split('\|') %]
473                                                                         <option value="[% pr | html %]">[% pr | html %]</option>
474                                                                     [% END %]
475                                                                 </select>
476                                                             </li>
477
478                                                             <li>
479                                                                 <label for="guarantor_cancel">&nbsp;</label>
480                                                                 <span><a href="#" class="guarantor_cancel">Remove</a></span>
481                                                             </li>
482                                                         </ol>
483                                                     </fieldset>
484                                                 [% END %]
485                                             </span> <!-- #/guarantor_relationships -->
486
487                                             <fieldset class="rows guarantor" id="guarantor_template">
488                                                 <ol>
489                                                     <li class="guarantor-details" data-borrowernumber="0">
490                                                         <span class="label">Patron card number:</span>
491                                                         <span class="new_guarantor_id_text"></span>
492                                                         <input type="hidden" class="new_guarantor_id" name="new_guarantor_id" value=""/>
493                                                     </li>
494
495                                                     <li>
496                                                         <label for="guarantor_surname">Surname: </label>
497                                                         <span class="new_guarantor_surname_text"></span>
498                                                     </li>
499
500                                                     <li>
501                                                         <label for="guarantor_firstname">First name: </label>
502                                                         <span class="new_guarantor_firstname_text"></span>
503                                                     </li>
504
505                                                     <li>
506                                                         <label for="guarantor_relationship">Relationship: </label>
507                                                         <select class="new_guarantor_relationship" name="new_guarantor_relationship">
508                                                             [% FOREACH pr IN possible_relationships.split('\|') %]
509                                                                 <option value="[% pr | html %]">[% pr | html %]</option>
510                                                             [% END %]
511                                                         </select>
512                                                     </li>
513
514                                                     <li>
515                                                         <label for="guarantor_cancel">&nbsp;</label>
516                                                         <span><a href="#" class="guarantor_cancel">Remove</a></span>
517                                                     </li>
518                                                 </ol>
519                                             </fieldset>
520
521                                             <ol>
522                                                 <input type="hidden" id="guarantor_id" value="" />
523                                                 <input name="guarantor_surname" id="guarantor_surname" type="hidden" />
524                                                 <input name="guarantor_firstname" id="guarantor_firstname" type="hidden" />
525
526                                                 <li>
527                                                     <a href="#" id="guarantor_search" class="btn btn-default"><i class="fa fa-plus"></i> Search to add</a>
528                                                 </li>
529
530                                                 [% IF relationships && Koha.Preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') %]
531                                                     <li>
532                                                         <label for="privacy_guarantor_checkouts">Show checkouts to guarantors</label>
533                                                         <select name="privacy_guarantor_checkouts" id="privacy_guarantor_checkouts">
534                                                             [% IF privacy_guarantor_checkouts %]
535                                                                 <option value="0">No</option>
536                                                                 <option value="1" selected>Yes</option>
537                                                             [% ELSE %]
538                                                                 <option value="0" selected>No</option>
539                                                                 <option value="1">Yes</option>
540                                                             [% END %]
541                                                         </select>
542                                                         <div class="hint">Allow guarantors of this patron to view this patron's checkouts from the OPAC</div>
543                                                     </li>
544                                                 [% END %]
545                                                 [% IF relationships && Koha.Preference('AllowStaffToSetFinesVisibilityForGuarantor') %]
546                                                     <li>
547                                                         <label for="privacy_guarantor_fines">Show fines to guarantors</label>
548                                                         <select name="privacy_guarantor_fines" id="privacy_guarantor_fines">
549                                                             [% IF privacy_guarantor_fines %]
550                                                                 <option value="0">No</option>
551                                                                 <option value="1" selected>Yes</option>
552                                                             [% ELSE %]
553                                                                 <option value="0" selected>No</option>
554                                                                 <option value="1">Yes</option>
555                                                             [% END %]
556                                                         </select>
557                                                         <div class="hint">Allow guarantors of this patron to view this patron's fines from the OPAC</div>
558                                                     </li>
559                                                 [% END %]
560                                             </ol>
561                                         </fieldset> <!-- /#memberentry_guarantor -->
562                                     </span> <!-- #/memberentry_guarantor_anchor -->
563                                 [% END # /IF show_guarantor || guarantor  %]
564
565                                 [% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %]
566                                     [% IF Koha.Preference( 'AddressFormat' ) %]
567                                         [% INCLUDE "member-main-address-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %]
568                                     [% END %]
569                                 [% END # /UNLESS nostreet && nocity etc group%]
570
571                                 [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
572                                     <fieldset class="rows" id="memberentry_contact">
573                                         <legend id="contact_lgd">Contact</legend>
574                                         <ol>
575                                             [% UNLESS nocontactname %]
576                                                 <li>
577                                                     [% IF ( mandatorycontactname ) %]
578                                                         <label for="contactname" class="required">
579                                                     [% ELSE %]
580                                                         <label for="contactname">
581                                                     [% END %]
582                                                         Guarantor surname:
583                                                     </label>
584                                                     <input type="text" id="contactname" name="contactname" value="[% patron.contactname | html %]" />
585                                                     [% IF ( mandatorycontactname ) %]
586                                                         <span class="required">Required</span>
587                                                     [% END %]
588                                                     <div class="hint">Non-patron guarantor surname</div>
589                                                 </li>
590                                             [% END # /UNLESS nocontactname %]
591
592                                             [% UNLESS nocontactfirstname %]
593                                                 <li>
594                                                     [% IF ( mandatorycontactfirstname ) %]
595                                                         <label for="contactfirstname" class="required">
596                                                     [% ELSE %]
597                                                         <label for="contactfirstname">
598                                                     [% END %]
599                                                         Guarantor first name:
600                                                     </label>
601                                                     <input type="text" id="contactfirstname" name="contactfirstname" value="[% patron.contactfirstname | html %]" />
602                                                     [% IF ( mandatorycontactfirstname ) %]
603                                                         <span class="required">Required</span>
604                                                     [% END %]
605                                                     <div class="hint">Non-patron guarantor first name</div>
606                                                 </li>
607                                             [% END # /UNLESS noaltcontactfirstname %]
608
609                                             [% UNLESS norelationship %]
610                                                 [% IF possible_relationships %]
611                                                     <li>
612                                                         <label for="relationship">Relationship: </label>
613                                                         <select class="relationship" name="relationship">
614                                                             <option value=""></option>
615                                                             [% FOREACH pr IN possible_relationships.split('\|') %]
616                                                                 [% IF pr == relationship %]
617                                                                     <option value="[% pr | html %]" selected="selected">[% pr | html %]</option>
618                                                                 [% ELSE %]
619                                                                     <option value="[% pr | html %]">[% pr | html %]</option>
620                                                                 [% END %]
621                                                             [% END %]
622                                                         </select>
623                                                     </li>
624                                                 [% END #/IF possible_relationships %]
625                                             [% END # /UNLESS norelationship %]
626
627                                             [% UNLESS nophone %]
628                                                 <li>
629                                                     [% IF ( mandatoryphone ) %]
630                                                         <label for="phone" class="required">
631                                                     [% ELSE %]
632                                                         <label for="phone">
633                                                     [% END %]
634                                                         Primary phone:
635                                                     </label>
636                                                     <input type="text" id="phone" name="phone" value="[% patron.phone | html %]" />
637                                                     [% IF ( mandatoryphone ) %]
638                                                         <span class="required">Required</span>
639                                                     [% END %]
640                                                     <div class="hint">Shows on transit slips</div>
641                                                 </li>
642                                             [% END # /UNLESS nophone %]
643
644                                             [% UNLESS nophonepro %]
645                                                 <li>
646                                                     [% IF ( mandatoryphonepro ) %]
647                                                         <label for="phonepro" class="required">
648                                                     [% ELSE %]
649                                                         <label for="phonepro">
650                                                     [% END %]
651                                                         Secondary phone:
652                                                     </label>
653                                                     <input type="text" id="phonepro" name="phonepro" value="[% patron.phonepro | html %]" />
654                                                     [% IF ( mandatoryphonepro ) %]
655                                                         <span class="required">Required</span>
656                                                     [% END %]
657                                                 </li>
658                                             [% END # /UNLESS nophonepro %]
659
660                                             [% UNLESS nomobile %]
661                                                 <li>
662                                                     [% IF ( mandatorymobile ) %]
663                                                         <label for="mobile" class="required">
664                                                     [% ELSE %]
665                                                         <label for="mobile">
666                                                     [% END %]
667                                                         Other phone:
668                                                     </label>
669                                                     <input type="text" id="mobile" name="mobile" value="[% patron.mobile | html %]" />
670                                                     [% IF ( mandatorymobile ) %]
671                                                         <span class="required">Required</span>
672                                                     [% END %]
673                                                 </li>
674                                             [% END # /UNLESS nomobile %]
675
676                                             [% UNLESS noemail %]
677                                                 <li>
678                                                     [% IF ( mandatoryemail ) %]
679                                                         <label for="email" class="required">
680                                                     [% ELSE %]
681                                                         <label for="email">
682                                                     [% END %]
683                                                         Primary email:
684                                                     </label>
685                                                     <input type="text" id="email" name="email" size="45" value="[% patron.email | html %]" />
686                                                     [% IF ( mandatoryemail ) %]
687                                                         <span class="required">Required</span>
688                                                     [% END %]
689                                                     <div class="hint">Shows on transit slips</div>
690                                                 </li>
691                                             [% END #/UNLESS noemail %]
692
693                                             [% UNLESS noemailpro %]
694                                                 <li>
695                                                     [% IF ( mandatoryemailpro ) %]
696                                                         <label for="emailpro" class="required">
697                                                     [% ELSE %]
698                                                         <label for="emailpro">
699                                                     [% END %]
700                                                         Secondary email:
701                                                     </label>
702                                                     <input type="text" id="emailpro" name="emailpro" size="45" value="[% patron.emailpro | html %]" />
703                                                     [% IF ( mandatoryemailpro ) %]
704                                                         <span class="required">Required</span>
705                                                     [% END %]
706                                                 </li>
707                                             [% END # /UNLESS noemailpro %]
708
709                                             [% UNLESS nofax %]
710                                                 <li>
711                                                     [% IF ( mandatoryfax ) %]
712                                                         <label for="fax" class="required">
713                                                     [% ELSE %]
714                                                         <label for="fax">
715                                                     [% END %]
716                                                         Fax:
717                                                     </label>
718                                                     <input type="text" id="fax" name="fax" value="[% patron.fax | html %]" />
719                                                     [% IF ( mandatoryfax ) %]
720                                                         <span class="required">Required</span>
721                                                     [% END %]
722                                                 </li>
723                                             [% END #/UNLESS nofax %]
724                                         </ol>
725                                     </fieldset> <!-- /#memberentry_contact -->
726                                 [% END # hide fieldset %]
727
728                                 <!-- ************************ STEP_1 *********************** -->
729                             [% END # /IF ( step_1 ) %]
730
731                             [% IF ( step_6 ) %]
732                                 [% UNLESS noB_address && noB_address2 && noB_city && noB_zipcode && noB_state && noB_country &&nocontactnote && noB_phone && noB_email %]
733                                 [% SWITCH Koha.Preference( 'AddressFormat' ) %]
734                                     [% CASE 'de' %]
735                                         [% INCLUDE 'member-alt-address-style-de.inc' %]
736                                     [% CASE # us %]
737                                         [% INCLUDE 'member-alt-address-style-us.inc' %]
738                                  [% END %]
739                                 [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %]
740                             [% END # /IF ( step_6 ) %]
741
742                             [% IF ( step_2 ) %]
743                                 [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactaddress2 && noaltcontactaddress3 && noaltcontactstate && noaltcontactzipcode && noaltcontactcountry && noaltcontactphone %]
744                                     [% SWITCH Koha.Preference( 'AddressFormat' ) %]
745                                         [% CASE 'de' %]
746                                             [% INCLUDE 'member-alt-contact-style-de.inc' %]
747                                         [% CASE # us %]
748                                             [% INCLUDE 'member-alt-contact-style-us.inc' %]
749                                     [% END %]
750                                 [% END # UNLESS noaltcontactsurname && noaltcontactfirstname etc %]
751                             [% END # /IF ( step_2 ) %]
752
753                             [% IF ( step_3 ) %]
754                                 [% SET autoMemberNum = Koha.Preference('autoMemberNum') %]
755                                 <fieldset class="rows" id="memberentry_library_management">
756                                     <legend id="library_management_lgd">Library management</legend>
757                                     <ol>
758                                         [% UNLESS nocardnumber %]
759                                             <li>
760                                                 [% IF mandatorycardnumber %]
761                                                     <label for="cardnumber" class="required">
762                                                 [% ELSE %]
763                                                     <label for="cardnumber" class="validated">
764                                                 [% END %]
765                                                     Card number:
766                                                 </label>
767
768                                                 <!-- NOTE: div.hint closing tag isn't on the same line -->
769                                                 [% IF minlength_cardnumber == maxlength_cardnumber %]
770                                                     <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" minlength="[% minlength_cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
771                                                     [% IF mandatorycardnumber %]
772                                                         <span class="required">Required</span>
773                                                     [% END %]
774                                                     <span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber | html %] characters.</span>
775                                                     <div class="hint">Card number must be exactly [% minlength_cardnumber | html %] characters.
776                                                 [% ELSIF minlength_cardnumber && maxlength_cardnumber %]
777                                                     <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" minlength="[% minlength_cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
778                                                     [% IF mandatorycardnumber %]
779                                                         <span class="required">Required</span>
780                                                     [% END %]
781                                                     <span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber | html %] characters.</span>
782                                                     <div class="hint">Card number must be between [% minlength_cardnumber | html %] and [% maxlength_cardnumber | html %] characters.
783                                                 [% ELSIF maxlength_cardnumber %]
784                                                     <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" maxlength="[% maxlength_cardnumber | html %]" />
785                                                     [% IF mandatorycardnumber %]
786                                                         <span class="required">Required</span>
787                                                     [% END %]
788                                                     <span id="cn_max" class="required">Card number must not be more than [% maxlength_cardnumber | html %] characters.</span>
789                                                     <div class="hint">Card number can be up to [% maxlength_cardnumber | html %] characters.
790                                                 [% ELSE %]
791                                                     <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" />
792                                                     [% IF mandatorycardnumber %]
793                                                         <span class="required">Required</span>
794                                                     [% END %]
795                                                     <div class="hint">There is no minimum or maximum character length.
796                                                 [% END %]
797                                                 [% IF autoMemberNum %]
798                                                     [% IF mandatorycardnumber %]
799                                                         <br/><span class="error">AutoMemberNum is set to enabled, but cardnumber is marked as mandatory in BorrowerMandatoryField: auto calc has been disabled.</span>
800                                                     [% ELSE %]
801                                                         <br/>Leave blank for auto calc during registration
802                                                     [% END %]
803                                                 [% END %]
804                                                 </div><!--/div.hint -->
805                                             </li>
806                                         [% END # /UNLESS nocardnumber %]
807
808                                         [% UNLESS nobranchcode %]
809                                             <li>
810                                                 <label for="libraries" class="required">Library:</label>
811                                                 <select name="branchcode" size="1" id="libraries">
812                                                     [% PROCESS options_for_libraries libraries => Branches.all( selected => userbranch, only_from_group => 1 ) %]
813                                                 </select>
814                                                 <span class="required">Required</span>
815                                             </li>
816                                         [% END %]
817
818                                         <li>
819                                             <label for="categorycode_entry" class="required">Category: </label>
820                                             <select id="categorycode_entry" name="categorycode" onchange="update_category_code(this);">
821                                                 [% FOREACH typeloo IN typeloop %]
822                                                     [% FOREACH categoryloo IN typeloo.categoryloop %]
823                                                         [% IF ( loop.first ) %]
824                                                             [% IF ( typeloo.typename_C ) %]<optgroup label="Child">[% END %]
825                                                             [% IF ( typeloo.typename_A ) %]<optgroup label="Adult">[% END %]
826                                                             [% IF ( typeloo.typename_S ) %]<optgroup label="Staff">[% END %]
827                                                             [% IF ( typeloo.typename_I ) %]<optgroup label="Organization">[% END %]
828                                                             [% IF ( typeloo.typename_P ) %]<optgroup label="Professional">[% END %]
829                                                             [% IF ( typeloo.typename_X ) %]<optgroup label="Statistical">[% END %]
830                                                         [% END %]
831                                                         [% IF ( categoryloo.categorycodeselected ) %]
832                                                             <option value="[% categoryloo.categorycode | html %]" selected="selected" data-typename="[% typeloo.typename | html %]">[% categoryloo.categoryname | html %]</option>
833                                                         [% ELSE %]
834                                                             <option value="[% categoryloo.categorycode | html %]" data-typename="[% typeloo.typename | html %]">[% categoryloo.categoryname | html %]</option>
835                                                         [% END %]
836                                                         [% IF ( loop.last ) %]
837                                                             </optgroup>
838                                                         [% END %]
839                                                     [% END # /FOREACH categoryloo %]
840                                                 [% END # /FOREACH typeloo %]
841                                             </select>
842                                             <span class="required">Required</span>
843                                         </li>
844
845                                         [% UNLESS nosort1 %]
846                                             <li>
847                                                 [% IF ( mandatorysort1 ) %]
848                                                     <label for="sort1" class="required">
849                                                 [% ELSE %]
850                                                     <label for="sort1">
851                                                 [% END %]
852                                                     Sort 1:
853                                                 </label>
854                                                 [% PROCESS 'av-build-dropbox.inc' name="sort1", category="Bsort1", default=sort1, size = 20 %]
855                                                 [% IF ( mandatorysort1 ) %]
856                                                     <span class="required">Required</span>
857                                                 [% END %]
858                                             </li>
859                                         [% END # /UNLESS nosort1 %]
860
861                                         [% UNLESS nosort2 %]
862                                             <li>
863                                                 [% IF ( mandatorysort2 ) %]
864                                                     <label for="sort2" class="required">
865                                                 [% ELSE %]
866                                                     <label for="sort2">
867                                                 [% END %]
868                                                     Sort 2:
869                                                 </label>
870                                                 [% PROCESS 'av-build-dropbox.inc' name="sort2", category="Bsort2", default=sort2, size = 20 %]
871                                                 [% IF ( mandatorysort2 ) %]
872                                                     <span class="required">Required</span>
873                                                 [% END %]
874                                             </li>
875                                         [% END # /UNLESS nosort2 %]
876
877                                         [% UNLESS noautorenewal %]
878                                             <li class="radio">
879                                                 <label for="yes-autorenewal">
880                                                     Allow auto-renewal of items:
881                                                 </label>
882                                                     [% IF ( autorenewal ) %]
883                                                         <label for="yes-autorenewal">
884                                                             Yes
885                                                             <input type="radio" id="yes-autorenewal" name="autorenewal" value="1" checked="checked" />
886                                                         </label>
887                                                         <label for="no-autorenewal">
888                                                             No
889                                                             <input type="radio" id="no-autorenewal" name="autorenewal" value="0" />
890                                                         </label>
891                                                     [% ELSE %]
892                                                         <label for="yes-autorenewal">
893                                                             Yes
894                                                             <input type="radio" id="yes-autorenewal" name="autorenewal" value="1" />
895                                                         </label>
896                                                         <label for="no-autorenewal">
897                                                             No
898                                                             <input type="radio" id="no-autorenewal" name="autorenewal" value="0" checked="checked" />
899                                                         </label>
900                                                     [% END %]
901                                             </li>
902                                         [% END %]
903
904                                         [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
905                                             <li>
906                                                 <label for="checkprevcheckout">Check for previous checkouts: </label>
907                                                 <select name="checkprevcheckout" id="checkprevcheckout">
908                                                     [% IF ( checkprevcheckout == 'yes' ) %]
909                                                         <option value="yes" selected="selected">Yes if settings allow it</option>
910                                                         <option value="no">No if settings allow it</option>
911                                                         <option value="inherit">Inherit from settings</option>
912                                                     [% ELSIF ( checkprevcheckout == 'no' ) %]
913                                                         <option value="yes">Yes if settings allow it</option>
914                                                         <option value="no" selected="selected">No if settings allow it</option>
915                                                         <option value="inherit">Inherit from settings</option>
916                                                     [% ELSE %]
917                                                         <option value="yes">Yes if settings allow it</option>
918                                                         <option value="no">No if settings allow it</option>
919                                                         <option value="inherit" selected="selected">Inherit from settings</option>
920                                                     [% END %]
921                                                 </select>
922                                             </li>
923                                         [% END # /IF ( Koha.Preference('CheckPrevCheckout') %]
924
925                                         [% IF Koha.Preference('TranslateNotices') %]
926                                             <li>
927                                                 <label for="lang">Preferred language for notices: </label>
928                                                 <select id="lang" name="lang">
929                                                     <option value="default">Default</option>
930                                                     [% FOR language IN languages %]
931                                                         [% FOR sublanguage IN language.sublanguages_loop %]
932                                                             [% IF language.plural %]
933                                                                 [% IF sublanguage.rfc4646_subtag == lang %]
934                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
935                                                                 [% ELSE %]
936                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
937                                                                 [% END %]
938                                                             [% ELSE %]
939                                                                 [% IF sublanguage.rfc4646_subtag == lang %]
940                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
941                                                                 [% ELSE %]
942                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
943                                                                 [% END %]
944                                                             [% END # /IF language.plural %]
945                                                         [% END # /FOR sublanguage %]
946                                                     [% END #/FOR language %]
947                                                 </select> <!-- /#lang -->
948                                             </li>
949                                         [% END #/IF Koha.Preference('TranslateNotices') %]
950                                     </ol>
951                                 </fieldset> <!-- /#memberentry_library_management -->
952
953                                 [% UNLESS nodateenrolled &&  noopacnote && noborrowernotes %]
954                                     <fieldset class="rows" id="memberentry_subscription">
955                                         <legend id="library_setup_lgd">Library set-up</legend><ol>
956                                         [% UNLESS nodateenrolled %]
957                                             <li>
958                                                 [% IF ( mandatorydateenrolled ) %]
959                                                     <label for="from" class="required">
960                                                 [% ELSE %]
961                                                     <label for="from">
962                                                 [% END %]
963                                                     Registration date:
964                                                 </label>
965                                                 [% IF ( dateformat == "metric" ) %]
966                                                     <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" />
967                                                 [% ELSE %]
968                                                     <input type="text" id="from" name="dateenrolled"  maxlength="10" size="10" value="[% dateenrolled | html %]" class="datepickerfrom" />
969                                                 [% END %]
970                                                 [% IF ( mandatorydateenrolled ) %]
971                                                     <span class="required">Required</span>
972                                                 [% END %]
973                                                 [% IF ( ERROR_dateenrolled ) %]
974                                                     <span class="required">(Error)</span>
975                                                 [% END %]
976                                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
977                                             </li>
978                                         [% END # /UNLESS nodateenrolled %]
979
980                                         [% UNLESS nodateexpiry %]
981                                             <li>
982                                         [% ELSE %]
983                                             <li style="display:none">
984                                         [% END %]
985                                             [% IF ( mandatorydateexpiry ) %]
986                                                 <label for="to" class="required">
987                                             [% ELSE %]
988                                                 <label for="to">
989                                             [% END %]
990                                                     Expiry date (leave blank for auto calc):
991                                                 </label>
992                                                 [% IF ( dateformat == "metric" ) %]
993                                                     [% UNLESS ( opadd ) %]
994                                                         <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" />
995                                                     [% ELSE %]
996                                                         <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" onchange="CheckDate(document.form.dateexpiry);check_manip_date('verify');" class="datepickerto" />
997                                                     [% END %]
998                                                 [% ELSE %]
999                                                     [% UNLESS ( opadd ) %]
1000                                                         <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% dateexpiry | html UNLESS opduplicate %]" class="datepickerto" />
1001                                                     [% ELSE %]
1002                                                         <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% dateexpiry | html %]" class="datepickerto" />
1003                                                     [% END %]
1004                                                 [% END # /IF ( dateformat == "metric" ) %]
1005                                                 [% IF ( mandatorydateexpiry ) %]
1006                                                     <span class="required">Required</span>
1007                                                 [% END %]
1008                                                 [% IF ( ERROR_dateexpiry ) %]
1009                                                     <span class="required">(Error)</span>
1010                                                 [% END %]
1011                                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1012                                             </li>
1013
1014                                             [% UNLESS noopacnote %]
1015                                                 <li>
1016                                                     [% IF ( mandatoryopacnote ) %]
1017                                                         <label for="opacnote" class="required">
1018                                                     [% ELSE %]
1019                                                         <label for="opacnote">
1020                                                     [% END %]
1021                                                         OPAC note:
1022                                                     </label>
1023                                                     <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% opacnote | html UNLESS opduplicate %]</textarea>
1024                                                     <div class="hint">This message appears on this patron's user page in the OPAC</div>
1025                                                     [% IF ( mandatoryopacnote ) %]
1026                                                         <span class="required">Required</span>
1027                                                     [% END %]
1028                                                 </li>
1029                                             [% END # /UNLESS noopacnote %]
1030
1031                                             [% UNLESS noborrowernotes %]
1032                                                 <li>
1033                                                     [% IF ( mandatoryborrowernotes ) %]
1034                                                         <label for="borrowernotes" class="required">
1035                                                     [% ELSE %]
1036                                                         <label for="borrowernotes">
1037                                                     [% END %]
1038                                                         Circulation note:
1039                                                     </label>
1040                                                     <textarea id="borrowernotes" name="borrowernotes" cols="55" rows="5">[% borrowernotes | html UNLESS opduplicate %]</textarea>
1041                                                     <div class="hint">This message displays when checking out to this patron</div>
1042                                                     [% IF ( mandatoryborrowernotes ) %]
1043                                                         <span class="required">Required</span>
1044                                                     [% END %]
1045                                                 </li>
1046                                             [% END # /UNLESS noborrowernotes %]
1047                                         </ol>
1048                                     </fieldset> <!-- /#memberentry_subscription -->
1049                                 [% END # hide fieldset %]
1050
1051                                 [% UNLESS nouserid && nopassword %]
1052                                     <fieldset class="rows" id="memberentry_userid">
1053                                         <legend id="opac_staff_login_lgd">OPAC/Staff login</legend>
1054                                         <ol>
1055                                             [% UNLESS nouserid %]
1056                                                 <li>
1057                                                     [% IF ( mandatoryuserid ) %]
1058                                                         <label for="userid" class="required">
1059                                                     [% ELSE %]
1060                                                         <label for="userid">
1061                                                     [% END %]
1062                                                         Username:
1063                                                     </label>
1064
1065                                                     [% IF ( NoUpdateLogin ) %]
1066                                                         [% IF ( opduplicate ) %]
1067                                                             <input type="text" id="userid" name="userid" size="20" disabled="disabled" />
1068                                                         [% ELSE %]
1069                                                             <input type="text" id="userid" name="userid" size="20" disabled="disabled" value="[% userid | html %]" />
1070                                                         [% END %]
1071                                                     [% ELSE %]
1072                                                         [% IF ( opduplicate ) %]
1073                                                             <input type="text" id="userid" name="userid" size="20" value="" />
1074                                                         [% ELSE %]
1075                                                             <input type="text" id="userid" name="userid" size="20" value="[% userid | html %]" />
1076                                                         [% END %]
1077                                                     [% END # /IF ( NoUpdateLogin ) %]
1078
1079                                                     [%# Dummy input to avoid Firefox from using userid/password saved for authentication %]
1080                                                     <input type="text" disabled="disabled" style="display:none" />
1081
1082                                                     [% IF ( mandatoryuserid ) %]
1083                                                         <span class="required">Required</span>
1084                                                     [% END %]
1085                                                 </li>
1086                                             [% END # /UNLESS nouserid %]
1087
1088                                             [% UNLESS nopassword %]
1089                                                 <li>
1090                                                     [% IF ( mandatorypassword ) %]
1091                                                         <label for="password" class="required">
1092                                                     [% ELSE %]
1093                                                         <label for="password">
1094                                                     [% END %]
1095                                                         Password:
1096                                                     </label>
1097                                                     [% IF ( opadd ) %]
1098                                                         [% IF ( NoUpdateLogin ) %]
1099                                                             [% IF ( opduplicate ) %]
1100                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" />
1101                                                             [% ELSE %]
1102                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" value="[% password | html %]" />
1103                                                             [% END %]
1104                                                         [% ELSE %]
1105                                                             [% IF ( opduplicate ) %]
1106                                                                 <input type="password" id="password" name="password" size="20" />
1107                                                             [% ELSE %]
1108                                                                 <input type="password" id="password" name="password" size="20" value="[% password | html %]" />
1109                                                             [% END %]
1110                                                         [% END # /IF ( NoUpdateLogin ) %]
1111                                                     [% ELSE # IF ( opadd ) %]
1112
1113                                                         [% IF ( password ) %]
1114                                                             [% IF ( NoUpdateLogin ) %]
1115                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" value="****" />
1116                                                             [% ELSE %]
1117                                                                 [% IF ( opduplicate ) %]
1118                                                                     <input type="password" id="password" name="password" size="20" />
1119                                                                 [% ELSE %]
1120                                                                     <input type="password" id="password" name="password" size="20" value="****" />
1121                                                                 [% END %]
1122                                                             [% END %]
1123                                                         [% ELSE %]
1124                                                             [% IF ( NoUpdateLogin ) %]
1125                                                                 <input type="password" id="password" name="password" size="20"  disabled="disabled" value="" />
1126                                                             [% ELSE %]
1127                                                                 <input type="password" id="password" name="password" size="20" value="" />
1128                                                             [% END %]
1129                                                         [% END # /IF ( password ) %]
1130                                                     [% END # /IF ( opadd )  %]
1131                                                     [% IF ( mandatorypassword ) %]
1132                                                         <span class="required">Required</span>
1133                                                     [% END %]
1134                                                     [% IF ( ERROR_password_too_short ) %]
1135                                                         <span class="required">Password is too short</span>
1136                                                     [% END %]
1137                                                     [% IF ( ERROR_password_too_weak ) %]
1138                                                         <span class="required">Password is too weak</span>
1139                                                     [% END %]
1140                                                     [% IF ( ERROR_password_has_whitespaces ) %]
1141                                                         <span class="required">Password has leading or trailing whitespaces</span>
1142                                                     [% END %]
1143                                                     <div class="hint">Minimum password length: [% minPasswordLength | html %]</div>
1144                                                 </li>
1145
1146                                                 <li>
1147                                                     [% IF ( mandatorypassword ) %]
1148                                                         <label for="password2" class="required">
1149                                                     [% ELSE %]
1150                                                         <label for="password2">
1151                                                     [% END %]
1152                                                         Confirm password:
1153                                                     </label>
1154                                                     [% IF ( opadd ) %]
1155                                                         [% IF ( NoUpdateLogin ) %]
1156                                                             [% IF ( opduplicate ) %]
1157                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" />
1158                                                             [% ELSE %]
1159                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="[% password | html %]" />
1160                                                             [% END %]
1161                                                         [% ELSE %]
1162                                                             [% IF ( opduplicate ) %]
1163                                                                 <input type="password" id="password2" name="password2" size="20" />
1164                                                             [% ELSE %]
1165                                                                 <input type="password" id="password2" name="password2" size="20" value="[% password | html %]" />
1166                                                             [% END %]
1167                                                         [% END %]
1168                                                     [% ELSE # IF ( opadd ) %]
1169                                                         [% IF ( password ) %]
1170                                                             [% IF ( NoUpdateLogin ) %]
1171                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="****" />
1172                                                             [% ELSE %]
1173                                                                 [% IF ( opduplicate ) %]
1174                                                                     <input type="password" id="password2" name="password2" size="20" />
1175                                                                 [% ELSE %]
1176                                                                     <input type="password" id="password2" name="password2" size="20" value="****" />
1177                                                                 [% END %]
1178                                                             [% END %]
1179                                                         [% ELSE %]
1180                                                             [% IF ( NoUpdateLogin ) %]
1181                                                                 <input type="password" id="password2" name="password2" size="20"  disabled="disabled" value="" />
1182                                                             [% ELSE %]
1183                                                                 <input type="password" id="password2" name="password2" size="20" value="" />
1184                                                             [% END %]
1185                                                         [% END %]
1186                                                     [% END # /IF ( opadd ) %]
1187
1188                                                     [% IF ( mandatorypassword ) %]
1189                                                         <span class="required">Required</span>
1190                                                     [% END %]
1191                                                     [% IF ( ERROR_password_mismatch ) %]
1192                                                         <span class="required">Passwords do not match</span>
1193                                                     [% END %]
1194                                                 </li>
1195                                             [% END # /UNLESS nopassword %]
1196                                         </ol>
1197                                     </fieldset> <!-- /#memberentry_userid -->
1198                                 [% END # UNLESS nouserid && nopassword %]
1199
1200                                 <!--this zones are not necessary in modif mode -->
1201                                 [% UNLESS ( opadd || opduplicate ) %]
1202                                     <fieldset class="rows" id="memberentry_account_flags">
1203                                         <legend id="account_flags_lgd">Patron account flags</legend>
1204                                         <ol class="radio">
1205                                             [% FOREACH flagloo IN flagloop %]
1206                                                 <li>
1207                                                     <label class="radio" for="yes[% flagloo.name | html %]">
1208                                                         [% IF ( flagloo.key == 'gonenoaddress' ) %]Gone no address:[% END %]
1209                                                         [% IF ( flagloo.key == 'lost' ) %]Lost card:[% END %]
1210                                                     </label>
1211                                                     [% IF CAN_user_circulate_manage_restrictions %]
1212                                                         <label for="yes[% flagloo.name | html %]">
1213                                                             [% IF ( flagloo.yes ) %]
1214                                                                 <input type="radio" id="yes[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="1" checked="checked" />
1215                                                             [% ELSE %]
1216                                                                 <input type="radio" id="yes[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="1" />
1217                                                             [% END %]
1218                                                                 Yes
1219                                                         </label>
1220                                                         <label for="no[% flagloo.name | html %]">
1221                                                             [% IF ( flagloo.no ) %]
1222                                                                 <input type="radio" id="no[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="0" checked="checked"/>
1223                                                             [% ELSE %]
1224                                                                 <input type="radio" id="no[% flagloo.name | html %]" name="[% flagloo.name | html %]" value="0" />
1225                                                             [% END %]
1226                                                                 No
1227                                                         </label>
1228                                                     [% ELSE %]
1229                                                         [% IF flagloo.yes %]Yes[% ELSE %]No[% END %]
1230                                                     [% END # /IF CAN_user_circulate_manage_restrictions %]
1231                                                 </li>
1232                                             [% END # /FOREACH flagloo %]
1233                                         </ol>
1234                                     </fieldset> <!-- /#memberentry_account_flags -->
1235
1236                                     <fieldset class="rows" id="memberentry_restrictions">
1237                                         <legend id="restrictions_lgd">Patron restrictions</legend>
1238                                         [% IF ( debarments ) %]
1239                                             <table>
1240                                                 <thead>
1241                                                     <tr>
1242                                                          <th>Type</th>
1243                                                          <th>Comment</th>
1244                                                          <th>Expiration</th>
1245                                                          <th>[% tp('patron restriction created on', 'Created') | html %]</th>
1246                                                          [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1247                                                            <th>Remove?</th>
1248                                                          [% END %]
1249                                                     </tr>
1250                                                 </thead>
1251                                                 <tbody>
1252                                                     [% FOREACH d IN debarments %]
1253                                                         <tr>
1254                                                             <td>[% d.type | html %]</td>
1255                                                             <td>
1256                                                                 [% IF d.comment.search('OVERDUES_PROCESS') %]
1257                                                                     Restriction added by overdues process [% d.comment.remove('OVERDUES_PROCESS ') | $raw %]
1258                                                                 [% ELSE %]
1259                                                                     [% d.comment | $raw %]
1260                                                                 [% END %]
1261                                                             </td>
1262                                                             <td>
1263                                                                 [% IF d.expiration %]
1264                                                                     [% d.expiration | $KohaDates %]
1265                                                                 [% ELSE %]
1266                                                                     <i>Indefinite</i>
1267                                                                 [% END %]
1268                                                             </td>
1269                                                             <td>[% d.created | $KohaDates %]</td>
1270                                                             [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1271                                                                 <td>
1272                                                                     <input type="checkbox" id="debarment_[% d.borrower_debarment_id | html %]" name="remove_debarment" value="[% d.borrower_debarment_id | html %]" />
1273                                                                 </td>
1274                                                             [% END %]
1275                                                         </tr>
1276                                                     [% END # /FOREACH d %]
1277                                                 </tbody>
1278                                             </table>
1279                                         [% ELSE %]
1280                                             <p>Patron is currently unrestricted.</p>
1281                                         [% END # /IF ( debarments ) %]
1282
1283                                         [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
1284                                             <p><a href="#" id="add_manual_restriction">Add manual restriction</a></p>
1285                                             <fieldset id="manual_restriction_form">
1286                                                 <input type="hidden" id="add_debarment" name="add_debarment" value="0" />
1287                                                 <legend id="manual_restriction_lgd">Add manual restriction</legend>
1288                                                 <ol>
1289                                                     <li>
1290                                                         <label for="debarred_comment">Comment: </label>
1291                                                         <input type="text" id="debarred_comment" name="debarred_comment" onchange="$('#add_debarment').val(1);" />
1292                                                     </li>
1293                                                     <li>
1294                                                         <label for="debarred_expiration">Expiration: </label>
1295                                                         <input name="debarred_expiration" id="debarred_expiration" size="10" value="" class="datepicker" onchange="$('#add_debarment').val(1);" type="text" />
1296                                                         <a href='javascript:void(0)' onclick="$('#debarred_expiration').val('');">Clear date</a>
1297                                                     </li>
1298                                                 </ol>
1299                                                 <p>
1300                                                     <a class="cancel" id="cancel_manual_restriction" href="#">Cancel</a>
1301                                                 </p>
1302                                             </fieldset> <!-- /#manual_restriction_form -->
1303                                         [% END # /IF CAN_user_borrowers_edit_borrowers %]
1304                                     </fieldset> <!-- /#memberentry_restrictions -->
1305                                 [% END # /UNLESS ( opadd || opduplicate ) %]
1306                             [% END # /IF ( step_3 ) %]
1307
1308                             [% IF ( step_7 ) %]
1309                                 [% IF Koha.Preference('HouseboundModule') %]
1310                                     <fieldset class="rows" id="memberentry_housebound_roles">
1311                                         <legend id="housebound_roles">Housebound roles</legend>
1312                                         <ol class="radio">
1313                                             <li>
1314                                                 <label class="radio" for="housebound_chooser">
1315                                                     Chooser:
1316                                                 </label>
1317                                                 [% IF ( housebound_role.housebound_chooser == 1 ) %]
1318                                                     <label for="yes_housebound_chooser">Yes </label>
1319                                                     <input type="radio" id="yes_housebound_chooser" name="housebound_chooser" value="1" checked="checked" />
1320                                                     <label for="no_housebound_chooser">No </label>
1321                                                     <input type="radio" id="no_housebound_chooser" name="housebound_chooser" value="0" />
1322                                                 [% ELSE %]
1323                                                     <label for="yes_housebound_chooser">Yes </label>
1324                                                     <input type="radio" id="yes_housebound_chooser" name="housebound_chooser" value="1" />
1325                                                     <label for="no_housebound_chooser">No </label>
1326                                                     <input type="radio" id="no_housebound_chooser" name="housebound_chooser" value="0" checked="checked" />
1327                                                 [% END %]
1328                                             </li>
1329                                             <li>
1330                                                 <label class="radio" for="housebound_deliverer">Deliverer:</label>
1331                                                 [% IF ( housebound_role.housebound_deliverer == 1 ) %]
1332                                                     <label for="yes_housebound_deliverer">Yes </label>
1333                                                     <input type="radio" id="yes_housebound_deliverer" name="housebound_deliverer" value="1" checked="checked" />
1334                                                     <label for="no_housebound_deliverer">No </label>
1335                                                     <input type="radio" id="no_housebound_deliverer" name="housebound_deliverer" value="0" />
1336                                                 [% ELSE %]
1337                                                     <label for="yes_housebound_deliverer">Yes </label>
1338                                                     <input type="radio" id="yes_housebound_deliverer" name="housebound_deliverer" value="1" />
1339                                                     <label for="no_housebound_deliverer">No </label>
1340                                                     <input type="radio" id="no_housebound_deliverer" name="housebound_deliverer" value="0" checked="checked" />
1341                                                 [% END %]
1342                                             </li>
1343                                         </ol> <!-- /ol.radio -->
1344                                     </fieldset> <!-- /#memberentry_housebound_roles -->
1345                                 [% END # hide fieldset %]
1346                             [% END # IF step_7 %]
1347
1348                             [% IF ( step_4 ) %]
1349                                 [% IF Koha.Preference('ExtendedPatronAttributes') %]
1350                                     [% UNLESS ( no_patron_attribute_types ) %]
1351                                         <fieldset class="rows" id="memberentry_patron_attributes">
1352                                             <legend id="patron_attributes_lgd">Additional attributes and identifiers</legend>
1353                                             <input type="hidden" name="setting_extended_patron_attributes" value="1" />
1354                                             [% FOREACH pa_loo IN patron_attributes %]
1355                                                 <ol class="attributes_table">
1356                                                     [% IF pa_loo.class %]
1357                                                         <fieldset id="aai_[% pa_loo.class | html %]">
1358                                                         <legend id="[% pa_loo.class | html %]_lgd">[% pa_loo.lib | html %]</legend>
1359                                                     [% END %]
1360                                                     [% FOREACH patron_attribute IN pa_loo.items %]
1361                                                         <li data-category_code="[% patron_attribute.category_code | html %]">
1362                                                             <label for="[% patron_attribute.form_id | html %]">
1363                                                                 [% patron_attribute.description | html %]:
1364                                                             </label>
1365                                                             [% IF ( patron_attribute.use_dropdown ) %]
1366                                                                 <select id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">
1367                                                                     <option value=""></option>
1368                                                                     [% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %]
1369                                                                         [% IF auth_val_loo.authorised_value == patron_attribute.value %]
1370                                                                             <option value="[% auth_val_loo.authorised_value | html %]" selected="selected">
1371                                                                                 [% auth_val_loo.lib | html %]
1372                                                                             </option>
1373                                                                         [% ELSE %]
1374                                                                             <option value="[% auth_val_loo.authorised_value | html %]" >
1375                                                                                 [% auth_val_loo.lib | html %]
1376                                                                             </option>
1377                                                                         [% END %]
1378                                                                     [% END %]
1379                                                                 </select>
1380                                                             [% ELSE %]
1381                                                                 <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">[% patron_attribute.value | html %]</textarea>
1382                                                             [% END # /IF ( patron_attribute.use_dropdown ) %]
1383                                                             <input type="hidden" id="[% patron_attribute.form_id | html %]_code" name="[% patron_attribute.form_id | html %]_code" value="[% patron_attribute.code | html %]" />
1384                                                             <a href="#" onclick="clear_entry(this); return false;"><i class="fa fa-fw fa-trash"></i> Clear</a>
1385                                                             [% IF ( patron_attribute.repeatable ) %]
1386                                                                 <a href="#" onclick="clone_entry(this); return false;"><i class="fa fa-fw fa-plus"></i> New</a>
1387                                                             [% END %]
1388                                                         </li>
1389                                                     [% END # /FOREACH patron_attribute %]
1390                                                     [% IF pa_loo.class %]</fieldset>[% END %]
1391                                                 </ol>
1392                                             [% END # /FOREACH pa_loo %]
1393                                         </fieldset> <!-- /#memberentry_patron_attributes -->
1394                                     [% END # UNLESS ( no_patron_attribute_types ) %]
1395                                 [% END # IF Koha.Preference('ExtendedPatronAttributes') %]
1396                             [% END # IF ( step_4 ) %]
1397
1398                             [% IF ( step_5 ) %]
1399                                 [% IF ( EnhancedMessagingPreferences ) %]
1400                                     <fieldset class="rows" id="memberentry_messaging_prefs">
1401                                         <legend id="patron_messaging_prefs_lgd">Patron messaging preferences</legend>
1402                                         <div id="messaging_prefs_loading" class="form-message" style="display:none">
1403                                             <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading new messaging defaults
1404                                         </div>
1405                                         <input type="hidden" name="setting_messaging_prefs" value="1" />
1406                                         [% INCLUDE 'messaging-preference-form.inc' %]
1407                                         [% IF ( SMSSendDriver ) %]
1408                                             <p>
1409                                                 <label for="SMSnumber">SMS number:</label>
1410                                                 <input type="text" id="SMSnumber" name="SMSnumber" value="[% SMSnumber | html %]" />
1411                                                 <span class="hint">SMS number should be in the format 1234567890 or +11234567890</span>
1412                                             </p>
1413                                             [% UNLESS nosms_provider_id %]
1414                                                 <p>
1415                                                     <label for="sms_provider_id">SMS provider:</label>
1416                                                     <select id="sms_provider_id" name="sms_provider_id">
1417                                                         <option value="">Unknown</option>
1418                                                         [% FOREACH s IN sms_providers %]
1419                                                             [% IF s.id == sms_provider_id %]
1420                                                                 <option value="[% s.id | html %]" selected="selected">[% s.name | html %]</option>
1421                                                             [% ELSE %]
1422                                                                 <option value="[% s.id | html %]">[% s.name | html %]</option>
1423                                                             [% END %]
1424                                                         [% END %]
1425                                                     </select>
1426                                                 </p>
1427                                             [% END # /UNLESS nosms_provider_id %]
1428                                         [% END # IF ( SMSSendDriver ) %]
1429                                     </fieldset>
1430                                 [% END # IF ( EnhancedMessagingPreferences ) %]
1431                             [% END # /IF step_5 %]
1432                         </form> <!-- /#entryform -->
1433
1434                         [% IF quickadd && opadd  && !check_member %]
1435                             <form id="quick_add_form" class="toggler">
1436                                 <fieldset class="rows quick_add"><legend>Quick add</legend>
1437                                     <ol id="quick_add_list">
1438                                     </ol>
1439                                 </fieldset>
1440                             </form>
1441                         [% END %]
1442
1443                     [% END # /UNLESS ( no_add ) %]
1444                 </main>
1445             </div> <!-- /.col-sm-10.col-sm-push-2 -->
1446
1447             [% UNLESS ( opadd ) %]
1448                 <div class="col-sm-2 col-sm-pull-10">
1449                     <aside>
1450                         [% INCLUDE 'circ-menu.inc' %]
1451                     </aside>
1452                 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1453             [% END %]
1454         </div> <!-- /.row -->
1455
1456 [% MACRO jsinclude BLOCK %]
1457     [% Asset.js("lib/hc-sticky.js") | $raw %]
1458     [% INCLUDE 'calendar.inc' %]
1459     [% INCLUDE 'str/members-menu.inc' %]
1460     [% Asset.js("js/members-menu.js") | $raw %]
1461     <script>
1462         function update_cardnumber_warning(size){
1463             var max_len = [% maxlength_cardnumber | html %];
1464             if ( size >= max_len ) {
1465                 $("#cn_max").show();
1466             } else {
1467                 $("#cn_max").hide();
1468             }
1469         }
1470         var Sticky;
1471         function showHideFields(){
1472             [% UNLESS step == 1 %]
1473                 [% IF fieldstohide.match('identity') %]
1474                     $("#memberentry_identity").find('legend').nextAll().toggle();
1475                 [% END %]
1476                 [% IF show_guarantor || guarantor %]
1477                     [% IF fieldstohide.match('guarantor') %]
1478                         $("#memberentry_guarantor").find('legend').nextAll().toggle();
1479                         $("#guarantor_template").toggle();
1480                     [% END %]
1481                 [% END %]
1482                 [% IF fieldstohide.match('primary_address') %]
1483                     $("#memberentry_mainaddress").find('legend').nextAll().toggle();
1484                 [% END %]
1485                 [% IF fieldstohide.match('primary_contact') %]
1486                     $("#memberentry_contact").find('legend').nextAll().toggle();
1487                 [% END %]
1488             [% END %]
1489             [% UNLESS step == 6 %]
1490                 [% IF fieldstohide.match('alt_address') %]
1491                     $("#memberentry_address").find('legend').nextAll().toggle();
1492                 [% END %]
1493             [% END %]
1494             [% UNLESS step == 2 %]
1495                 [% IF fieldstohide.match('alt_contact') %]
1496                     $("#memberentry_altaddress").find('legend').nextAll().toggle();
1497                 [% END %]
1498             [% END %]
1499             [% UNLESS step == 3 %]
1500                 [% IF fieldstohide.match('lib_mgmt') %]
1501                         $("#memberentry_library_management").find('legend').nextAll().toggle();
1502                 [% END %]
1503                 [% UNLESS nodateenrolled && noopacnote && noborrowernotes %]
1504                     [% IF fieldstohide.match('lib_setup') %]
1505                         $("#memberentry_subscription").find('legend').nextAll().toggle();
1506                     [% END %]
1507                 [% END %]
1508                 [% UNLESS nouserid && nopassword %]
1509                     [% IF fieldstohide.match('login') %]
1510                         $("#memberentry_userid").find('legend').nextAll().toggle();
1511                     [% END %]
1512                 [% END %]
1513                 [% UNLESS ( opadd || opduplicate ) %]
1514                     [% IF fieldstohide.match('flags') %]
1515                         $("#memberentry_account_flags").find('legend').nextAll().toggle();
1516                     [% END %]
1517                 [% END %]
1518                 [% IF fieldstohide.match('debarments') %]
1519                     $("#memberentry_restrictions").find('legend').nextAll().toggle();
1520                 [% END %]
1521             [% END %]
1522             [% UNLESS step == 7 %]
1523                 [% IF Koha.Preference('HouseboundModule') %]
1524                     [% IF fieldstohide.match('housebound') %]
1525                         $("#memberentry_housebound_roles").find('legend').nextAll().toggle();
1526                     [% END %]
1527                 [% END %]
1528             [% END %]
1529             [% UNLESS step == 4 %]
1530                 [% IF Koha.Preference('ExtendedPatronAttributes') %]
1531                     [% IF fieldstohide.match('additional') %]
1532                         $("#memberentry_patron_attributes").find('legend').nextAll().toggle();
1533                     [% END %]
1534                 [% END %]
1535             [% END %]
1536             [% UNLESS step == 5 %]
1537                 [% IF Koha.Preference('EnhancedMessagingPreferences') %]
1538                     [% IF fieldstohide.match('messaging') %]
1539                         $("#memberentry_messaging_prefs").find('legend').nextAll().toggle();
1540                         $("#messaging_prefs_loading").toggle();
1541                     [% END %]
1542                 [% END %]
1543             [% END %]
1544         }
1545
1546         $(document).ready(function() {
1547             showHideFields();
1548             $("#toggle_hidden_fields").change(function(){
1549                 showHideFields();
1550             });
1551
1552             $("legend").click(function(){
1553                 $(this).nextAll().toggle();
1554                 $("#messaging_prefs_loading").hide();
1555             });
1556
1557             $("#saverecord").css({ 'margin-left': 0 });
1558
1559             Sticky = $("#toolbar");
1560             Sticky.hcSticky({
1561                 stickTo: "main",
1562                 stickyClass: "floating"
1563             });
1564
1565             [% IF categorycode %]
1566                 update_category_code( "[% categorycode | html %]" );
1567             [% ELSE %]
1568                 if ( $("#categorycode_entry").length > 0 ){
1569                     var category_code = $("#categorycode_entry").find("option:selected").val();
1570                     update_category_code( category_code );
1571                 }
1572             [% END %]
1573
1574             [% IF new_guarantors %]
1575                 [% FOREACH g IN new_guarantors %]
1576                     select_user( '[% g.patron.borrowernumber | html %]', [% To.json( g.patron.unblessed ) | $raw %], '[% g.relationship | html %]' );
1577                 [% END %]
1578             [% END %]
1579
1580             $("#cn_max").hide();
1581             var content;
1582             $("#cardnumber").on("keydown", function(e){
1583                 content = $(this).val();
1584             });
1585             $("#cardnumber").on("keyup", function(e){
1586                 // .val() will return the value of the input after the key has been released
1587                 var l = $(this).val().length;
1588                 if ( l == content.length + 1 ) { l--; }
1589                 update_cardnumber_warning(l);
1590             });
1591             $("#cardnumber").bind("paste", function(e){
1592                 var pastedData = e.originalEvent.clipboardData.getData('text');
1593                 update_cardnumber_warning(pastedData.length - 1);
1594             } );
1595             var toggle_quick_add = $(".toggle_quick_add");
1596             $(toggle_quick_add).click(function(e){
1597                 toggle_quick_add.toggle();
1598                 e.preventDefault();
1599                 var toggle_to = '';
1600                 var toggle_from = '';
1601                 if( $("#entryform:visible").length ) {
1602                     toggle_to = "#quick_add_form label";
1603                     toggle_from = "#entryform label";
1604                     $("#memberentry_guarantor").appendTo("#quick_add_form");
1605                 } else {
1606                     toggle_to="#entryform label";
1607                     toggle_from = "#quick_add_form label";
1608                     $("#memberentry_guarantor").appendTo("#memberentry_guarantor_anchor");
1609                 }
1610                 $(toggle_from).each(function() {
1611                     var input_label = $(this).attr('for');
1612                     if ( input_label == 'sex-male' || input_label == 'sex-none' || input_label == 'sex-female' ) {
1613                         $(toggle_to+"[for='"+input_label+"']").next().prop('checked', $(this).next().prop('checked') );
1614                         return;
1615                     }
1616                     $(toggle_to+"[for='"+input_label+"']").next().val(  $(this).next().val() );
1617                 });
1618
1619                 $(".toggler").toggle();
1620             });
1621
1622             $("#save_quick_add").click(function(){
1623                 $("#quick_add_form").validate();
1624                 if( $("#quick_add_form").valid()){
1625                     $('.toggle_quick_add').click();
1626                     $("#memberentry_guarantor").appendTo("#memberentry_guarantor_anchor");
1627                     $('#saverecord').click();
1628                 }
1629                 else {return false;}
1630             });
1631
1632             $("#saverecord").click(function(){
1633                 if( check_form_borrowers() ){
1634                     $("#entryform").submit();
1635                 }
1636             });
1637
1638             $('#duplicate').on('click', function() {
1639                 $("input[name='op']").val('modify');
1640                 $("input[name='borrowernumber']").val('[% check_member | html %]');
1641                 $("input[name='check_member']").val('');
1642                 $('#entryform').submit();
1643             });
1644
1645             $('#not-duplicate').on('click', function() {
1646                 $("input[name='nodouble']").val('1');
1647                 $('#entryform').submit();
1648             });
1649         });
1650
1651         var MSG_SEPARATOR = _("Separator must be / in field %s");
1652         var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
1653         var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s");
1654         var MSG_INCORRECT_YEAR = _("Invalid year entered in field %s");
1655         var MSG_DUPLICATE_PATRON = _("Warning: Duplicate patron");
1656         var MSG_DUPLICATE_ORGANIZATION = _("Warning: Duplicate organization");
1657         var MSG_LATE_EXPIRY = _("Warning: Expiration date falls before enrollment date");
1658         var MSG_DUPLICATE_SUSPICION = _("Please confirm whether this is a duplicate patron");
1659         var MSG_MONTH = _("%s month")
1660         var MSG_MONTHS = _("%s months")
1661         var MSG_YEAR = _("%s year")
1662         var MSG_YEARS = _("%s years")
1663         var LABEL_CHANGE = _("Change");
1664         var LABEL_SET_TO_PATRON = _("Set to patron");
1665         var LABEL_AGE = _("Age");
1666         var MSG_MESSAGING_DFEAULTS = _("Change messaging preferences to default for this category?");
1667
1668         [% IF quickadd && opadd  && !check_member %]
1669             $(document).ready(function () {
1670
1671                 $("#entryform,#saverecord").hide();
1672                 [% q_add_f = Koha.Preference('PatronQuickAddFields').split('\|') %]
1673                 var qaddfields = [[% FOREACH field IN q_add_f.unique %]"[% field | html %]",[% END %]];
1674                 $("#entryform label").each(function () {
1675                     var input_label = $(this).attr('for');
1676                     if ( input_label == 'sex-female' ) {
1677                         input_label='sex';
1678                     }
1679                     else if ( input_label == 'btitle' ) {
1680                         input_label='title';
1681                     }
1682                     if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){
1683                        $(this).parent().clone().appendTo("#quick_add_list");
1684                        [% UNLESS mandatorypassword %]
1685                              if( input_label == 'password' ) $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list");
1686                        [% END %]
1687                     }
1688                 });
1689                 if ( $("#memberentry_guarantor").length ) {
1690                     $("#memberentry_guarantor").appendTo("#quick_add_form");
1691                 }
1692                 $("#quick_add_form").show();
1693             });
1694         [% END %]
1695         $("#guarantor_template").hide();
1696
1697     </script>
1698     [% Asset.js("js/members.js") | $raw %]
1699     [% Asset.js("js/messaging-preference-form.js") | $raw %]
1700     [% PROCESS 'password_check.inc' %]
1701     [% PROCESS 'add_password_check' new_password => 'password' %]
1702 [% END %]
1703
1704 [% INCLUDE 'intranet-bottom.inc' %]