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