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