Bug 14659: Allow patrons to enter card number and patron category on OPAC registratio...
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-memberentry.tt
1 [% USE Categories %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% SET userupdateview = 1 %]
5
6 [% INCLUDE 'doc-head-open.inc' %]
7     <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; [% IF action == 'edit' %]Update your personal details[% ELSE %]Register a new account[% END %]</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 [% BLOCK cssinclude %][% END %]
10 </head>
11
12 [% IF action == 'edit' %]
13 [% INCLUDE 'bodytag.inc' bodyid='opac-patron-update' %]
14 [% ELSE %]
15 <body id="opac-patron-registration" class="opac">
16 [% END %]
17 [% INCLUDE 'masthead.inc' %]
18
19 <div class="main">
20     <ul class="breadcrumb">
21         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
22         [% IF action == 'edit' %]
23             <li><a href="/cgi-bin/koha/opac-user.pl">[% borrower.firstname %] [% borrower.surname %]</a> <span class="divider">&rsaquo;</span></li>
24             <li><a href="#">Your personal details</a></li>
25         [% ELSE %]
26             <li><a href="#">Register a new account</a></li>
27         [% END %]
28     </ul>
29
30     <div class="container-fluid">
31         <div class="row-fluid">
32             <div class="span2">
33                 <div id="navigation">
34                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
35                 </div>
36             </div>
37             <div class="span10">
38                 [% IF action == 'edit' %]
39                     <div id="update-account">
40                 [% ELSE %]
41                     <div id="add-account">
42                 [% END %]
43
44                 [% IF action == 'edit' %]
45                     [% UNLESS OPACPatronDetails %]
46                         <div class="alert alert-info">To make changes to your record please contact the library.</div>
47                     [% END %]
48                     [% IF nochanges %]
49                         <div class="alert alert-error">No changes were made.</div>
50                     [% END %]
51                 [% END %]
52
53                 [% IF empty_mandatory_fields %]
54                     <div class="alert">You have not filled out all required fields. Please fill in all missing fields and resubmit.</div>
55                 [% END %]
56
57                 [% IF invalid_form_fields %]
58                     <div class="alert alert-error"><strong>The following fields contain invalid information:</strong>
59                         <ul>
60                             [% FOREACH field IN invalid_form_fields %]
61                                 [% IF field == "email" %]<li>Contact information: <a href="#borrower_email">primary email address</a></li>[% END %]
62                                 [% IF field == "emailpro" %]<li>Contact information: <a href="#borrower_emailpro">secondary email address</a></li>[% END %]
63                                 [% IF field == "B_email" %]<li>Alternate address information: <a href="#borrower_B_email">email address</a></li>[% END %]
64                                 [% IF field == "password_match" %]<li>Passwords do not match! <a href="#password">password</a></li>[% END %]
65                                 [% IF field == "password_invalid" %]<li>Password does not meet minimum requirements! <a href="#password">password</a></li>[% END %]
66                                 [% IF field == "password_spaces" %]<li>Password contains leading and/or trailing spaces! <a href="#password">password</a></li>[% END %]
67                             [% END %]
68                         </ul>
69                         Please correct the errors and resubmit.
70                     </div>
71                 [% END %]
72
73                 [% IF cardnumber_wrong_length || cardnumber_already_exists %]
74                     <div class="alert alert-error">
75                         [% IF cardnumber_wrong_length %]
76                         <strong>The entered <a href="#borrower_cardnumber">card number</a> is the wrong length.</strong>
77                         [% ELSIF cardnumber_already_exists %]
78                         <strong>The entered <a href="#borrower_cardnumber">card number</a> is already in use.</strong>
79                         [% END %]
80                         Please correct this and resubmit.
81                     </div>
82                 [% END %]
83
84                 [% IF failed_captcha %]
85                     <div class="alert">You typed in the wrong characters in the box before submitting. Please try again.</div>
86                 [% END %]
87
88                 [% IF borrower.guarantorid && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
89                     <fieldset class="rows" id="memberentry_privacy">
90                         <legend id="privacy_legend">Privacy</legend>
91                         <ol>
92                             <li>
93                                 <label>Allow your guarantor to view your current checkouts?</label>
94                                 <select id="privacy_guarantor_checkouts">
95                                     <option value="0">No</option>
96                                     [% IF borrower.privacy_guarantor_checkouts %]
97                                         <option value="1" selected="selected">Yes</option>
98                                     [% ELSE %]
99                                         <option value="1">Yes</option>
100                                     [% END %]
101                                 </select>
102                                 <span class="hint">
103                                     <a id="update_privacy_guarantor_checkouts" href="#" class="btn">Update</a>
104                                     <span id="update_privacy_guarantor_checkouts_message" class="alert" style="display:none"></span>
105                                 </span>
106                                 <span class="hint">
107                                     Your guarantor is <i>[% guarantor.firstname %] [% guarantor.surname %]</i>
108                                 </span>
109                             </li>
110                         </ol>
111                     </fieldset>
112                 [% END %]
113
114                 <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form">
115
116                 [% UNLESS hidden.defined('branchcode') %]
117                     <fieldset class="rows" id="memberentry_library">
118
119                         <legend id="library_legend">Library</legend>
120                             <ol>
121                                 [% UNLESS hidden.defined('cardnumber') || Koha.Preference('autoMemberNum') %]
122                                 <li>
123                                     [% IF mandatory.defined('cardnumber') %]
124                                         <label for="borrower_cardnumber" class="required">
125                                     [% ELSE %]
126                                         <label for="borrower_cardnumber">
127                                     [% END %]
128                                     Library card number:
129                                     </label>
130                                     [% IF borrower %]
131                                         <input type="text" id="borrower_cardnumber" name="borrower_cardnumber" value="[% borrower.cardnumber %]" />
132                                         [% IF mandatory.defined('cardnumber') %]<span class="required">Required</span>[% END %]
133                                     [% ELSE %]
134                                         [% borrower.cardnumber %]
135                                     [% END %]
136                                 </li>
137                                 [% END %]
138
139                                 [% UNLESS hidden.defined('dateexpiry') %]
140                                 <li>
141                                     <label>Expiration date:</label>
142                                     [% borrower.dateexpiry | $KohaDates  %]
143                                 </li>
144                                 [% END %]
145
146                                 [% UNLESS hidden.defined('branchcode') %]
147                                     <li>
148                                         [% IF mandatory.defined('branchcode') %]
149                                             <label for="borrower_branchcode" class="required">
150                                         [% ELSE %]
151                                             <label for="borrower_branchcode">
152                                         [% END %]
153                                         Home library:</label>
154
155                                         <select id="borrower_branchcode" name="borrower_branchcode">
156                                             [% FOREACH b IN branches %]
157                                                 [% IF b.value == borrower.branchcode %]
158                                                     <option value="[% b.value %]" selected="selected">[% b.branchname %]</option>
159                                                 [% ELSE %]
160                                                     <option value="[% b.value %]">[% b.branchname %]</option>
161                                                 [% END %]
162                                             [% END %]
163                                         </select>
164                                     </li>
165                                 [% END %]
166
167                                 [% UNLESS hidden.defined('categorycode') %]
168                                     <li>
169                                         <label for="borrower_categorycode">
170                                         Category:</label>
171
172                                         [% IF borrower %]
173                                             <select id="borrower_categorycode" name="borrower_categorycode">
174                                                 [% FOREACH c IN Categories.all() %]
175                                                     [% IF c.categorycode == Koha.Preference('PatronSelfRegistrationDefaultCategory') %]
176                                                         <option value="[% c.categorycode %]" selected="selected">[% c.description %]</option>
177                                                     [% ELSE %]
178                                                         <option value="[% c.categorycode %]">[% c.description %]</option>
179                                                     [% END %]
180                                                 [% END %]
181                                             </select>
182                                         [% ELSE %]
183                                             [% Categories.GetName( borrower.categorycode ) %]
184                                         [% END %]
185                                     </li>
186                                 [% END %]
187                             </ol>
188                         </fieldset>
189                 [% END # / defined 'branchcode' %]
190
191                 [% UNLESS
192                     hidden.defined('title') && hidden.defined('surname') && hidden.defined('firstname') &&
193                     hidden.defined('dateofbirth') && hidden.defined('initials') && hidden.defined('othernames') &&
194                     hidden.defined('sex')
195                 %]
196                     <div class="row-fluid">
197                         [% IF ( display_patron_image ) %]
198                             <div class="span8">
199                         [% ELSE %]
200                             <div class="span12">
201                         [% END %]
202                             <fieldset class="rows" id="memberentry_identity">
203                                 <legend id="identity_legend">Identity</legend>
204
205                                 <ol>
206                                     [% UNLESS hidden.defined('title') || !member_titles %]
207                                         <li>
208                                             [% IF mandatory.defined('title') %]
209                                                 <label for="borrower_title" class="required">
210                                             [% ELSE %]
211                                                 <label for="borrower_title">
212                                             [% END %]
213                                             Salutation:</label>
214
215                                             <select id="borrower_title" name="borrower_title">
216                                                 [% FOREACH mt IN member_titles %]
217                                                     [% IF mt == borrower.title %]
218                                                         <option value="[% mt %]" selected="selected">[% mt %]</option>
219                                                     [% ELSE %]
220                                                         <option value="[% mt %]">[% mt %]</option>
221                                                     [% END %]
222                                                 [% END %]
223                                             </select>
224                                         </li>
225                                     [% END %]
226
227                                     [% UNLESS hidden.defined('surname') %]
228                                         <li>
229                                             [% IF mandatory.defined('surname') %]
230                                                 <label for="borrower_surname" class="required">
231                                             [% ELSE %]
232                                                 <label for="borrower_surname">
233                                             [% END %]
234                                             Surname:</label>
235
236                                             <input type="text" id="borrower_surname" name="borrower_surname" value="[% borrower.surname %]" />
237                                             [% IF mandatory.defined('surname') %]<span class="required">Required</span>[% END %]
238                                         </li>
239                                     [% END %]
240
241                                     [% UNLESS hidden.defined('firstname') %]
242                                         <li>
243                                             [% IF mandatory.defined('firstname') %]
244                                                 <label for="borrower_firstname" class="required">
245                                             [% ELSE %]
246                                                 <label for="borrower_firstname">
247                                             [% END %]
248                                             First name:</label>
249
250                                             <input type="text" id="borrower_firstname" name="borrower_firstname" value="[% borrower.firstname %]" />
251                                             [% IF mandatory.defined('firstname') %]<span class="required">Required</span>[% END %]
252                                         </li>
253                                     [% END %]
254
255                                     [% UNLESS hidden.defined('dateofbirth') %]
256                                         <li>
257                                             [% IF mandatory.defined('dateofbirth') %]
258                                                 <label for="borrower_dateofbirth" class="required">
259                                             [% ELSE %]
260                                                 <label for="borrower_dateofbirth">
261                                             [% END %]
262                                             Date of birth:</label>
263
264                                             <input type="text" id="borrower_dateofbirth" name="borrower_dateofbirth" value="[% borrower.dateofbirth | $KohaDates %]" size="10" />
265
266                                             [% UNLESS action == 'edit' && !OPACPatronDetails %]
267                                                 [% UNLESS ( mandatory.defined('dateofbirth') ) %]
268                                                     <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('borrower_dateofbirth').value='';return false;">Clear date</a>
269                                                 [% END %]
270                                             [% END %]
271
272                                             [% IF mandatory.defined('dateofbirth') %]<span class="required">Required</span>[% END %]
273                                         </li>
274                                     [% END %]
275
276                                     [% UNLESS hidden.defined('initials') %]
277                                         <li>
278                                             [% IF mandatory.defined('initials') %]
279                                                 <label for="borrower_initials" class="required">
280                                             [% ELSE %]
281                                                 <label for="borrower_initials">
282                                             [% END %]
283                                             Initials:</label>
284
285                                             <input type="text" id="borrower_initials" name="borrower_initials" value="[% borrower.initials %]" />
286                                             [% IF mandatory.defined('initials') %]<span class="required">Required</span>[% END %]
287                                         </li>
288                                     [% END %]
289
290                                     [% UNLESS hidden.defined('othernames') %]
291                                         <li>
292                                             [% IF mandatory.defined('othernames') %]
293                                                 <label for="borrower_othernames" class="required">
294                                             [% ELSE %]
295                                                 <label for="borrower_othernames">
296                                             [% END %]
297                                             Other names:</label>
298
299                                             <input type="text" id="borrower_othernames" name="borrower_othernames" value="[% borrower.othernames %]" />
300                                             [% IF mandatory.defined('othernames') %]<span class="required">Required</span>[% END %]
301                                         </li>
302                                     [% END %]
303
304                                     [% UNLESS hidden.defined('sex') %]
305                                         <li class="lradio">
306                                             <label for="sex-female" class="radio inline">Female:</label>
307                                             [% IF borrower.sex == 'F' %]
308                                                 <input type="radio" name="borrower_sex" id="sex-female" value="F" checked="checked" />
309                                             [% ELSE %]
310                                                 <input type="radio" name="borrower_sex" id="sex-female" value="F" />
311                                             [% END %]
312
313                                             <label for="sex-male" class="radio inline">Male:</label>
314                                             [% IF borrower.sex == 'M' %]
315                                                 <input type="radio" name="borrower_sex" id="sex-male" value="M" checked="checked" />
316                                             [% ELSE %]
317                                                 <input type="radio" name="borrower_sex" id="sex-male" value="M" />
318                                             [% END %]
319
320                                             <label for="sex-none" class="radio inline">None specified: </label>
321                                             [% IF borrower.sex == '' %]
322                                                 <input type="radio" name="borrower_sex" id="sex-none" value="" checked="checked" />
323                                             [% ELSE %]
324                                                 <input type="radio" name="borrower_sex" id="sex-none" value="" />
325                                             [% END %]
326
327                                             [% IF mandatory.defined('sex') %]<span class="required">Required</span>[% END %]
328                                         </li>
329                                     [% END %]
330                                 </ol>
331                             </fieldset>
332                            </div>
333                         [% IF ( display_patron_image ) %]
334                             <div class="span4">
335                                 <p class="patronimage">
336                                    <img src="/cgi-bin/koha/opac-patron-image.pl" alt="" />
337                                 </p>
338                             </div>
339                         [% END %]
340                     </div>
341                 [% END # /UNLESS fields hidden %]
342
343                 [% UNLESS
344                     hidden.defined('streetnumber') && hidden.defined('address') && hidden.defined('address2') &&
345                     hidden.defined('city') && hidden.defined('state') && hidden.defined('zipcode') &&
346                     hidden.defined('country')
347                 %]
348                     <fieldset class="rows" id="memberentry_mainaddress">
349                         <legend id="mainaddress_legend">Main address</legend>
350
351                         <ol>
352                             [% UNLESS hidden.defined('streetnumber') %]
353                                 <li>
354                                     [% IF mandatory.defined('streetnumber') %]
355                                         <label for="borrower_streetnumber" class="required">
356                                     [% ELSE %]
357                                         <label for="borrower_streetnumber">
358                                     [% END %]
359                                     Street number:</label>
360
361                                     <input type="text" id="borrower_streetnumber" name="borrower_streetnumber" value="[% borrower.streetnumber %]" />
362                                     [% IF mandatory.defined('streetnumber') %]<span class="required">Required</span>[% END %]
363                                 </li>
364                             [% END %]
365
366                             [% UNLESS hidden.defined('address') %]
367                                 <li>
368                                     [% IF mandatory.defined('address') %]
369                                         <label for="borrower_address" class="required">
370                                     [% ELSE %]
371                                         <label for="borrower_address">
372                                     [% END %]
373                                     Address:</label>
374
375                                     <input type="text" id="borrower_address" name="borrower_address" value="[% borrower.address %]" />
376                                     [% IF mandatory.defined('address') %]<span class="required">Required</span>[% END %]
377                                 </li>
378                             [% END %]
379
380                             [% UNLESS hidden.defined('address2') %]
381                                 <li>
382                                     [% IF mandatory.defined('address2') %]
383                                         <label for="borrower_address2" class="required">
384                                     [% ELSE %]
385                                         <label for="borrower_address2">
386                                     [% END %]
387                                     Address 2:</label>
388
389                                     <input type="text" id="borrower_address2" name="borrower_address2" value="[% borrower.address2 %]" />
390                                     [% IF mandatory.defined('address2') %]<span class="required">Required</span>[% END %]
391                                 </li>
392                             [% END %]
393
394                             [% UNLESS hidden.defined('city') %]
395                                 <li>
396                                     [% IF mandatory.defined('city') %]
397                                         <label for="borrower_city" class="required">
398                                     [% ELSE %]
399                                         <label for="borrower_city">
400                                     [% END %]
401                                     City:</label>
402
403                                     <input type="text" id="borrower_city" name="borrower_city" value="[% borrower.city %]" />
404                                     [% IF mandatory.defined('city') %]<span class="required">Required</span>[% END %]
405                                 </li>
406                             [% END %]
407
408                             [% UNLESS hidden.defined('state') %]
409                                 <li>
410                                     [% IF mandatory.defined('state') %]
411                                         <label for="borrower_state" class="required">
412                                     [% ELSE %]
413                                         <label for="borrower_state">
414                                     [% END %]
415                                     State:</label>
416
417                                     <input type="text" id="borrower_state" name="borrower_state" value="[% borrower.state %]" />
418                                     [% IF mandatory.defined('state') %]<span class="required">Required</span>[% END %]
419                                 </li>
420                             [% END %]
421
422                             [% UNLESS hidden.defined('zipcode') %]
423                                 <li>
424                                     [% IF mandatory.defined('zipcode') %]
425                                         <label for="borrower_zipcode" class="required">
426                                     [% ELSE %]
427                                         <label for="borrower_zipcode">
428                                     [% END %]
429                                     ZIP/Postal code:</label>
430
431                                     <input type="text" id="borrower_zipcode" name="borrower_zipcode" value="[% borrower.zipcode %]" />
432                                     [% IF mandatory.defined('zipcode') %]<span class="required">Required</span>[% END %]
433                                 </li>
434                             [% END %]
435
436                             [% UNLESS hidden.defined('country') %]
437                                 <li>
438                                     [% IF mandatory.defined('country') %]
439                                         <label for="borrower_country" class="required">
440                                     [% ELSE %]
441                                         <label for="borrower_country">
442                                     [% END %]
443                                     Country:</label>
444
445                                     <input type="text" id="borrower_country" name="borrower_country" value="[% borrower.country %]" />
446                                     [% IF mandatory.defined('country') %]<span class="required">Required</span>[% END %]
447                                 </li>
448                             [% END %]
449
450                         </ol>
451                     </fieldset>
452                 [% END %]
453
454                 [% UNLESS
455                     hidden.defined('phone') && hidden.defined('phonepro') && hidden.defined('mobile') &&
456                     hidden.defined('email') && hidden.defined('emailpro') && hidden.defined('fax')
457                 %]
458                     <fieldset class="rows" id="memberentry_contact">
459                         <legend id="contact_legend">Contact information</legend>
460
461                         <ol>
462                             [% UNLESS hidden.defined('phone') %]
463                                 <li>
464                                     [% IF mandatory.defined('phone') %]
465                                         <label for="borrower_phone" class="required">
466                                     [% ELSE %]
467                                         <label for="borrower_phone">
468                                     [% END %]
469                                     Primary phone:</label>
470
471                                     <input type="text" id="borrower_phone" name="borrower_phone" value="[% borrower.phone %]" />
472                                     [% IF mandatory.defined('phone') %]<span class="required">Required</span>[% END %]
473                                 </li>
474                             [% END %]
475
476                             [% UNLESS hidden.defined('phonepro') %]
477                                 <li>
478                                     [% IF mandatory.defined('phonepro') %]
479                                         <label for="borrower_phonepro" class="required">
480                                     [% ELSE %]
481                                         <label for="borrower_phonepro">
482                                     [% END %]
483                                     Secondary phone:</label>
484
485                                     <input type="text" id="borrower_phonepro" name="borrower_phonepro" value="[% borrower.phonepro %]" />
486                                     [% IF mandatory.defined('phonepro') %]<span class="required">Required</span>[% END %]
487                                 </li>
488                             [% END %]
489
490                             [% UNLESS hidden.defined('mobile') %]
491                                 <li>
492                                     [% IF mandatory.defined('mobile') %]
493                                         <label for="borrower_mobile" class="required">
494                                     [% ELSE %]
495                                         <label for="borrower_mobile">
496                                     [% END %]
497                                     Other phone:</label>
498
499                                     <input type="text" id="borrower_mobile" name="borrower_mobile" value="[% borrower.mobile %]" />
500                                     [% IF mandatory.defined('mobile') %]<span class="required">Required</span>[% END %]
501                                 </li>
502                             [% END %]
503
504                             [% UNLESS hidden.defined('email') %]
505                                 <li>
506                                     [% IF mandatory.defined('email') %]
507                                         <label for="borrower_email" class="required">
508                                     [% ELSE %]
509                                         <label for="borrower_email">
510                                     [% END %]
511                                     Primary email:</label>
512
513                                     <input type="text" id="borrower_email" name="borrower_email" value="[% borrower.email %]" />
514                                     [% IF mandatory.defined('email') %]<span class="required">Required</span>[% END %]
515                                 </li>
516                             [% END %]
517
518                             [% UNLESS hidden.defined('emailpro') %]
519                                 <li>
520                                     [% IF mandatory.defined('emailpro') %]
521                                         <label for="borrower_emailpro" class="required">
522                                     [% ELSE %]
523                                         <label for="borrower_emailpro">
524                                     [% END %]
525                                     Secondary email:</label>
526
527                                     <input type="text" id="borrower_emailpro" name="borrower_emailpro" value="[% borrower.emailpro %]" />
528                                     [% IF mandatory.defined('emailpro') %]<span class="required">Required</span>[% END %]
529                                 </li>
530                             [% END %]
531
532                             [% UNLESS hidden.defined('fax') %]
533                                 <li>
534                                     [% IF mandatory.defined('fax') %]
535                                         <label for="borrower_fax" class="required">
536                                     [% ELSE %]
537                                         <label for="borrower_fax">
538                                     [% END %]
539                                     Fax:</label>
540
541                                     <input type="text" id="borrower_fax" name="borrower_fax" value="[% borrower.fax %]" />
542                                     [% IF mandatory.defined('fax') %]<span class="required">Required</span>[% END %]
543                                 </li>
544                             [% END %]
545                         </ol>
546                     </fieldset>
547                 [% END %]
548
549                 [% UNLESS
550                     hidden.defined('B_address') && hidden.defined('B_address2') && hidden.defined('B_city') &&
551                     hidden.defined('B_state') && hidden.defined('B_zipcode') && hidden.defined('B_country') &&
552                     hidden.defined('B_phone') && hidden.defined('B_email') && hidden.defined('contactnote')
553                 %]
554                     <fieldset class="rows" id="memberentry_alternateaddress">
555                         <legend id="alternateaddress_legend">Alternate address</legend>
556
557                         <ol>
558                             [% UNLESS hidden.defined('B_address') %]
559                                 <li>
560                                     [% IF mandatory.defined('B_address') %]
561                                         <label for="borrower_B_address" class="required">
562                                     [% ELSE %]
563                                         <label for="borrower_B_address">
564                                     [% END %]
565                                     Address:</label>
566
567                                     <input type="text" id="borrower_B_address" name="borrower_B_address" value="[% borrower.B_address %]" />
568                                     [% IF mandatory.defined('B_address') %]<span class="required">Required</span>[% END %]
569                                 </li>
570                             [% END %]
571
572                             [% UNLESS hidden.defined('B_address2') %]
573                                 <li>
574                                     [% IF mandatory.defined('B_address2') %]
575                                         <label for="borrower_B_address2" class="required">
576                                     [% ELSE %]
577                                         <label for="borrower_B_address2">
578                                     [% END %]
579                                     Address 2:</label>
580
581                                     <input type="text" id="borrower_B_address2" name="borrower_B_address2" value="[% borrower.B_address2 %]" />
582                                     [% IF mandatory.defined('B_address2') %]<span class="required">Required</span>[% END %]
583                                 </li>
584                             [% END %]
585
586                             [% UNLESS hidden.defined('B_city') %]
587                                 <li>
588                                     [% IF mandatory.defined('B_city') %]
589                                         <label for="borrower_B_city" class="required">
590                                     [% ELSE %]
591                                         <label for="borrower_B_city">
592                                     [% END %]
593                                     City:</label>
594
595                                     <input type="text" id="borrower_B_city" name="borrower_B_city" value="[% borrower.B_city %]" />
596                                     [% IF mandatory.defined('B_city') %]<span class="required">Required</span>[% END %]
597                                 </li>
598                             [% END %]
599
600                             [% UNLESS hidden.defined('B_state') %]
601                                 <li>
602                                     [% IF mandatory.defined('B_state') %]
603                                         <label for="borrower_B_state" class="required">
604                                     [% ELSE %]
605                                         <label for="borrower_B_state">
606                                     [% END %]
607                                     State:</label>
608
609                                     <input type="text" id="borrower_B_state" name="borrower_B_state" value="[% borrower.B_state %]" />
610                                     [% IF mandatory.defined('B_state') %]<span class="required">Required</span>[% END %]
611                                 </li>
612                             [% END %]
613
614                             [% UNLESS hidden.defined('B_zipcode') %]
615                                 <li>
616                                     [% IF mandatory.defined('B_zipcode') %]
617                                         <label for="borrower_B_zipcode" class="required">
618                                     [% ELSE %]
619                                         <label for="borrower_B_zipcode">
620                                     [% END %]
621                                     ZIP/Postal code:</label>
622
623                                     <input type="text" id="borrower_B_zipcode" name="borrower_B_zipcode" value="[% borrower.B_zipcode %]" />
624                                     [% IF mandatory.defined('B_zipcode') %]<span class="required">Required</span>[% END %]
625                                 </li>
626                             [% END %]
627
628                             [% UNLESS hidden.defined('B_country') %]
629                                 <li>
630                                     [% IF mandatory.defined('B_country') %]
631                                         <label for="borrower_B_country" class="required">
632                                     [% ELSE %]
633                                         <label for="borrower_B_country">
634                                     [% END %]
635                                     Country:</label>
636
637                                     <input type="text" id="borrower_B_country" name="borrower_B_country" value="[% borrower.B_country %]" />
638                                     [% IF mandatory.defined('B_country') %]<span class="required">Required</span>[% END %]
639                                 </li>
640                             [% END %]
641
642                             [% UNLESS hidden.defined('B_phone') %]
643                                 <li>
644                                     [% IF mandatory.defined('B_phone') %]
645                                         <label for="borrower_B_phone" class="required">
646                                     [% ELSE %]
647                                         <label for="borrower_B_phone">
648                                     [% END %]
649                                     Phone:</label>
650
651                                     <input type="text" id="borrower_B_phone" name="borrower_B_phone" value="[% borrower.B_phone %]" />
652                                     [% IF mandatory.defined('B_phone') %]<span class="required">Required</span>[% END %]
653                                 </li>
654                             [% END %]
655
656                             [% UNLESS hidden.defined('B_email') %]
657                                 <li>
658                                     [% IF mandatory.defined('B_email') %]
659                                         <label for="borrower_B_email" class="required">
660                                     [% ELSE %]
661                                         <label for="borrower_B_email">
662                                     [% END %]
663                                     Email:</label>
664
665                                     <input type="text" id="borrower_B_email" name="borrower_B_email" value="[% borrower.B_email %]" />
666                                     [% IF mandatory.defined('B_email') %]<span class="required">Required</span>[% END %]
667                                 </li>
668                             [% END %]
669
670                             [% UNLESS hidden.defined('contactnote') %]
671                                 <li>
672                                     [% IF mandatory.defined('contactnote') %]
673                                         <label for="borrower_contactnote" class="required">
674                                     [% ELSE %]
675                                         <label for="borrower_contactnote">
676                                     [% END %]
677                                     Contact note:</label>
678
679                                     <textarea id="borrower_contactnote" name="borrower_contactnote" cols="30" rows="2">[% borrower.contactnote %]</textarea>
680                                     [% IF mandatory.defined('contactnote') %]<span class="required">Required</span>[% END %]
681                                 </li>
682                             [% END %]
683
684                         </ol>
685                     </fieldset>
686                 [% END %]
687
688                 [% UNLESS
689                     hidden.defined('altcontactsurname') && hidden.defined('altcontactfirstname') && hidden.defined('altcontactaddress1') &&
690                     hidden.defined('altcontactaddress2') && hidden.defined('altcontactaddress3') && hidden.defined('altcontactstate') &&
691                     hidden.defined('altcontactzipcode') && hidden.defined('altcontactcountry') && hidden.defined('altcontactphone')
692                 %]
693                     <fieldset class="rows" id="memberentry_alternatecontact">
694                         <legend id="alternatecontact_legend">Alternate contact</legend>
695
696                         <ol>
697                             [% UNLESS hidden.defined('altcontactsurname') %]
698                                 <li>
699                                     [% IF mandatory.defined('altcontactsurname') %]
700                                         <label for="borrower_altcontactsurname" class="required">
701                                     [% ELSE %]
702                                         <label for="borrower_altcontactsurname">
703                                     [% END %]
704                                     Surname:</label>
705
706                                     <input type="text" id="borrower_altcontactsurname" name="borrower_altcontactsurname" value="[% borrower.altcontactsurname %]" />
707                                     [% IF mandatory.defined('altcontactsurname') %]<span class="required">Required</span>[% END %]
708                                 </li>
709                             [% END %]
710
711                             [% UNLESS hidden.defined('altcontactfirstname') %]
712                                 <li>
713                                     [% IF mandatory.defined('altcontactfirstname') %]
714                                         <label for="borrower_altcontactfirstname" class="required">
715                                     [% ELSE %]
716                                         <label for="borrower_altcontactfirstname">
717                                     [% END %]
718                                     First name:</label>
719
720                                     <input type="text" id="borrower_altcontactfirstname" name="borrower_altcontactfirstname" value="[% borrower.altcontactfirstname %]" />
721                                     [% IF mandatory.defined('altcontactfirstname') %]<span class="required">Required</span>[% END %]
722                                 </li>
723                             [% END %]
724
725                             [% UNLESS hidden.defined('altcontactaddress1') %]
726                                 <li>
727                                     [% IF mandatory.defined('altcontactaddress1') %]
728                                         <label for="borrower_altcontactaddress1" class="required">
729                                     [% ELSE %]
730                                         <label for="borrower_altcontactaddress1">
731                                     [% END %]
732                                     Address:</label>
733
734                                     <input type="text" id="borrower_altcontactaddress1" name="borrower_altcontactaddress1" value="[% borrower.altcontactaddress1 %]" />
735                                     [% IF mandatory.defined('altcontactaddress1') %]<span class="required">Required</span>[% END %]
736                                 </li>
737                             [% END %]
738
739                             [% UNLESS hidden.defined('altcontactaddress2') %]
740                                 <li>
741                                     [% IF mandatory.defined('altcontactaddress2') %]
742                                         <label for="borrower_altcontactaddress2" class="required">
743                                     [% ELSE %]
744                                         <label for="borrower_altcontactaddress2">
745                                     [% END %]
746                                     Address 2:</label>
747
748                                     <input type="text" id="borrower_altcontactaddress2" name="borrower_altcontactaddress2" value="[% borrower.altcontactaddress2 %]" />
749                                     [% IF mandatory.defined('altcontactaddress2') %]<span class="required">Required</span>[% END %]
750                                 </li>
751                             [% END %]
752
753                             [% UNLESS hidden.defined('altcontactaddress3') %]
754                                 <li>
755                                     [% IF mandatory.defined('altcontactaddress3') %]
756                                         <label for="borrower_altcontactaddress3" class="required">
757                                     [% ELSE %]
758                                         <label for="borrower_altcontactaddress3">
759                                     [% END %]
760                                     City:</label>
761
762                                     <input type="text" id="borrower_altcontactaddress3" name="borrower_altcontactaddress3" value="[% borrower.altcontactaddress3 %]" />
763                                     [% IF mandatory.defined('altcontactaddress3') %]<span class="required">Required</span>[% END %]
764                                 </li>
765                             [% END %]
766
767                             [% UNLESS hidden.defined('altcontactstate') %]
768                                 <li>
769                                     [% IF mandatory.defined('altcontactstate') %]
770                                         <label for="borrower_altcontactstate" class="required">
771                                     [% ELSE %]
772                                         <label for="borrower_altcontactstate">
773                                     [% END %]
774                                     State:</label>
775
776                                     <input type="text" id="borrower_altcontactstate" name="borrower_altcontactstate" value="[% borrower.altcontactstate %]" />
777                                     [% IF mandatory.defined('altcontactstate') %]<span class="required">Required</span>[% END %]
778                                 </li>
779                             [% END %]
780
781                             [% UNLESS hidden.defined('altcontactzipcode') %]
782                                 <li>
783                                     [% IF mandatory.defined('altcontactzipcode') %]
784                                         <label for="borrower_altcontactzipcode" class="required">
785                                     [% ELSE %]
786                                         <label for="borrower_altcontactzipcode">
787                                     [% END %]
788                                     ZIP/Postal code:</label>
789
790                                     <input type="text" id="borrower_altcontactzipcode" name="borrower_altcontactzipcode" value="[% borrower.altcontactzipcode %]" />
791                                     [% IF mandatory.defined('altcontactzipcode') %]<span class="required">Required</span>[% END %]
792                                 </li>
793                             [% END %]
794
795                             [% UNLESS hidden.defined('altcontactcountry') %]
796                                 <li>
797                                     [% IF mandatory.defined('altcontactcountry') %]
798                                         <label for="borrower_altcontactcountry" class="required">
799                                     [% ELSE %]
800                                         <label for="borrower_altcontactcountry">
801                                     [% END %]
802                                     Country:</label>
803
804                                     <input type="text" id="borrower_altcontactcountry" name="borrower_altcontactcountry" value="[% borrower.altcontactcountry %]" />
805                                     [% IF mandatory.defined('altcontactcountry') %]<span class="required">Required</span>[% END %]
806                                 </li>
807                             [% END %]
808
809                             [% UNLESS hidden.defined('altcontactphone') %]
810                                 <li>
811                                     [% IF mandatory.defined('altcontactphone') %]
812                                         <label for="borrower_altcontactphone" class="required">
813                                     [% ELSE %]
814                                         <label for="borrower_altcontactphone">
815                                     [% END %]
816                                     Phone:</label>
817
818                                     <input type="text" id="borrower_altcontactphone" name="borrower_altcontactphone" value="[% borrower.altcontactphone %]" />
819                                     [% IF mandatory.defined('altcontactphone') %]<span class="required">Required</span>[% END %]
820                                 </li>
821                             [% END %]
822                         </ol>
823                     </fieldset>
824                 [% END %]
825
826                 [% UNLESS action == 'edit' || hidden.defined('password') %]
827                     <fieldset class="rows" id="memberentry_password">
828                         <legend id="contact_legend">Password</legend>
829                         [% IF Koha.Preference('minPasswordLength') || !mandatory.defined('password') %]
830                             <div class="alert alert-info">
831                                 [% IF Koha.Preference('minPasswordLength') %]
832                                     <p>Your password must be at least [% Koha.Preference('minPasswordLength') %] characters long.</p>
833                                 [% END %]
834                                 [% UNLESS mandatory.defined('password') %]
835                                     If you do not enter a password a system generated password will be created.
836                                 [% END %]
837                             </div>
838                         [% END %]
839
840                         [% IF mandatory.defined('password') %]
841                             <ol>
842                                 <li><label for="borrower_password" class="required">Password</label>
843                                     <input type="text" name="borrower_password" id="password" />
844                                     <span class="required">Required</span>
845                                 </li>
846                                 <li><label for="borrower_password2" class="required">Confirm password</label>
847                                     <input type="text" name="borrower_password2" id="password2" />
848                                     <span class="required">Required</span>
849                                 </li>
850                             </ol>
851                         [% ELSE %]
852                             <ol>
853                                 <li><label for="borrower_password">Password</label>
854                                     <input type="text" name="borrower_password" id="password" />
855                                 </li>
856                                 <li><label for="borrower_password2">Confirm password</label>
857                                     <input type="text" name="borrower_password2" id="password2" />
858                                 </li>
859                             </ol>
860                         [% END %]
861                     </fieldset>
862                [% END %]
863
864                [% UNLESS action == 'edit' %]
865                     <fieldset class="rows" id="memberentry_captcha">
866                         <ol>
867
868                             <li>
869                                 <label for="captcha" class="required">Verification:</label>
870
871                                 <input type="text" name="captcha" id="captcha" />
872                                 <input type="hidden" name="captcha_digest" value="[% captcha_digest %]" />
873
874                                 <span class="hint">Please type the following characters into the preceding box: <strong>[% captcha %]</strong></span>
875                                 <span class="hint">Note: The preceding box is case-sensitive. Ensure that the entered characters are in all-caps.</span>
876                             </li>
877                         </ol>
878                     </fieldset>
879                 [% END %]
880
881                 [% IF ( borrower.ExtendedPatronAttributes ) %]
882                     <fieldset class="rows">
883                         <legend>Additional information</legend>
884                         <ol>
885                             [% FOREACH patron_attribute IN borrower.patron_attributes %]
886                                 <li>
887                                     <label>[% patron_attribute.description %]:</label>
888                                     [% IF ( patron_attribute.value_description ) %]
889                                         [% patron_attribute.value_description %]
890                                     [% ELSE %]
891                                         [% patron_attribute.value |html_line_break %]
892                                     [% END %]
893                                 </li>
894                             [% END %]
895                         </ol>
896                     </fieldset>
897                 [% END %]
898
899                 [% IF action == 'edit' %]
900                     [% IF OPACPatronDetails %]
901                         <fieldset class="action">
902                             <input type="hidden" name="action" value="update" />
903                             <input type="submit" class="btn" value="Submit update request" />
904                         </fieldset>
905                     [% END %]
906                 [% ELSE %]
907                     <fieldset class="action">
908                         <input type="hidden" name="action" value="create" />
909                         <input type="submit" class="btn" value="Submit" />
910                     </fieldset>
911                 [% END %]
912
913                 </form>
914
915                     </div><!--/div id="update-account" -->
916                 </div>
917             </div>
918         </div>
919     </div>
920
921 [% INCLUDE 'opac-bottom.inc' %]
922 [% BLOCK jsinclude %]
923     <script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.validate.min.js"></script>
924     <script type="text/javascript">
925         //<![CDATA[
926         $(document).ready(function() {
927             [% IF action == 'edit' && !OPACPatronDetails %]
928                 $("#memberentry-form :input").attr('readonly', true);
929                 $("#borrower_branchcode").attr('disabled',true);
930                 $("#borrower_title").attr('disabled',true);
931                 $('#memberentry-form :radio').attr('disabled',true);
932                 $('span.required').remove();
933                 $('label.required').removeClass('required');
934             [% ELSE %]
935                 $( "#borrower_dateofbirth" ).datepicker({ yearRange: "c-120:c" });
936             [% END %]
937
938             $("#memberentry-form").validate({
939                 rules: {
940                     borrower_email: {
941                         email: true
942                     },
943                     borrower_emailpro: {
944                         email: true
945                     },
946                     borrower_B_email: {
947                         email: true
948                     }
949                 },
950                 submitHandler: function(form) {
951                     if (form.beenSubmitted) {
952                         return false;
953                     }
954                     else {
955                         form.beenSubmitted = true;
956                         form.submit();
957                     }
958                 },
959                 errorPlacement: function(error, element) {
960                     offset = element.offset();
961                     error.insertAfter(element)
962                     error.addClass('error');  // add a class to the wrapper
963                     error.css('position', 'absolute');
964                     error.css('left', offset.left + element.outerWidth() + 10);
965                     error.css('top', offset.top);
966                     error.css('width', 'auto');
967                 }
968             });
969
970             [% IF borrower.guarantorid && !Koha.Preference('OPACPrivacy') && Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %]
971                 $('#update_privacy_guarantor_checkouts').click( function() {
972                     $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_guarantor_checkouts: $('#privacy_guarantor_checkouts').val() }, null, 'json')
973                      .done(function( data ) {
974                          var message;
975                          if ( data.success ) {
976                              message = _("Your setting has been updated!");
977                          } else {
978                              message = _("Unable to update your setting!");
979                          }
980
981                          $('#update_privacy_guarantor_checkouts_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow");
982                      });
983                 });
984             [% END %]
985         });
986     //]]>
987     </script>
988 [% INCLUDE 'calendar.inc' %]
989 [% END %]