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