Bug 24476: (QA follow-up) Standardize on 'auto renew(al)' and improve db update
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-user.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE Branches %]
6 [% USE ItemTypes %]
7 [% USE Price %]
8 [% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
9 [% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
10
11 [% SET borrower_club_enrollments =  logged_in_user.get_club_enrollments(1) %]
12 [% SET borrower_enrollable_clubs = logged_in_user.get_enrollable_clubs(1,1) %]
13
14 [% INCLUDE 'doc-head-open.inc' %]
15 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your library home</title>
16 [% INCLUDE 'doc-head-close.inc' %]
17 [% BLOCK cssinclude %][% END %]
18 </head>
19 [% INCLUDE 'bodytag.inc' bodyid='opac-user' bodyclass='scrollto' %]
20 [% INCLUDE 'masthead.inc' %]
21
22 [% IF Koha.Preference('AmazonAssocTag') %]
23     [% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
24 [% ELSE %]
25     [% AmazonAssocTag = '' %]
26 [% END %]
27
28 <div class="main">
29     <ul class="breadcrumb">
30         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
31         <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
32         <li><a href="#">Your summary</a></li>
33     </ul>
34
35     <div class="container-fluid">
36         <div class="row-fluid">
37             <div class="span2">
38                 <div id="navigation">
39                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
40                 </div>
41             </div>
42             <div class="span10">
43                 <div id="userdetails" class="maincontent">
44
45                     [% INCLUDE 'opac-note.inc' %]
46
47                     <h2>Hello, [% INCLUDE 'patron-title.inc' patron = logged_in_user %]
48                     </h2>
49
50                     <p><a href="/cgi-bin/koha/opac-main.pl?logout.x=1">Click here if you're not [% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a></p>
51
52                     [% IF Koha.Preference('AllowPatronToControlAutorenewal') %]
53                     <form id="autorenewal_option" action="/cgi-bin/koha/opac-user.pl" method="post">
54                             <label for="yes-autorenew_checkouts">
55                                 Allow auto renewal:
56                             </label>
57                                 [% IF ( borrower.autorenew_checkouts ) %]
58                                     <label class="radio inline" for="yes-autorenew_checkouts">
59                                         Yes
60                                         <input type="radio" id="yes-autorenew_checkouts" name="borrower_autorenew_checkouts" value="1" checked="checked" />
61                                     </label>
62
63                                     <label class="radio inline" for="no-autorenew_checkouts">
64                                         No
65                                         <input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" />
66                                     </label>
67                                 [% ELSE %]
68                                     <label class="radio inline" for="yes-autorenew_checkouts">
69                                         Yes
70                                         <input type="radio" id="yes-autorenew_checkouts" name="borrower_autorenew_checkouts" value="1" />
71                                     </label>
72                                     <label class="radio inline" for="no-autorenew_checkouts">
73                                         No
74                                         <input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" checked="checked" />
75                                     </label>
76                                 [% END %]
77                         <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
78                         <input type="hidden" name="update_arc" value="1" />
79                         <input type="submit" value="Update auto renewal preference" />
80                     </form>
81                     [% END %]
82                     [% IF ( patronupdate ) %]<div class="alert alert-info"><h3>Thank you!</h3><p>Your corrections have been submitted to the library, and a staff member will update your record as soon as possible.</p></div>[% END %]
83
84                     [% IF failed_holds %]
85                         <div class="alert alert-info">
86                             <h3>Notice:</h3>
87                             <p>One or more holds were not placed due to existing holds.</p>
88                         </div>
89                     [% END %]
90
91                     [% IF ( borrower.blockedonfines ) %]
92                         <div class="alert" id="blockedonfines">
93                             <strong>Please note:</strong><span> Your account has outstanding fees & charges of [% amountoutstanding | $Price %]. Holds are blocked because your fine balance is over the limit.</span>
94                         </div>
95                     [% END %]
96
97                     [% IF ( borrower.warndeparture ) %]
98                         <div class="alert" id="warndeparture">
99                             <strong>Please note:</strong><span> Your card will expire on <span id="warndeparture_date">[% borrower.warndeparture | $KohaDates %]</span>. Please contact the library for more information.</span>
100                                 [% IF ( borrower.returnbeforeexpiry ) %]<span id="warndeparture_returnbeforeexpiry"> Also note that you must return all checked out items before your card expires.</span>[% END %]
101                         </div>
102                     [% END %]
103
104                     [% IF ( borrower.warnexpired ) %]
105                         <div class="alert" id="warnexpired">
106                             <strong>Please note: </strong><span>Your account has expired as of [% borrower.warnexpired | $KohaDates %]. Please contact the library if you wish to renew your account.</span>
107                         </div>
108                     [% END %]
109
110                     [% IF ( RENEW_ERROR ) %]
111                         <div class="dialog alert">
112                             <strong>Please note:</strong>
113                                 Your loan renewal failed because of the following reason(s):
114                                 <ul>
115                                     [% FOREACH error IN RENEW_ERROR.split('\|') %]
116                                         [% IF error == 'card_expired' %]
117                                             <li>Your account has expired. Please contact the library for more information.</li>
118                                         [% ELSIF error == 'too_many' %]
119                                             <li>You have renewed this item the maximum number of times allowed.</li>
120                                         [% ELSIF error == 'too_soon' %]
121                                             <li>It is too soon after the checkout date for this item to be renewed.</li>
122                                         [% ELSIF error == 'on_reserve' %]
123                                             <li>This item is on hold for another borrower.</li>
124                                         [% ELSIF error == 'item_denied_renewal' %]
125                                             <li>Item renewal is not allowed.</li>
126                                         [% END %]
127                                     [% END %]
128                                 </ul>
129                         </div>
130                     [% END %]
131
132                     [% IF ( patron_flagged ) %]
133                         <div class="alert">
134                             <ul>
135                                 [% IF ( userdebarred ) %]
136                                     [% IF ( discharge_available ) %]
137                                         <li id="discharged">
138                                             <strong>Please note:</strong> Your account is frozen because it has been discharged. <a href="/cgi-bin/koha/opac-discharge.pl?op=get">Get your discharge</a>
139                                         </li>
140                                     [% ELSE %]
141                                         <li id="userdebarred"><strong>Please note:</strong> Your account has been frozen.
142                                         [% IF ( borrower.debarredcomment ) %]
143                                             Comment:
144                                             <span id="userdebarred_comment">
145                                                 <strong>
146                                                     [% IF borrower.debarredcomment.search('OVERDUES_PROCESS') %]
147                                                         Restriction added by overdues process [% borrower.debarredcomment.remove('OVERDUES_PROCESS ') | html_line_break %]
148                                                     [% ELSE %]
149                                                         [% borrower.debarredcomment | html_line_break %]
150                                                     [% END %]
151                                                 </strong>
152                                             </span>
153                                         [% END %]
154                                         [% IF ( borrower.userdebarreddate && debarred_date != '9999-12-31' ) %]
155                                             End date:
156                                             <span id="userdebarred_date">[% borrower.userdebarreddate | $KohaDates %]</span>
157                                         [% END %]
158
159                                         <em>Usually the reason for freezing an account is old overdues or damage fees. If your account shows to be clear, please contact the library.</em> <a href="/cgi-bin/koha/opac-account.pl">Go to your account page</a></li>
160                                     [% END %]
161                                 [% END %]
162                                 [% IF ( borrower.gonenoaddress ) %]
163                                     <li id="gonenoaddress"><strong>Please note:</strong> According to our records, we don't have up-to-date contact information. Please contact the library.
164                                 <a href="/cgi-bin/koha/opac-memberentry.pl">[% IF ( Koha.Preference('OPACPatronDetails') ) %]Update your contact information[% ELSE %]Go to your contact information[% END %]</a>
165                                 [% IF ( Koha.Preference('OPACPatronDetails') ) %]<em>(Please note: there may be a delay in restoring your account if you submit online.)</em>[% END %]
166                                     </li>
167                                 [% END %]
168                                 [% IF ( borrower.lost ) %]
169                                     <li id="lost"><strong>Please note: </strong> Your library card has been marked as lost or stolen. <em>If this is an error, please contact the library.</em></li>
170                                 [% END %]
171                                 [% IF ( renewal_blocked_fines.defined ) && ( OpacRenewalAllowed ) %]
172                                     <li id="renewal_blocked_fines"><strong>Please note: </strong>You cannot renew your books online. Reason: [% IF ( renewal_blocked_fines ) > 0  %]Your fines exceed <span id="renewal_blocked_fines_amount">[% renewal_blocked_fines | $Price %]</span>.[% ELSE %]You have fines.[% END %]
173                                 [% END %]
174                             </ul>
175                         </div>
176                     [% END # / IF patron_flagged %]
177
178                     <div class="alert alert-info" id="notesaved" style="display:none;"></div>
179
180                     [% IF Koha.Preference('OPACMySummaryNote') %]
181                         <div id="opac-my-summary-note">[% Koha.Preference('OPACMySummaryNote') | $raw %]</div>
182                     [% END %]
183
184                     <div id="opac-user-views" class="toptabs">
185                         <ul>
186                             <li><a href="#opac-user-checkouts">Checked out ([% issues_count | html %])</a></li>
187                             [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
188                             [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count | html %])</a></li>[% END %]
189                             [% IF ( OPACFinesTab ) %]
190                             [% IF ( amountoutstanding > 0 ) %]<li><a href="#opac-user-fines">Charges ([% amountoutstanding | $Price %])</a></li>[% END %]
191                                 [% IF ( amountoutstanding < 0 ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding * -1 | $Price %])</a></li>[% END %]
192                                 [% IF relatives_with_fines %]<li><a href="#opac-user-relative-fines">Relatives' fines</a></li>[% END %]
193                             [% END %]
194
195                             [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
196                                 <li>
197                                     <a id="opac-user-clubs-tab-link" href="#opac-user-clubs">
198                                         Clubs ([% borrower_club_enrollments.count || 0 | html %]/[% borrower_enrollable_clubs.count || 0 | html %])
199                                     </a>
200                                 </li>
201                             [% END %]
202
203                             [% IF ( RESERVES.count ) %]<li><a href="#opac-user-holds">Holds ([% RESERVES.count | html %])</a></li>[% END %]
204                             [% IF Koha.Preference('ArticleRequests') && logged_in_user.article_requests_current %]<li><a href="#opac-user-article-requests">Article requests ([% logged_in_user.article_requests_current.count | html %])</a></li>[% END %]
205                             [% IF ( OverDriveCirculation ) %]
206                             <li><a href="#opac-user-overdrive">OverDrive Account</a></li>
207                             [% END %]
208                             [% IF ( RecordedBooksCirculation ) %]
209                             <li><a href="#opac-user-recordedbooks">RecordedBooks Account</a></li>
210                             [% END %]
211                         </ul>
212
213                         <div id="opac-user-overdrive">
214                         </div>
215                         <div id="opac-user-recordedbooks">
216                         </div>
217                         <div id="opac-user-checkouts">
218                             [% IF ( issues_count ) %]
219                                 <form id="renewselected" action="/cgi-bin/koha/opac-renew.pl" method="post">
220                                     <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]">
221                                     <input type="hidden" name="from" value="opac_user" />
222                                     <table id="checkoutst" class="table table-bordered table-striped">
223                                         <caption>[% issues_count | html %] Item(s) checked out</caption>
224                                         <thead>
225                                             <tr>
226                                                 [% IF ( JacketImages || AdlibrisEnabled ) %]<th class="nosort">&nbsp;</th>[% END %]
227                                                 <th class="anti-the">Title</th>
228                                                 <th>Author</th>
229                                                 <th class="title-string psort">Due</th>
230                                                 [% UNLESS ( item_level_itypes ) %]
231                                                     <th>Item type</th>
232                                                 [% END %]
233                                                 [% IF ( show_barcode ) %]
234                                                     <th>Barcode</th>
235                                                 [% END %]
236                                                     <th>Call no.</th>
237                                                 [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
238                                                     <th class="nosort">Renew</th>
239                                                 [% END %]
240                                                 [% IF ( OPACFinesTab ) %]
241                                                     <th>Fines</th>
242                                                 [% END %]
243                                                 [% IF ( OPACMySummaryHTML ) %]
244                                                     <th class="nosort">Links</th>
245                                                 [% END %]
246                                                 [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
247                                                     <th class="nosort">Note</th>
248                                                 [% END %]
249                                             </tr>
250                                         </thead>
251                                         <tbody>
252                                             [% FOREACH ISSUE IN ISSUES %]
253                                                 [% IF ( ISSUE.overdue ) %]<tr class="overdue">[% ELSE %]<tr>[% END %]
254                                                 [% IF ( JacketImages || AdlibrisEnabled ) %]<td class="jacketcell">
255                                                     [% IF ( AdlibrisEnabled && ISSUE.normalized_isbn ) %]
256                                                         <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ISSUE.biblionumber | uri %]"><img src="[% AdlibrisURL | url %]?isbn=[% ISSUE.normalized_isbn | uri %]" class="adlibris-cover" alt="Adlibris cover image" /></a>
257                                                     [% END %]
258                                                     [% IF ( OPACAmazonCoverImages ) %]
259                                                         [% IF ( ISSUE.normalized_isbn ) %]
260                                                             <a href="http://www.amazon.com/gp/reader/[% ISSUE.normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link" title="View on Amazon.com"><img src="https://images-na.ssl-images-amazon.com/images/P/[% ISSUE.normalized_isbn | html %].01.THUMBZZZ.jpg" alt="View on Amazon.com" class="item-thumbnail"/></a>
261                                                         [% ELSE %]
262                                                             <a href="#"><span class="no-image">No cover image available</span></a>
263                                                         [% END %]
264                                                     [% END %]
265
266                                                     [% IF ( GoogleJackets ) %]
267                                                         [% IF ( ISSUE.normalized_isbn ) %]
268                                                             <div style="display:block;" title="Click to view in Google Books" class="[% ISSUE.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
269                                                         [% ELSE %]
270                                                             <a href="http://books.google.com/books?q=[% ISSUE.title |url %]"><span class="no-image">No cover image available</span></a>
271                                                         [% END %]
272                                                     [% END %]
273
274                                                     [% IF ( BakerTaylorEnabled ) %]
275                                                         [% bt_id = ( ISSUE.normalized_upc || ISSUE.normalized_isbn ) %]
276                                                         [% IF ( bt_id ) %]
277                                                             <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
278                                                         [% ELSE %]
279                                                             <span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
280                                                         [% END %]
281                                                     [% END %]
282
283                                                     [% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
284                                                         <a class="custom_cover_image" href="[% ISSUE.biblio_object.custom_cover_image_url | url %]"><img alt="Cover image" src="[% ISSUE.biblio_object.custom_cover_image_url | url %]" /></a>
285                                                     [% END %]
286
287                                                     [% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %]
288                                                         <img src="https://secure.syndetics.com/index.aspx?isbn=[% ISSUE.normalized_isbn | html %]/SC.GIF&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% ISSUE.normalized_upc | html %]&amp;oclc=[% ISSUE.normalized_oclc | html %]" alt="" class="item-thumbnail" />
289                                                     [% END %]
290
291                                                 </td>[% END # / IF JacketImages %]
292
293                                                 <td class="title">
294                                                     <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ISSUE.biblionumber | html %]">[% INCLUDE 'biblio-title.inc' biblio=ISSUE %]</a>
295                                                     [% IF ( ISSUE.enumchron ) %] [% ISSUE.enumchron | html %][% END %]
296                                                 </td>
297
298                                                 <td class="author">[% ISSUE.author | html %]</td>
299                                                 [% IF ( ISSUE.overdue ) %]
300                                                     <td class="date_due overdue">
301                                                         <span title="[% ISSUE.date_due | html %]">
302                                                             <span class="tdlabel">Date due:</span>
303                                                             [% ISSUE.date_due | $KohaDates  as_due_date => 1 %]
304                                                         </span>
305                                                     </td>
306                                                 [% ELSE %]
307                                                     <td class="date_due">
308                                                         <span title="[% ISSUE.date_due | html %]">
309                                                             <span class="tdlabel">Date due:</span>
310                                                             [% ISSUE.date_due | $KohaDates  as_due_date => 1 %]
311                                                         </span>
312                                                     </td>
313                                                 [% END %]
314                                                 [% UNLESS ( item_level_itypes ) %]
315                                                     <td class="itype">
316                                                         <span class="tdlabel">Item type:</span>
317                                                         [% IF ( ISSUE.imageurl ) %]
318                                                             <img src="[% ISSUE.imageurl | html %]" title="[% ISSUE.description | html %]" alt="[% ISSUE.description | html %]" />
319                                                         [% END %] [% ISSUE.description | html %]
320                                                     </td>
321                                                 [% END %]
322                                                 [% IF ( show_barcode ) %]
323                                                     <td class="barcode">
324                                                         <span class="tdlabel">Barcode:</span>
325                                                         [% ISSUE.barcode | html %]
326                                                     </td>
327                                                 [% END %]
328                                                 <td class="call_no">
329                                                     <span class="tdlabel">Call no.:</span>
330                                                     [% ISSUE.itemcallnumber | html %]
331                                                 </td>
332                                                 [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
333                                                     <td class="renew">
334                                                     [% IF ISSUE.renewed %]<span class="blabel label-success">Renewed!</span><br />[% END %]
335                                                     [% IF ( ISSUE.status ) %]
336                                                         [% IF ( canrenew ) %]
337                                                             <input type="checkbox" name="item" value="[% ISSUE.itemnumber | uri %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% ISSUE.itemnumber | uri %]&amp;borrowernumber=[% ISSUE.borrowernumber | uri %]">Renew</a>
338                                                         [% END %]
339                                                         [% IF ISSUE.renewalfee > 0 %]
340                                                             <span class="renewalfee label label-warning">Fee for item type '[% ItemTypes.GetDescription( ISSUE.renewalitemtype) | html %]': [% ISSUE.renewalfee | $Price %]</span>
341                                                         [% END %]
342                                                         [% IF ISSUE.itemtype_object.rentalcharge_daily > 0 %]
343                                                             <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_daily | $Price %] per day</span>
344                                                         [% END %]
345                                                         [% IF ISSUE.itemtype_object.rentalcharge_hourly > 0 %]
346                                                             <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_hourly | $Price %] per hour</span>
347                                                         [% END %]
348                                                         <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
349                                                     [% ELSIF ( ISSUE.on_reserve ) %]
350                                                         Not renewable <span class="renewals">(on hold)</span>
351                                                     [% ELSIF ( ISSUE.too_many ) %]
352                                                         Not renewable
353                                                     [% ELSIF ( ISSUE.norenew_overdue ) %]
354                                                         Not allowed <span class="renewals">(overdue)</span>
355                                                     [% ELSIF ( ISSUE.auto_too_late ) %]
356                                                         No longer renewable
357                                                     [% ELSIF ISSUE.auto_too_much_oweing %]
358                                                         Automatic renewal failed, you have unpaid fines.
359                                                         <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
360                                                     [% ELSIF ISSUE.auto_account_expired %]
361                                                         Automatic renewal failed, your account is expired.
362                                                         <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
363                                                     [% ELSIF ( ISSUE.too_soon ) %]
364                                                         No renewal before [% ISSUE.soonestrenewdate | html %]
365                                                         <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
366                                                     [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
367                                                         Automatic renewal
368                                                         <span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
369                                                     [% ELSIF ( ISSUE.item_denied_renewal ) %]
370                                                         Renewal not allowed
371                                                     [% END %]
372                                                     </td>
373                                                 [% END %]
374                                                 [% IF ( OPACFinesTab ) %]
375                                                     <td class="fines">
376                                                         <span class="tdlabel">Fines:</span>
377                                                         [% IF ( ISSUE.charges ) %]
378                                                             Yes (Item overdue or lost)
379                                                         [% ELSIF ( ISSUE.rentalfines ) %]
380                                                             Yes (Rental fees)
381                                                         [% ELSE %]
382                                                             No
383                                                         [% END %]
384                                                     </td>
385                                                 [% END %]
386                                                 [% IF ( OPACMySummaryHTML ) %]
387                                                     <td class="links">[% ISSUE.MySummaryHTML | $raw %]</td>
388                                                 [% END %]
389                                                 [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
390                                                     <td class="note">
391                                                         <input type="text" name="note" data-issue_id="[% ISSUE.issue_id | html %]" data-origvalue="[% ISSUE.note | html %]" value="[% ISSUE.note | html %]" readonly>
392                                                         <a class="btn js_submitnote" id="save_[% ISSUE.issue_id | html %]" style="display:none;">Submit note</a>
393                                                         <a class="btn nonjs_submitnote" href="/cgi-bin/koha/opac-issue-note.pl?issue_id=[% ISSUE.issue_id | url %]">Edit / Create note</a>
394                                                     </td>
395                                                 [% END %]
396                                             </tr>
397                                         [% END # /FOREACH ISSUES %]
398                                     </tbody>
399                                 </table>
400                                 [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
401                                     <input type="submit" class="btn" value="Renew selected" />
402                                 [% END %]
403                                 </form>
404
405                                 [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
406                                 <form id="renewall" action="/cgi-bin/koha/opac-renew.pl" method="post">
407                                     <input type="hidden" name="from" value="opac_user" />
408                                     <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
409                                     [% FOREACH ISSUE IN ISSUES %]
410                                         <input type="hidden" name="item" value="[% ISSUE.itemnumber | html %]" />
411                                     [% END %]
412                                     <input type="submit" class="btn" value="Renew all" />
413                                 </form>
414                                 [% END %]
415                                 <p><a href="opac-ics.pl">Download as iCal/.ics file</a></p>
416                             [% ELSE %]
417                                 <table class="table table-bordered table-striped">
418                                     <tr><td>You have nothing checked out</td></tr>
419                                 </table>
420                             [% END # IF issues_count %]
421                         </div> <!-- / .opac-user-checkouts -->
422
423                         [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
424                             <div id="opac-user-clubs">
425                                 Loading...
426                             </div>
427                         [% END %]
428
429                         [% IF ( OPACFinesTab ) %]
430                             <!-- FINES BOX -->
431                             [% IF ( amountoutstanding > 0 ) %]
432                                 <div id="opac-user-fines"> <h3>Charges</h3>
433                                     <table class="table table-bordered table-striped">
434                                         <thead><tr><th colspan="2">Amount</th></tr></thead>
435                                         <tbody>
436                                             <tr>
437                                                 <td>You currently owe fines and charges amounting to:</td>
438                                                 <td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding | $Price %]</a></td>
439                                             </tr>
440                                         </tbody>
441                                     </table>
442                                 </div>
443                             [% END %]
444
445                             [% IF ( amountoutstanding < 0 ) %]
446                                 <div id="opac-user-fines">  <h3>Credits</h3>
447                                     <table class="table table-bordered table-striped">
448                                         <thead><tr><th colspan="2">Amount</th></tr></thead>
449                                         <tbody>
450                                             <tr>
451                                                 <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding * -1 | $Price %]</a></td>
452                                             </tr>
453                                         </tbody>
454                                     </table>
455                                 </div>
456                             [% END %]
457
458                             [% IF relatives_with_fines %]
459                                <div id="opac-user-relative-fines"> <h3>Fines and charges</h3>
460                                     <table class="table table-bordered table-striped">
461                                         <thead>
462                                             <tr>
463                                                 <th colspan="2">Amount</th>
464                                             </tr>
465                                         </thead>
466                                         <tbody>
467                                             [% FOREACH r IN relatives_with_fines %]
468                                             <tr>
469                                                 <td>[% r.firstname | html %] [% r.surname | html %] currently owes fines and charges amounting to:</td>
470                                                 <td><a href="/cgi-bin/koha/opac-account.pl#g[% r.id | uri %]">[% r.account.balance | $Price %]</a></td>
471                                             </tr>
472                                             [% END %]
473                                         </tbody>
474                                     </table>
475                                 </div>
476                             [% END %]
477                         [% END # / OPACFinesTab %]
478
479                         [% IF relatives %]
480                             <div id="opac-user-relative-issues">
481                                 <table id="opac-user-relative-issues-table" class="table table-bordered table-striped">
482                                     <thead>
483                                         <tr>
484                                             <th class="anti-the">Title</th>
485                                             <th>Due</th>
486                                             <th>Barcode</th>
487                                             <th>Call no.</th>
488                                             <th class="psort">Relative</th>
489                                         </tr>
490                                     </thead>
491
492                                     <tbody>
493                                         [% FOREACH r IN relatives %]
494                                             [% FOREACH c IN r.checkouts %]
495                                                 <tr>
496                                                     <td>
497                                                         <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% i.item.biblio.biblionumber | uri %]">
498                                                             [% i.item.biblio.title | html %][% IF ( i.item.enumchron ) %] [% i.item.enumchron | html %][% END %]
499                                                         </a>
500                                                     </td>
501
502                                                     <td>
503                                                         [% c.date_due | $KohaDates %]
504                                                     </td>
505
506                                                     <td>
507                                                         [% c.item.barcode | html %]
508                                                     </td>
509
510                                                     <td>
511                                                         [% c.item.itemcallnumber | html %]
512                                                     </td>
513
514                                                     <td>
515                                                         [% r.firstname | html %] [% r.surname | html %]
516                                                     </td>
517                                                 </tr>
518                                             [% END %]
519                                         [% END %]
520                                     </tbody>
521                                 </table>
522                             </div>
523                         [% END %]
524
525                         [% IF ( overdues_count ) %]
526                             <div id="opac-user-overdues">
527                                 <table id="overduest" class="table table-bordered table-striped">
528                                     <caption>Overdues <span class="count">([% overdues_count | html %] total)</span></caption>
529                                     <!-- OVERDUES TABLE ROWS -->
530                                     <thead>
531                                         <tr>
532                                             [% IF ( JacketImages || AdlibrisEnabled ) %]<th class="nosort">&nbsp;</th>[% END %]
533                                             <th class="anti-the">Title</th>
534                                             [% UNLESS ( item_level_itypes ) %]<th>Item type</th> [% END %]
535                                             [% IF ( show_barcode ) %]<th>Barcode</th>[% END %]
536                                             <th>Call no.</th>
537                                             <th class="title-string psort">Due</th>
538                                             [% IF ( OpacRenewalAllowed ) %]
539                                                 <th class="nosort">Renew</th>
540                                             [% END %]
541                                             [% IF ( OPACFinesTab ) %]
542                                                 <th>Fines</th>
543                                             [% END %]
544                                         </tr>
545                                     </thead>
546                                     <tbody>
547                                         [% FOREACH OVERDUE IN OVERDUES %]
548                                             <tr>
549                                                 [% IF ( JacketImages || AdlibrisEnabled ) %]
550                                                     <td class="jacketcell">
551                                                     [% IF ( AdlibrisEnabled && OVERDUE.normalized_isbn ) %]
552                                                         <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% OVERDUE.biblionumber | uri %]"><img src="[% AdlibrisURL | url %]?isbn=[% OVERDUE.normalized_isbn | uri %]" class="adlibris-cover" alt="Adlibris cover image" /></a>
553                                                     [% END %]
554                                                     [% IF ( OPACAmazonCoverImages ) %]
555                                                         [% IF ( OVERDUE.normalized_isbn ) %]
556                                                             <a href="http://www.amazon.com/gp/reader/[% OVERDUE.normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link" title="View on Amazon.com"><img src="https://images-na.ssl-images-amazon.com/images/P/[% OVERDUE.normalized_isbn | html %].01.THUMBZZZ.jpg" alt="View on Amazon.com" class="item-thumbnail" /></a>
557                                                         [% ELSE %]
558                                                             <a href="#"><span class="no-image">No cover image available</span></a>
559                                                         [% END %]
560                                                     [% END %]
561
562                                                     [% IF ( GoogleJackets ) %]
563                                                         [% IF ( OVERDUE.normalized_isbn ) %]
564                                                             <div style="display:block;" title="Click to view in Google Books" class="[% OVERDUE.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
565                                                         [% ELSE %]
566                                                             <a href="http://books.google.com/books?q=[% OVERDUE.title |url %]"><span class="no-image">No cover image available</span></a>
567                                                         [% END %]
568                                                     [% END %]
569
570                                                     [% IF ( BakerTaylorEnabled ) %]
571                                                         [% bt_id = ( OVERDUE.normalized_upc || OVERDUE.normalized_isbn ) %]
572                                                         [% IF ( bt_id ) %]
573                                                             <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
574                                                         [% ELSE %]
575                                                             <span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
576                                                         [% END %]
577                                                     [% END %]
578
579                                                     [% IF ( SyndeticsCoverImages ) %]
580                                                         <img src="https://secure.syndetics.com/index.aspx?isbn=[% OVERDUE.normalized_isbn | html %]/SC.GIF&amp;client=[% SyndeticsClientCode | html %]&amp;upc=[% OVERDUE.normalized_upc | html %]&amp;oclc=[% OVERDUE.normalized_oclc | html %]&amp;type=xw10" alt="" class="item-thumbnail" />
581                                                     [% END %]
582                                                     </td>
583                                                 [% END # /IF jacketcell %]
584
585                                                 <td>
586                                                     <a class="title" href="/cgi-bin/koha/opac-detail.pl?bib=[% OVERDUE.biblionumber | html %]">[% INCLUDE 'biblio-title.inc' biblio=OVERDUE %]</a>
587                                                     <span class="item-details">[% OVERDUE.author | html %]</span>
588                                                 </td>
589
590                                                 [% UNLESS ( item_level_itypes ) %]
591                                                     <td>
592                                                         [% IF ( OVERDUE.imageurl ) %]
593                                                             <img src="[% OVERDUE.imageurl | html %]" title="[% OVERDUE.description | html %]" alt="[% OVERDUE.description | html %]" />
594                                                         [% END %] [% OVERDUE.description | html %]
595                                                     </td>
596                                                 [% END %]
597                                                 [% IF ( show_barcode ) %]
598                                                     <td>
599                                                         <span class="tdlabel">Barcode:</span>
600                                                         [% OVERDUE.barcode | html %]
601                                                     </td>
602                                                 [% END %]
603                                                 <td>
604                                                     <span class="tdlabel">Call no.:</span>
605                                                     [% OVERDUE.itemcallnumber | html %]
606                                                 </td>
607                                                 <td>
608                                                     <span title="[% OVERDUE.date_due | html %]">
609                                                         <span class="tdlabel">Date due:</span>
610                                                         [% OVERDUE.date_due | $KohaDates  as_due_date => 1 %]
611                                                     </span>
612                                                 </td>
613                                                 [% IF ( OpacRenewalAllowed ) %]
614                                                     <td>
615                                                         [% IF ( OVERDUE.debarred ) %]
616                                                             Account frozen
617                                                         [% ELSIF ( OVERDUE.status ) %]
618                                                             [% IF ( canrenew ) %]
619                                                                 <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber | uri %]&amp;bornum=[% OVERDUE.borrowernumber | uri %]">Renew</a>
620                                                             [% END %]
621                                                                 <span class="renewals">([% OVERDUE.renewsleft | html %] of [% OVERDUE.renewsallowed | html %] renewals remaining)</span>
622                                                         [% ELSIF ( OVERDUE.norenew_overdue ) %]
623                                                             Not allowed<span class="renewals">(overdue)</span>
624                                                         [% ELSIF ( OVERDUE.onreserve ) %]
625                                                             On hold
626                                                         [% ELSE %]
627                                                             No renewals left
628                                                         [% END %]
629                                                     </td>
630                                                 [% END %]
631                                                 [% IF ( OPACFinesTab ) %]
632                                                     <td>
633                                                         <span class="tdlabel">Fines:</span>
634                                                         [% IF ( OVERDUE.charges ) %]
635                                                             Yes
636                                                         [% ELSE %]
637                                                             No
638                                                         [% END %]
639                                                     </td>
640                                                 [% END %]
641                                             </tr>
642                                         [% END %]
643                                     </tbody>
644                                 </table>
645                             </div> <!-- / #opac-user-overdues -->
646                         [% END # /overdues_count %]
647
648                         [% PROCESS 'holds-table.inc' HOLDS = RESERVES, SuspendHoldsOpac = SuspendHoldsOpac, showpriority = showpriority, AutoResumeSuspendedHolds = AutoResumeSuspendedHolds %]
649
650                         [% IF Koha.Preference('ArticleRequests') %]
651                             <div id="opac-user-article-requests">
652                                 [% IF logged_in_user.article_requests_current.count %]
653                                     <table id="article-requests-table" class="table table-bordered table-striped">
654                                         <caption>Article requests <span class="count">([% logged_in_user.article_requests_current.count | html %] total)</span></caption>
655                                         <thead>
656                                             <tr>
657                                                 <th class="anti-the article-request-record-title">Record title</th>
658                                                 <th class="psort article-request-created-on">Placed on</th>
659                                                 <th class="anti-the article-request-title">Title</th>
660                                                 <th class="article-request-author">Author</th>
661                                                 <th class="article-request-volume">Volume</th>
662                                                 <th class="article-request-issue">Issue</th>
663                                                 <th class="article-request-date">Date</th>
664                                                 <th class="article-request-pages">Pages</th>
665                                                 <th class="article-request-chapters">Chapters</th>
666                                                 <th class="article-request-patron-notes">Notes</th>
667                                                 <th class="article-request-status">Status</th>
668                                                 <th class="article-request-branchcode">Pickup library</th>
669                                                 <th class="nosort article-request-cancel">&nbsp;</th>
670                                             </tr>
671                                         </thead>
672
673                                         <tbody>
674                                         [% FOREACH ar IN logged_in_user.article_requests_current %]
675                                                 <td class="article-request-record-title">
676                                                     <a class="article-request-title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ar.biblionumber | html %]">
677                                                         [% INCLUDE 'biblio-title.inc' biblio=ar.biblio %]
678                                                         [% ar.item.enumchron | html %]
679                                                     </a>
680                                                     [% ar.biblio.author | html %]
681                                                     [% IF ar.itemnumber %] <i>(only [% ar.item.barcode | html %])</i>[% END %]
682                                                 </td>
683
684                                                 <td class="article-request-created_on">
685                                                     [% ar.created_on | $KohaDates %]
686                                                 </td>
687
688                                                 <td class="article-request-title">
689                                                     [% ar.title | html %]
690                                                 </td>
691
692                                                 <td class="article-request-author">
693                                                     [% ar.author | html %]
694                                                 </td>
695
696                                                 <td class="article-request-volume">
697                                                     [% ar.volume | html %]
698                                                 </td>
699
700                                                 <td class="article-request-issue">
701                                                     [% ar.issue | html %]
702                                                 </td>
703
704                                                 <td class="article-request-date">
705                                                     [% ar.date | html %]
706                                                 </td>
707
708                                                 <td class="article-request-pages">
709                                                     [% ar.pages | html %]
710                                                 </td>
711
712                                                 <td class="article-request-chapters">
713                                                     [% ar.chapters | html %]
714                                                 </td>
715
716                                                 <td class="article-request-patron-notes">
717                                                     [% ar.patron_notes | html %]
718                                                 </td>
719
720                                                 <td class="article-request-status">
721                                                     [% IF ar.status == 'PENDING' %]
722                                                         Pending
723                                                     [% ELSIF ar.status == 'PROCESSING' %]
724                                                         Processing
725                                                     [% ELSIF ar.status == 'COMPLETED' %]
726                                                         Completed
727                                                     [% ELSIF ar.status == 'CANCELED' %]
728                                                         Canceled
729                                                     [% END %]
730                                                 </td>
731
732                                                 <td class="article-request-branchcode">
733                                                     [% ar.branch.branchname | html %]
734                                                 </td>
735
736                                                 <td class="article-request-cancel">
737                                                     <span class="tdlabel">Cancel:</span>
738                                                     <form action="/cgi-bin/koha/opac-article-request-cancel.pl" id="delete_article_request_[% ar.id | html %]">
739                                                         <input type="hidden" name="id" value="[% ar.id | html %]" />
740                                                         <button data-title="[% ar.biblio.title | html %] [% ar.item.enumchron | html %]" data-article-request_id="[% ar.id | html %]" type="submit" class="btn btn-sm btn-danger btn-delete-article-request"><i class="fa fa-remove"></i> Cancel</button>
741                                                     </form>
742                                                 </td>
743                                             </tr>
744                                         [% END %]
745                                     </tbody>
746                                 </table>
747                             [% ELSE %]
748                                 <table class="table table-bordered table-striped">
749                                     <tr><td>You have no article requests currently.</td></tr>
750                                 </table>
751                             [% END # IF article_requests_current.count %]
752                         </div> <!-- / #opac-user-article-requests -->
753                     [% END %]
754
755                     </div> <!-- /#opac-user-views -->
756                 </div> <!-- /#userdetails -->
757             </div> <!-- /.span10 -->
758         </div> <!-- /.row-fluid -->
759     </div> <!-- /.container-fluid -->
760 </div> <!-- /#main -->
761
762 [% IF ( OverDriveCirculation ) %]
763     [% INCLUDE 'overdrive-checkout.inc' %]
764     [% IF ( Koha.Preference('OverDrivePasswordRequired') ) %]
765         [% INCLUDE 'overdrive-login.inc' %]
766     [% END %]
767 [% END %]
768 [% IF ( RecordedBooksCirculation ) %]
769 [% INCLUDE 'recordedbooks-checkout.inc' %]
770 [% END %]
771
772 [% INCLUDE 'opac-bottom.inc' %]
773 [% BLOCK jsinclude %]
774     [% INCLUDE 'calendar.inc' %]
775     [% INCLUDE 'datatables.inc' %]
776     <script>
777
778         $(document).ready(function(){
779             $('#opac-user-views').tabs();
780             $(".js-show").show();
781             $(".js-hide").hide();
782             $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
783             $(".suspend-until").prop("readonly",1);
784
785             $(".btn-delete-hold").on("click", function(e){
786                 e.preventDefault();
787                 var hold_title = $(this).data("title");
788                 var reserve_id = $(this).data("reserve_id");
789                 confirmModal( hold_title, _("Are you sure you want to cancel this hold?"), _("Yes, cancel hold"), _("No, do not cancel hold"), function( result ){
790                         if( result ){
791                             $("#delete_hold_" + reserve_id ).submit();
792                         }
793                     }
794                 );
795             });
796
797             $(".btn-delete-article-request").on("click", function(e){
798                 e.preventDefault();
799                 var article_request = $(this).data("title");
800                 var article_request_id = $(this).data("article-request_id");
801                 confirmModal( article_request, _("Are you sure you want to cancel this article request?"), _("Yes, cancel article request"), _("No, do not cancel article request"), function( result ){
802                         if( result ){
803                             $("#delete_article_request_" + article_request_id ).submit();
804                         }
805                     }
806                 );
807             });
808
809             $("#suspend_all_submit").on("click", function(e){
810                 e.preventDefault();
811                 var title = _("Are you sure you want to suspend all holds?");
812                 var body = _("All holds will be suspended.");
813                 confirmModal( body, title, _("Yes, suspend all holds"), "", function( result ){
814                         if( result ){
815                             $("#suspend_all_holds").submit();
816                         }
817                     }
818                 );
819             });
820
821             $("#resume_all_submit").on("click", function(e){
822                 e.preventDefault();
823                 var title = _("Are you sure you want to resume all suspended holds?");
824                 var body = _("All holds will resume.");
825                 confirmModal( body, title, _("Yes, resume all holds"), _("No, do not resume holds"), function( result ){
826                         if( result ){
827                             $("#resume_all_holds").submit();
828                         }
829                     }
830                 );
831             });
832
833             var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
834             dTables.each(function(){
835                 var thIndex = $(this).find("th.psort").index();
836                 $(this).dataTable($.extend(true, {}, dataTablesDefaults, {
837                     "sorting" : [[ thIndex, 'asc' ]],
838                     "columnDefs": [
839                         { "targets": [ "nosort" ],"sortable": false,"searchable": false },
840                         { "type": "anti-the", "targets" : [ "anti-the" ] },
841                         { "type": "title-string", "targets" : [ "title-string" ] }
842                     ]
843                 }));
844             });
845
846             [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
847             [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
848                 $("#renewselected").submit(function(){
849                     valid = false;
850                     $("input[type=checkbox]").each(function(){
851                         if($(this).is(':checked')){
852                             valid = true;
853                         }
854                     });
855                     if(!valid){
856                         alert(_("Nothing has been selected. Check the box for each item you want to renew"));
857                     }
858                     return valid;
859                 });
860                 $("body").on("click","#renewselected_link",function(e){
861                     e.preventDefault();
862                     $("#renewselected").submit();
863                 });
864                 $("body").on("click","#renewall_link",function(e){
865                     e.preventDefault();
866                     $("#renewall").submit();
867                 });
868                 [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
869                     $("#checkoutst caption").append("<div id=\"renewcontrols\"><a id=\"renewselected_link\" class=\"btn btn-link\" href=\"#\"><i class=\"fa fa-check\"></i> "+_("Renew selected")+"</a> <a id=\"renewall_link\" class=\"btn btn-link\" href=\"#\"><span class=\"fa-stack\"><i class=\"fa fa-check fa-stack-1x\"></i><i class=\"fa fa-check fa-stack-1x\"></i></span> "+_("Renew all")+"</a></div>");
870                 [% END %]
871             [% END %]
872
873             [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
874
875                 /* If JS enabled, show button, otherwise show link to redirect to a page where note can be submitted */
876                 $(".nonjs_submitnote").hide();
877
878                 $("input[name='note']").prop('readonly', false);
879                 $("input[name='note']").keypress(function(e){
880                     /* prevent submitting of renewselected form */
881                     if(e.which == 13)
882                         e.preventDefault();
883                 });
884
885                 $("input[name='note']").keyup(function(e){
886                     var $btn_save = $('#save_'+$(this).data('issue_id'));
887                     var origvalue = $(this).data('origvalue');
888                     var value = $(this).val();
889
890                     if(origvalue != value) {
891                         if(origvalue != "")
892                             $btn_save.text(_("Submit changes"));
893                         else
894                             $btn_save.text(_("Submit note"));
895                         $btn_save.show();
896                     } else {
897                         $btn_save.hide();
898                     }
899                 });
900
901                 $(".js_submitnote").click(function(e){
902                     var $self = $(this);
903                     var title = $(this).parent().siblings('.title').html();
904                     var $noteinput = $(this).siblings('input[name="note"]').first();
905
906                     var ajaxData = {
907                         'action': 'issuenote',
908                         'issue_id': $noteinput.data('issue_id'),
909                         'note': $noteinput.val(),
910                     };
911
912                     $.ajax({
913                         url: '/cgi-bin/koha/svc/checkout_notes/',
914                         type: 'POST',
915                         dataType: 'json',
916                         data: ajaxData,
917                     })
918                     .done(function(data) {
919                         var message = "";
920                         if(data.status == 'saved') {
921                             $("#notesaved").removeClass("alert-error");
922                             $("#notesaved").addClass("alert-info");
923                             $noteinput.data('origvalue', data.note);
924                             $noteinput.val(data.note);
925                             message = "<p>" + _("Your note about %s has been saved and sent to the library.").format(title) + "</p>";
926                             message += "<p style=\"font-style:italic;\">" + data.note + "</p>";
927                             $self.hide();
928                         } else if(data.status == 'removed') {
929                             $("#notesaved").removeClass("alert-error");
930                             $("#notesaved").addClass("alert-info");
931                             $noteinput.data('origvalue', "");
932                             $noteinput.val("");
933                             message = "<p>" + _("Your note about %s was removed.").format(title) + "</p>";
934                             $self.hide();
935                         } else {
936                             $("#notesaved").removeClass("alert-info");
937                             $("#notesaved").addClass("alert-error");
938                             message =  "<p>" + _("Your note about %s could not be saved.").format(title) + "</p>";
939                             message += "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
940                         }
941                         $("#notesaved").html(message);
942                     })
943                     .fail(function(data) {
944                         $("#notesaved").removeClass("alert-info");
945                         $("#notesaved").addClass("alert-error");
946                         var message = "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
947                         $("#notesaved").html(message);
948                     })
949                     .always(function() {
950                         $("#notesaved").show();
951                     });
952                 });
953             [% END %]
954
955             $( ".suspend-until" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future
956
957             if ( $('#opac-user-clubs').length ) {
958                 $('#opac-user-clubs-tab-link').on('click', function() {
959                     $('#opac-user-clubs').text(_("Loading..."));
960                     $('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber | html %]');
961                 });
962             }
963         });
964         //]]>
965     </script>
966     [% IF Koha.Preference('OverDriveCirculation') %]
967     [% Asset.js("js/overdrive.js") | $raw %]
968     <script>
969     var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired') %]1[% ELSE %]0[% END %];
970     $(document).ready(function() {
971         [% IF ( overdrive_error ) %]
972             KOHA.OverDriveCirculation.display_error("#opac-user-overdrive", "[% overdrive_error.dquote | html %]");
973         [% END %]
974
975         [% IF ( overdrive_tab ) %]
976             $("#opac-user-views").tabs("select", "#opac-user-overdrive");
977         [% END %]
978
979         $("#opac-user-overdrive").each( function() {
980             KOHA.OverDriveCirculation.display_account_details(this);
981         } );
982     });
983     </script>
984     [% END %]
985     [% IF RecordedBooksCirculation %]
986         [% Asset.js("js/recordedbooks.js") | $raw %]
987         <script type="text/JavaScript">
988             $(document).ready(function() {
989                 [% IF ( recordedbooks_error ) %]
990                     KOHA.RecordedBooks.display_error("#opac-user-recordedbooks", "[% recordedbooks_error.dquote | html %]");
991                 [% END %]
992                 [% IF ( recordedbooks_tab ) %]
993                     $("#opac-user-views").tabs("select", "#opac-user-recordedbooks");
994                 [% END %]
995                 $("#opac-user-recordedbooks").each( function() {
996                     KOHA.RecordedBooks.display_account_details(this);
997                 } );
998             });
999         </script>
1000     [% END %]
1001 [% END %]