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