Bug 33302: Send and display errors when a hold cannot be placed on the OPAC
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-user.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% USE Branches %]
6 [% USE ItemTypes %]
7 [% USE Price %]
8 [% USE AuthorisedValues %]
9 [% USE AdditionalContents %]
10 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
11 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
12 [% SET OpacMySummaryNote = AdditionalContents.get( location => "OpacMySummaryNote", lang => lang, library => branchcode ) %]
13
14 [% SET borrower_club_enrollments = logged_in_user.get_club_enrollments %]
15 [% SET borrower_enrollable_clubs = logged_in_user.get_enrollable_clubs(1) %] <!-- 1 => OPAC -->
16
17 [% INCLUDE 'doc-head-open.inc' %]
18 <title>Your library home &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
19 [% INCLUDE 'doc-head-close.inc' %]
20 [% Asset.css("css/overdrive.css") | $raw %]
21 [% BLOCK cssinclude %][% END %]
22 </head>
23 [% INCLUDE 'bodytag.inc' bodyid='opac-user' bodyclass='scrollto' %]
24 [% INCLUDE 'masthead.inc' %]
25
26 [% IF Koha.Preference('AmazonAssocTag') %]
27     [% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
28 [% ELSE %]
29     [% AmazonAssocTag = '' %]
30 [% END %]
31
32 <div class="main">
33     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
34         <ol class="breadcrumb">
35             <li class="breadcrumb-item">
36                 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
37             </li>
38             <li class="breadcrumb-item">
39                 <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
40             </li>
41             <li class="breadcrumb-item active">
42                 <a href="#" aria-current="page">Your summary</a>
43             </li>
44         </ol>
45     </nav> <!-- /#breadcrumbs -->
46
47     <div class="container-fluid">
48         <div class="row">
49             <div class="col col-lg-2 order-2 order-lg-1">
50                 <div id="navigation">
51                     [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
52                 </div>
53             </div>
54             <div class="col-md-12 col-lg-10 order-1 order-lg-2">
55                 <div id="userdetails" class="maincontent">
56
57                     <h1>Your summary</h1>
58
59                     [% INCLUDE 'opac-note.inc' %]
60
61                     <p>Hello, [% INCLUDE 'patron-title.inc' patron = logged_in_user %]
62                     <br />
63                     <a href="/cgi-bin/koha/opac-main.pl?logout.x=1">Click here if you're not [% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a></p>
64
65                     [% IF ( patronupdate ) %]<div class="alert alert-info"><h2>Thank you!</h2><p>Your corrections have been submitted to the library, and a staff member will update your record as soon as possible.</p></div>[% END %]
66
67                     [% IF failed_holds %]
68                         <div class="alert alert-info">
69                             <h2>Notice:</h2>
70                             <p>One or more holds were not placed due to following errors:</p>
71                             <ul>
72                             [% FOREACH fail IN failed_holds.split('\|') %]
73                                 <li>
74                                 [% SWITCH fail %]
75                                 [% CASE 'damaged' %]
76                                     <span>Item damaged</span>
77                                 [% CASE 'ageRestricted' %]
78                                     <span>Age restricted</span>
79                                 [% CASE 'tooManyHoldsForThisRecord' %]
80                                     <span>Exceeded max holds per record</span>
81                                 [% CASE 'tooManyReservesToday' %]
82                                     <span>Daily hold limit reached for patron</span>
83                                 [% CASE 'tooManyReserves' %]
84                                     <span>Too many holds</span>
85                                 [% CASE 'notReservable' %]
86                                     <span>Not holdable</span>
87                                 [% CASE 'cannotReserveFromOtherBranches' %]
88                                     <span>Patron is from different library</span>
89                                 [% CASE 'branchNotInHoldGroup' %]
90                                     <span>Cannot place hold from patron's library</span>
91                                 [% CASE 'itemAlreadyOnHold' %]
92                                     <span>Patron already has hold for this item</span>
93                                 [% CASE 'cannotBeTransferred' %]
94                                     <span>Cannot be transferred to pickup library</span>
95                                 [% CASE 'pickupNotInHoldGroup' %]
96                                     <span>Only pickup locations within the same hold group are allowed</span>
97                                 [% CASE 'noReservesAllowed' %]
98                                     <span>No holds are allowed on this item</span>
99                                 [% CASE 'libraryNotPickupLocation' %]
100                                     <span>Library is not a pickup location</span>
101                                 [% CASE 'no_valid_pickup_location' %]
102                                     <span>No valid pickup location</span>
103                                 [% CASE 'notforloan' %]
104                                     <span>Not for loan</span>
105                                 [% CASE 'items_available' %]
106                                     <span>There are items available in the library, please visit to check them out</span>
107                                 [% CASE 'not_placed' %]
108                                     <span>Error when placing hold, please report this to the library</span>
109                                 [% CASE %]
110                                     <span>Error: [% fail | html %]</span>
111                                 [% END %]
112                                 </li>
113                             [% END %]
114                             </ul>
115                         </div>
116                     [% END %]
117
118                     [% IF ( borrower.blockedonfines && Koha.Preference('OPACHoldRequests') ) %]
119                         <div class="alert alert-warning" id="blockedonfines">
120                             <strong>Please note:</strong><span> Your account has outstanding fees & charges of [% amountoutstanding | $Price %]. Holds are blocked because your fine balance is over the limit.</span>
121                         </div>
122                     [% END %]
123
124                     [% IF ( borrower.warndeparture ) %]
125                         <div class="alert alert-warning" id="warndeparture">
126                             <strong>Please note:</strong><span> Your library card will expire on <span id="warndeparture_date">[% borrower.warndeparture | $KohaDates %]</span>. Please contact the library for more information.</span>
127                                 [% IF ( borrower.returnbeforeexpiry ) %]<span id="warndeparture_returnbeforeexpiry"> Also note that you must return all checked out items before your library card expires.</span>[% END %]
128                         </div>
129                     [% END %]
130
131                     [% IF ( borrower.warnexpired ) %]
132                         <div class="alert alert-warning" id="warnexpired">
133                             <strong>Please note: </strong><span>Your account has expired as of [% borrower.warnexpired | $KohaDates %]. Please contact the library if you wish to renew your account.</span>
134                         </div>
135                     [% END %]
136
137                     [% IF ( RENEW_ERROR ) %]
138                         <div class="alert alert-warning">
139                             <strong>Please note:</strong>
140                                 Your loan renewal failed because of the following reason(s):
141                                 <ul>
142                                     [% FOREACH error IN RENEW_ERROR.split('\|') %]
143                                         [% IF error == 'card_expired' %]
144                                             <li>Your account has expired. Please contact the library for more information.</li>
145                                         [% ELSIF error == 'too_many' %]
146                                             <li>You have renewed this item the maximum number of times allowed.</li>
147                                         [% ELSIF error == 'too_unseen' %]
148                                             <li>You have renewed this item the maximum number of consecutive times without it being seen by the library.</li>
149                                         [% ELSIF error == 'too_soon' %]
150                                             <li>It is too soon after the checkout date for this item to be renewed.</li>
151                                         [% ELSIF error == 'on_reserve' %]
152                                             <li>This item is on hold for another borrower.</li>
153                                         [% ELSIF error == 'item_denied_renewal' %]
154                                             <li>Item renewal is not allowed.</li>
155                                         [% ELSIF error == 'auto_too_soon' %]
156                                             <li>This item is scheduled for auto renewal.</li>
157                                         [% END %]
158                                     [% END %]
159                                 </ul>
160                         </div>
161                     [% END %]
162
163                     [% IF ( patron_flagged ) %]
164                         <div class="alert alert-warning">
165                             <ul>
166                                 [% IF ( userdebarred ) %]
167                                     [% IF ( discharge_available ) %]
168                                         <li id="discharged">
169                                             <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>
170                                         </li>
171                                     [% ELSE %]
172                                         <li id="userdebarred"><strong>Please note:</strong> Your account has been frozen.
173                                         [% IF ( borrower.debarredcomment ) %]
174                                             Comment:
175                                             <span id="userdebarred_comment">
176                                                 <strong>
177                                                     [% IF borrower.debarredcomment.search('OVERDUES_PROCESS') %]
178                                                         Restriction added by overdues process [% borrower.debarredcomment.remove('OVERDUES_PROCESS ') | html_line_break %]
179                                                     [% ELSE %]
180                                                         [% borrower.debarredcomment | html_line_break %]
181                                                     [% END %]
182                                                 </strong>
183                                             </span>
184                                         [% END %]
185                                         [% IF ( borrower.userdebarreddate && debarred_date != '9999-12-31' ) %]
186                                             End date:
187                                             <span id="userdebarred_date">[% borrower.userdebarreddate | $KohaDates %]</span>
188                                         [% END %]
189
190                                         <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>
191                                     [% END %]
192                                 [% END %]
193                                 [% IF ( borrower.gonenoaddress ) %]
194                                     <li id="gonenoaddress"><strong>Please note:</strong> According to our records, we don't have up-to-date contact information. Please contact the library.
195                                 <a href="/cgi-bin/koha/opac-memberentry.pl">[% IF ( Koha.Preference('OPACPatronDetails') ) %]<span>Update your contact information</span>[% ELSE %]<span>Go to your contact information</span>[% END %]</a>
196                                 [% IF ( Koha.Preference('OPACPatronDetails') ) %]<em>(Please note: there may be a delay in restoring your account if you submit online.)</em>[% END %]
197                                     </li>
198                                 [% END %]
199                                 [% IF ( borrower.lost ) %]
200                                     <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>
201                                 [% END %]
202                                 [% IF ( renewal_blocked_fines.defined ) && ( OpacRenewalAllowed ) %]
203                                     <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 %]
204                                 [% END %]
205                             </ul>
206                         </div>
207                     [% END # / IF patron_flagged %]
208
209                     [% IF savings %]
210                         <div class="alert alert-info" id="savings">
211                             Congratulations, you have saved a total of [% savings | $Price with_symbol => 1 %] by using the library.
212                         </div>
213                     [% END %]
214
215                     <div class="alert alert-info" id="notesaved" style="display:none;"></div>
216                     [% IF ( OpacMySummaryNote ) %]
217                         [% PROCESS koha_news_block news => OpacMySummaryNote %]
218                     [% END %]
219
220                     [% IF Koha.Preference('AllowPatronToControlAutorenewal') %]
221                     <form id="autorenewal_option" action="/cgi-bin/koha/opac-user.pl" method="post">
222                         <legend class="sr-only">Auto-renewal</legend>
223                             <label for="yes-autorenew_checkouts">
224                                 Allow auto-renewal:
225                             </label>
226                                 [% IF ( borrower.autorenew_checkouts ) %]
227                                     <label class="radio inline" for="yes-autorenew_checkouts">
228                                         Yes
229                                         <input type="radio" id="yes-autorenew_checkouts" name="borrower_autorenew_checkouts" value="1" checked="checked" />
230                                     </label>
231
232                                     <label class="radio inline" for="no-autorenew_checkouts">
233                                         No
234                                         <input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" />
235                                     </label>
236                                 [% ELSE %]
237                                     <label class="radio inline" for="yes-autorenew_checkouts">
238                                         Yes
239                                         <input type="radio" id="yes-autorenew_checkouts" name="borrower_autorenew_checkouts" value="1" />
240                                     </label>
241                                     <label class="radio inline" for="no-autorenew_checkouts">
242                                         No
243                                         <input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" checked="checked" />
244                                     </label>
245                                 [% END %]
246                         <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
247                         <input type="hidden" name="update_arc" value="1" />
248                         <input type="submit" value="Update auto-renewal preference" />
249                     </form>
250                     [% END %]
251
252                     <div id="opac-user-views" class="toptabs">
253                         <ul class="nav nav-tabs" role="tablist">
254                             <li class="nav-item" role="presentation">
255                                 <a class="nav-link active" id="opac-user-checkouts-tab" data-toggle="tab" role="tab" aria-controls="opac-user-checkouts" aria-selected="true"  href="#opac-user-checkouts">Checked out ([% issues_count | html %])</a>
256                             </li>
257                             [% IF relatives %]
258                                 <li class="nav-item" role="presentation">
259                                     <a class="nav-link" id="opac-user-relative-issues-tab" data-toggle="tab" role="tab" aria-controls="opac-user-relative-issues" aria-selected="false" href="#opac-user-relative-issues">Relatives' checkouts</a>
260                                 </li>
261                             [% END %]
262                             [% IF ( overdues_count ) %]
263                                 <li class="nav-item" role="presentation">
264                                     <a class="nav-link" id="opac-user-overdues-tab" data-toggle="tab" role="tab" aria-controls="opac-user-overdues" aria-selected="false" href="#opac-user-overdues">Overdue ([% overdues_count | html %])</a>
265                                 </li>
266                             [% END %]
267                             [% IF ( OPACFinesTab ) %]
268                                 [% IF ( amountoutstanding > 0 ) %]
269                                     <li class="nav-item" role="presentation">
270                                         <a class="nav-link" id="opac-user-fines-tab" data-toggle="tab" role="tab" aria-controls="opac-user-fines" aria-selected="false" href="#opac-user-fines">Charges ([% amountoutstanding | $Price %])</a>
271                                     </li>
272                                 [% END %]
273                                 [% IF ( amountoutstanding < 0 ) %]
274                                     <li class="nav-item" role="presentation">
275                                         <a class="nav-link" id="opac-user-fines-tab" data-toggle="tab" role="tab" aria-controls="opac-user-fines" aria-selected="false" href="#opac-user-fines">Credits ([% amountoutstanding * -1 | $Price %])</a>
276                                     </li>
277                                 [% END %]
278                                 [% IF relatives_with_fines %]
279                                     <li class="nav-item" role="presentation">
280                                         <a class="nav-link" id="opac-user-relative-fines-tab" data-toggle="tab" role="tab" aria-controls="opac-user-relative-fines" aria-selected="false" href="#opac-user-relative-fines">Relatives' charges</a>
281                                     </li>
282                                 [% END %]
283                             [% END %]
284
285                             [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
286                                 <li class="nav-item" role="presentation">
287                                     <a class="nav-link" data-toggle="tab" role="tab" aria-controls="opac-user-clubs" aria-selected="false" id="opac-user-clubs-tab-link" href="#opac-user-clubs">
288                                         Clubs ([% borrower_club_enrollments.count || 0 | html %]/[% borrower_enrollable_clubs.count || 0 | html %])
289                                     </a>
290                                 </li>
291                             [% END %]
292
293                             [% IF ( RESERVES.count ) %]
294                                 <li class="nav-item" role="presentation">
295                                     <a class="nav-link" id="opac-user-holds-tab" data-toggle="tab" role="tab" aria-controls="opac-user-holds" aria-selected="false" href="#opac-user-holds">Holds ([% RESERVES.count | html %])</a>
296                                 </li>
297                             [% END %]
298                             [% IF Koha.Preference('UseRecalls') && RECALLS.count %]
299                                 <li class="nav-item" role="presentation">
300                                     <a class="nav-link" id="opac-user-recalls-tab" data-toggle="tab" role="tab" aria-controls="opac-user-recalls" aria-selected="false" href="#opac-user-recalls">Recalls ([% RECALLS.count | html %])</a>
301                                 </li>
302                             [% END %]
303                             [% IF Koha.Preference('ArticleRequests') %]
304                                 <li class="nav-item" role="presentation">
305                                     <a class="nav-link" id="opac-user-article-requests-tab" data-toggle="tab" role="tab" aria-controls="opac-user-article-requests" aria-selected="false" href="#opac-user-article-requests">Article requests ([% current_article_requests.size || 0 | html %])</a>
306                                 </li>
307                             [% END %]
308                             [% IF ( OverDriveCirculation ) %]
309                                 <li class="nav-item" role="presentation">
310                                     <a class="nav-link" id="opac-user-overdrive-tab" data-toggle="tab" role="tab" aria-controls="opac-user-overdrive" aria-selected="false" href="#opac-user-overdrive">OverDrive account</a>
311                                 </li>
312                             [% END %]
313                             [% IF ( RecordedBooksCirculation ) %]
314                                 <li class="nav-item" role="presentation">
315                                     <a class="nav-link" id="opac-user-recordedbooks-tab" data-toggle="tab" role="tab" aria-controls="opac-user-recordedbooks" aria-selected="false" href="#opac-user-recordedbooks">RecordedBooks account</a>
316                                 </li>
317                             [% END %]
318                         </ul>
319                         <div class="tab-content">
320
321                             <div id="opac-user-overdrive" class="tab-pane" role="tabpanel" aria-labelledby="opac-user-overdrive-tab">
322                             </div>
323                             <div id="opac-user-recordedbooks" class="tab-pane" role="tabpanel" aria-labelledby="opac-user-recordedbooks-tab">
324                             </div>
325                             <div id="opac-user-checkouts" class="tab-pane active" role="tabpanel" aria-labelledby="opac-user-checkouts-tab">
326                                 [% IF ( issues_count ) %]
327                                     <form id="renewselected" action="/cgi-bin/koha/opac-renew.pl" method="post">
328                                         <legend class="sr-only">Renew selected</legend>
329                                         <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]">
330                                         <input type="hidden" name="from" value="opac_user" />
331                                         <table id="checkoutst" class="table table-bordered table-striped">
332                                             <caption>[% issues_count | html %] Item(s) checked out</caption>
333                                             <thead>
334                                                 <tr>
335                                                     [% IF ( JacketImages ) %]<th class="nosort">&nbsp;</th>[% END %]
336                                                     <th class="anti-the">Title</th>
337                                                     <th>Author</th>
338                                                     <th class="psort">Due</th>
339                                                     [% UNLESS ( item_level_itypes ) %]
340                                                         <th>Item type</th>
341                                                     [% END %]
342                                                     [% IF ( show_barcode ) %]
343                                                         <th>Barcode</th>
344                                                     [% END %]
345                                                         <th>Call number</th>
346                                                     [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
347                                                         <th>Renew</th>
348                                                     [% END %]
349                                                     [% IF ( OPACFinesTab ) %]
350                                                         <th>Fines</th>
351                                                     [% END %]
352                                                     [% IF ( OPACMySummaryHTML ) %]
353                                                         <th class="nosort">Links</th>
354                                                     [% END %]
355                                                     [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
356                                                         <th class="hidden">Checkout note</th>
357                                                         <th id="checkout-notes" class="nosort noExport" title="Use this to report any problems with your currently checked out items">Report a problem</th>
358                                                     [% END %]
359                                                 </tr>
360                                             </thead>
361                                             <tbody>
362                                                 [% FOREACH ISSUE IN ISSUES %]
363                                                     [% IF ( ISSUE.overdue ) %]<tr class="overdue">[% ELSE %]<tr>[% END %]
364                                                     [% IF ( JacketImages ) %]
365                                                         <td class="jacketcell">
366                                                             [% IF ( OPACAmazonCoverImages ) %]
367                                                                 [% IF ( ISSUE.normalized_isbn ) %]
368                                                                     <a href="http://www.amazon.com/gp/reader/[% ISSUE.normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link" title="View on Amazon.com"><img src="https://images-na.ssl-images-amazon.com/images/P/[% ISSUE.normalized_isbn | html %].01.THUMBZZZ.jpg" alt="View on Amazon.com" class="item-thumbnail"/></a>
369                                                                 [% ELSE %]
370                                                                     <a href="#"><span class="no-image">No cover image available</span></a>
371                                                                 [% END %]
372                                                             [% END %]
373
374                                                             [% IF ( GoogleJackets ) %]
375                                                                 [% IF ( ISSUE.normalized_isbn ) %]
376                                                                     <div style="display:block;" title="Click to view in Google Books" class="[% ISSUE.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
377                                                                 [% ELSE %]
378                                                                     <a href="http://books.google.com/books?q=[% ISSUE.title |url %]"><span class="no-image">No cover image available</span></a>
379                                                                 [% END %]
380                                                             [% END %]
381
382                                                             [% IF ( BakerTaylorEnabled ) %]
383                                                                 [% bt_id = ( ISSUE.normalized_upc || ISSUE.normalized_isbn ) %]
384                                                                 [% IF ( bt_id ) %]
385                                                                     <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
386                                                                 [% ELSE %]
387                                                                     <span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
388                                                                 [% END %]
389                                                             [% END %]
390
391                                                             [% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
392                                                                 [% SET custom_cover_image_url = ISSUE.biblio_object.custom_cover_image_url %]
393                                                                 [% IF custom_cover_image_url %]
394                                                                     <a class="custom_cover_image" href="[% custom_cover_image_url | url %]"><img alt="Cover image" src="[% custom_cover_image_url | url %]" /></a>
395                                                                 [% END %]
396                                                             [% END %]
397
398                                                             [% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %]
399                                                                 <img src="https://secure.syndetics.com/index.aspx?isbn=[% ISSUE.normalized_isbn | html %]/[% SyndeticsCoverImageSize | uri %].GIF&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% ISSUE.normalized_upc | html %]&amp;oclc=[% ISSUE.normalized_oclc | html %]" alt="" class="item-thumbnail" />
400                                                             [% END %]
401                                                         </td>
402                                                     [% END # / IF JacketImages %]
403
404                                                     <td class="title">
405                                                         [% INCLUDE 'biblio-title.inc' biblio=ISSUE link=> 1 %]
406                                                         [% IF ( ISSUE.enumchron ) %] [% ISSUE.enumchron | html %][% END %]
407
408                                                         [% IF ( ISSUE.onsite_checkout ) %] <em class="onsite_checkout">(On-site checkout)</em>[% END %]
409
410                                                         [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
411                                                             [% INCLUDE 'user-star-ratings.inc' item=ISSUE %]
412                                                         [% END %]
413
414                                                         [% IF ( ISSUE.recall ) %]<br><i>This item has been recalled. Please return by the new due date.</i>[% END %]
415                                                     </td>
416
417                                                     <td class="author">[% ISSUE.author | html %]</td>
418                                                     [% IF ( ISSUE.overdue ) %]
419                                                         <td class="date_due overdue" data-order="[% ISSUE.date_due | html %]">
420                                                             <span class="tdlabel">Date due:</span>
421                                                             [% ISSUE.date_due | $KohaDates  as_due_date => 1 %]
422                                                         </td>
423                                                     [% ELSE %]
424                                                         <td class="date_due" data-order="[% ISSUE.date_due | html %]">
425                                                             <span class="tdlabel">Date due:</span>
426                                                             [% ISSUE.date_due | $KohaDates  as_due_date => 1 %]
427                                                         </td>
428                                                     [% END %]
429                                                     [% UNLESS ( item_level_itypes ) %]
430                                                         <td class="itype">
431                                                             <span class="tdlabel">Item type:</span>
432                                                             [% IF ( ISSUE.imageurl && !Koha.Preference('OpacNoItemTypeImages') ) %]
433                                                                 <img src="[% ISSUE.imageurl | html %]" title="[% ISSUE.description | html %]" alt="[% ISSUE.description | html %]" />
434                                                                 [% END %] <span class="itypetext">[% ISSUE.description | html %]</span>
435                                                         </td>
436                                                     [% END %]
437                                                     [% IF ( show_barcode ) %]
438                                                         <td class="barcode">
439                                                             <span class="tdlabel">Barcode:</span>
440                                                             [% ISSUE.barcode | html %]
441                                                         </td>
442                                                     [% END %]
443                                                     <td class="call_no">
444                                                         <span class="tdlabel">Call number:</span>
445                                                         [% ISSUE.itemcallnumber | html %]
446                                                     </td>
447                                                     [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
448                                                         [% IF ( ISSUE.status && canrenew ) %]
449                                                             <td class="renew" data-order="[% ISSUE.renewsleft | html %]">
450                                                         [% ELSE %]
451                                                             <td class="renew" data-order="0">
452                                                         [% END %]
453                                                         [% IF ISSUE.renewed %]<span class="blabel label-success">Renewed!</span><br />[% END %]
454                                                         [% IF ( ISSUE.status ) %]
455                                                             [% IF ( canrenew ) %]
456                                                                 <input type="checkbox" name="item" value="[% ISSUE.itemnumber | uri %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% ISSUE.itemnumber | uri %]&amp;borrowernumber=[% ISSUE.borrowernumber | uri %]">Renew</a>
457                                                             [% END %]
458                                                             [% IF ISSUE.renewalfee > 0 %]
459                                                                 <span class="renewalfee label label-warning">Fee for item type '[% ItemTypes.GetDescription( ISSUE.renewalitemtype) | html %]': [% ISSUE.renewalfee | $Price %]</span>
460                                                             [% END %]
461                                                             [% IF ISSUE.itemtype_object.rentalcharge_daily > 0 %]
462                                                                 <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_daily | $Price %] per day</span>
463                                                             [% END %]
464                                                             [% IF ISSUE.itemtype_object.rentalcharge_hourly > 0 %]
465                                                                 <span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_hourly | $Price %] per hour</span>
466                                                             [% END %]
467                                                             <span class="renewals">(
468                                                                 [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
469                                                                 [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
470                                                                     / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
471                                                                 [% END %]
472                                                             )</span>
473                                                         [% ELSIF ( ISSUE.on_reserve ) %]
474                                                             <span class="usr-msg no-renew-hold">Not renewable <span class="renewals">(on hold)</span></span>
475                                                         [% ELSIF ( ISSUE.too_many ) %]
476                                                             <span class="usr-msg no-renew-too-many">Not renewable</span>
477                                                         [% ELSIF ( ISSUE.too_unseen ) %]
478                                                             <span class="usr-msg no-renew-unseen">Item must be renewed at the library. [% ISSUE.renewsleft | html %] renewals remaining</span>
479                                                         [% ELSIF ( ISSUE.norenew_overdue ) %]
480                                                             <span class="usr-msg no-renew-overdue">Not allowed <span class="renewals">(overdue)</span></span>
481                                                         [% ELSIF ( ISSUE.auto_too_late ) %]
482                                                             <span class="usr-msg no-renew-too-late">No longer renewable</span>
483                                                         [% ELSIF ISSUE.auto_too_much_oweing %]
484                                                             <span class="usr-msg auto-renew-fines">Automatic renewal failed, you have unpaid fines.</span>
485                                                             <span class="renewals">(
486                                                                 [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
487                                                                 [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
488                                                                     / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
489                                                                 [% END %]
490                                                             )</span>
491                                                         [% ELSIF ISSUE.auto_account_expired %]
492                                                             <span class="usr-msg auto-renew-expired">Automatic renewal failed, your account is expired.</span>
493                                                             <span class="renewals">(
494                                                                 [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
495                                                                 [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
496                                                                     / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
497                                                                 [% END %]
498                                                             )</span>
499                                                         [% ELSIF ( ISSUE.too_soon ) %]
500                                                             <span class="usr-msg no-renewal-before">No renewal before [% ISSUE.soonestrenewdate | $KohaDates  as_due_date => 1 %]</span>
501                                                             <span class="renewals">(
502                                                                 [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
503                                                                 [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
504                                                                     / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
505                                                                 [% END %]
506                                                             )</span>
507                                                         [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
508                                                             <span class="usr-msg automatic-renewal">Automatic renewal</span>
509                                                             <span class="renewals">(
510                                                                 [% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining
511                                                                 [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
512                                                                     / [% ISSUE.unseenleft | html %] of [% ISSUE.unseenallowed | html %] renewals left before the item must be seen by the library
513                                                                 [% END %]
514                                                             )</span>
515                                                         [% ELSIF ( ISSUE.item_denied_renewal ) %]
516                                                             Renewal not allowed
517                                                         [% END %]
518                                                         </td>
519                                                     [% END %]
520                                                     [% IF ( OPACFinesTab ) %]
521                                                         <td class="fines">
522                                                             <span class="tdlabel">Fines:</span>
523                                                             [% IF ( ISSUE.charges ) %]
524                                                                 <span>Yes (Item overdue or lost)</span>
525                                                             [% ELSIF ( ISSUE.rentalfines ) %]
526                                                                 <span>Yes (Rental fees)</span>
527                                                             [% ELSE %]
528                                                                 <span>No</span>
529                                                             [% END %]
530                                                         </td>
531                                                     [% END %]
532                                                     [% IF ( OPACMySummaryHTML ) %]
533                                                         <td class="links">[% ISSUE.MySummaryHTML | $raw %]</td>
534                                                     [% END %]
535                                                     [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
536                                                         <td>
537                                                             [% ISSUE.note | html %]
538                                                         </td>
539                                                         <td class="note">
540                                                             <div id="viewnote_[% ISSUE.issue_id | html %]">
541                                                                 [% ISSUE.note | html %]
542                                                             </div>
543                                                             <a id="save_[% ISSUE.issue_id | html %]" href="/cgi-bin/koha/opac-issue-note.pl?issue_id=[% ISSUE.issue_id | html %]" class="btn btn-primary btn-sm btn-add-note noprint" data-title="[% ISSUE.title | html %] [% FOREACH subtitle IN ISSUE.subtitle.split(' \| ') %][% IF Koha.Preference('marcflavour')=='UNIMARC' %],[% END %][% subtitle | html %][% END %]" data-issueid="[% ISSUE.issue_id | html %]" id="save_[% ISSUE.issue_id | html %]">
544                                                                 [% IF ( ISSUE.note ) -%]
545                                                                     <span>Edit note</span>
546                                                                 [% ELSE -%]
547                                                                     <span>Add note</span>
548                                                                 [% END %]
549                                                             </a>
550                                                             <input type="hidden" id="note_[% ISSUE.issue_id | html %]" name="note" value="[% ISSUE.note | html %]" data-origvalue="[% ISSUE.note | html %]" />
551                                                         </td>
552                                                     [% END %]
553                                                     </tr>
554                                                 [% END # /FOREACH ISSUES %]
555                                             </tbody>
556                                         </table>
557                                         [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
558                                             <input type="submit" class="btn btn-primary" value="Renew selected" />
559                                             <button type="button" id="renewall_js" class="btn btn-primary">Renew all</button>
560                                         [% END %]
561                                     </form>
562
563                                     [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
564                                         <form id="renewall" class="js-hide" action="/cgi-bin/koha/opac-renew.pl" method="post">
565                                             <legend class="sr-only">Renew</legend>
566                                             <input type="hidden" name="from" value="opac_user" />
567                                             <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
568                                             [% FOREACH ISSUE IN ISSUES %]
569                                                 [% IF ISSUE.status %]
570                                                     <input type="hidden" name="item" value="[% ISSUE.itemnumber | html %]" />
571                                                 [% END %]
572                                             [% END %]
573                                             <input type="submit" class="btn btn-primary" value="Renew all" />
574                                         </form>
575                                     [% END %]
576                                 [% ELSE %]
577                                     <table class="table table-bordered table-striped">
578                                         <caption class="sr-only">Checked out</caption>
579                                         <tr><td>You have nothing checked out</td></tr>
580                                     </table>
581                                 [% END # IF issues_count %]
582
583                                 <!-- Add note modal -->
584                                 <div class="modal" id="addNoteModal" tabindex="-1" aria-labelledby="addNoteLabel" aria-hidden="true">
585                                     <div class="modal-dialog">
586                                         <form action="#" id="addNoteForm">
587                                             <div class="modal-content">
588                                                 <div class="modal-header">
589                                                     <h5 class="modal-title" id="addNoteLabel">Report a problem</h5>
590                                                     <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
591                                                         <span aria-hidden="true">&times;</span>
592                                                     </button>
593                                                 </div>
594                                                 <div class="modal-body" id="addNoteBody">
595                                                     <h6 id="addNoteTitle"></h6>
596                                                     <input type="hidden" id="addNoteIssueId" name="issue_id" value="" />
597                                                     <textarea name="note" id="addNote" rows="4"></textarea>
598                                                     <div class="hint">Your note will be shown to the librarian when the item is checked in.</div>
599                                                 </div>
600                                                 <div class="modal-footer">
601                                                     <button type="submit" class="btn btn-primary">Submit note</button>
602                                                     <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
603                                                 </div>
604                                             </div>
605                                         </form>
606                                     </div>
607                                 </div>
608
609                             </div> <!-- / .opac-user-checkouts -->
610
611                             [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
612                                 <div id="opac-user-clubs" class="tab-pane" role="tabpanel" aria-labelledby="opac-user-clubs-tab-link">
613                                     Loading...
614                                 </div>
615                             [% END %]
616
617                             [% IF ( OPACFinesTab ) %]
618                                 <!-- FINES BOX -->
619                                 [% IF ( amountoutstanding > 0 ) %]
620                                     <div id="opac-user-fines" class="tab-pane" id="home" role="tabpanel" aria-labelledby="opac-user-fines-tab">
621                                         <table class="table table-bordered table-striped">
622                                             <caption>Charges</caption>
623                                             <thead><tr><th colspan="2">Amount</th></tr></thead>
624                                             <tbody>
625                                                 <tr>
626                                                     <td>You currently owe fines and charges amounting to:</td>
627                                                     <td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding | $Price %]</a></td>
628                                                 </tr>
629                                             </tbody>
630                                         </table>
631                                     </div>
632                                 [% END %]
633
634                                 [% IF ( amountoutstanding < 0 ) %]
635                                     <div id="opac-user-fines" class="tab-pane" id="home" role="tabpanel" aria-labelledby="opac-user-fines-tab">
636                                         <table class="table table-bordered table-striped">
637                                             <caption>Credits</caption>
638                                             <thead><tr><th colspan="2">Amount</th></tr></thead>
639                                             <tbody>
640                                                 <tr>
641                                                     <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding * -1 | $Price %]</a></td>
642                                                 </tr>
643                                             </tbody>
644                                         </table>
645                                     </div>
646                                 [% END %]
647
648                                 [% IF relatives_with_fines %]
649                                     <div id="opac-user-relative-fines" class="tab-pane" role="tabpanel" aria-labelledby="opac-user-relative-fines-tab">
650                                         <table class="table table-bordered table-striped">
651                                             <caption>Fines and charges</caption>
652                                             <thead>
653                                                 <tr>
654                                                     <th colspan="2">Amount</th>
655                                                 </tr>
656                                             </thead>
657                                             <tbody>
658                                                 [% FOREACH r IN relatives_with_fines %]
659                                                 <tr>
660                                                     <td>[% r.firstname | html %] [% r.surname | html %] currently owes fines and charges amounting to:</td>
661                                                     <td><a href="/cgi-bin/koha/opac-account.pl#g[% r.id | uri %]">[% r.account.balance | $Price %]</a></td>
662                                                 </tr>
663                                                 [% END %]
664                                             </tbody>
665                                         </table>
666                                     </div>
667                                 [% END %]
668                             [% END # / OPACFinesTab %]
669
670                             [% IF relatives %]
671                                 <div id="opac-user-relative-issues" class="tab-pane" role="tabpanel" aria-labelledby="opac-user-relative-issues-tab">
672                                     <table id="opac-user-relative-issues-table" class="table table-bordered table-striped">
673                                         <caption class="sr-only">Relative issues</caption>
674                                         <thead>
675                                             <tr>
676                                                 <th class="anti-the">Title</th>
677                                                 <th>Due</th>
678                                                 <th>Barcode</th>
679                                                 <th>Call number</th>
680                                                 <th class="psort">Relative</th>
681                                             </tr>
682                                         </thead>
683
684                                         <tbody>
685                                             [% FOREACH r IN relatives %]
686                                                 [% FOREACH c IN r.checkouts %]
687                                                     <tr>
688                                                         <td>
689                                                             <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% c.item.biblio.biblionumber | uri %]">
690                                                                 [% c.item.biblio.title | html %][% IF ( c.item.enumchron ) %] [% c.item.enumchron | html %][% END %]
691                                                             </a>
692                                                         </td>
693
694                                                         <td>
695                                                             [% c.date_due | $KohaDates %]
696                                                         </td>
697
698                                                         <td>
699                                                             [% c.item.barcode | html %]
700                                                         </td>
701
702                                                         <td>
703                                                             [% c.item.itemcallnumber | html %]
704                                                         </td>
705
706                                                         <td>
707                                                             [% r.firstname | html %] [% r.surname | html %]
708                                                         </td>
709                                                     </tr>
710                                                 [% END %]
711                                             [% END %]
712                                         </tbody>
713                                     </table>
714                                 </div>
715                             [% END %]
716
717                             [% IF ( overdues_count ) %]
718                                 <div id="opac-user-overdues" class="tab-pane" role="tabpanel" aria-labelledby="opac-user-overdues-tab">
719                                     <table id="overduest" class="table table-bordered table-striped">
720                                         <caption>Overdues <span class="count">([% overdues_count | html %] total)</span></caption>
721                                         <!-- OVERDUES TABLE ROWS -->
722                                         <thead>
723                                             <tr>
724                                                 [% IF ( JacketImages ) %]<th class="nosort">&nbsp;</th>[% END %]
725                                                 <th class="anti-the">Title</th>
726                                                 [% UNLESS ( item_level_itypes ) %]<th>Item type</th> [% END %]
727                                                 [% IF ( show_barcode ) %]<th>Barcode</th>[% END %]
728                                                 <th>Call number</th>
729                                                 <th class="psort">Due</th>
730                                                 [% IF ( OpacRenewalAllowed ) %]
731                                                     <th class="nosort">Renew</th>
732                                                 [% END %]
733                                                 [% IF ( OPACFinesTab ) %]
734                                                     <th>Fines</th>
735                                                 [% END %]
736                                             </tr>
737                                         </thead>
738                                         <tbody>
739                                             [% FOREACH OVERDUE IN OVERDUES %]
740                                                 <tr>
741                                                     [% IF ( JacketImages ) %]
742                                                         <td class="jacketcell">
743                                                         [% IF ( OPACAmazonCoverImages ) %]
744                                                             [% IF ( OVERDUE.normalized_isbn ) %]
745                                                                 <a href="http://www.amazon.com/gp/reader/[% OVERDUE.normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link" title="View on Amazon.com"><img src="https://images-na.ssl-images-amazon.com/images/P/[% OVERDUE.normalized_isbn | html %].01.THUMBZZZ.jpg" alt="View on Amazon.com" class="item-thumbnail" /></a>
746                                                             [% ELSE %]
747                                                                 <a href="#"><span class="no-image">No cover image available</span></a>
748                                                             [% END %]
749                                                         [% END %]
750
751                                                         [% IF ( GoogleJackets ) %]
752                                                             [% IF ( OVERDUE.normalized_isbn ) %]
753                                                                 <div style="display:block;" title="Click to view in Google Books" class="[% OVERDUE.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
754                                                             [% ELSE %]
755                                                                 <a href="http://books.google.com/books?q=[% OVERDUE.title |url %]"><span class="no-image">No cover image available</span></a>
756                                                             [% END %]
757                                                         [% END %]
758
759                                                         [% IF ( BakerTaylorEnabled ) %]
760                                                             [% bt_id = ( OVERDUE.normalized_upc || OVERDUE.normalized_isbn ) %]
761                                                             [% IF ( bt_id ) %]
762                                                                 <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
763                                                             [% ELSE %]
764                                                                 <span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
765                                                             [% END %]
766                                                         [% END %]
767
768                                                         [% IF ( SyndeticsCoverImages ) %]
769                                                             <img src="https://secure.syndetics.com/index.aspx?isbn=[% OVERDUE.normalized_isbn | html %]/[% SyndeticsCoverImageSize | uri %].GIF&amp;client=[% SyndeticsClientCode | html %]&amp;upc=[% OVERDUE.normalized_upc | html %]&amp;oclc=[% OVERDUE.normalized_oclc | html %]&amp;type=xw10" alt="" class="item-thumbnail" />
770                                                         [% END %]
771                                                         </td>
772                                                     [% END # /IF jacketcell %]
773
774                                                     <td>
775                                                         [% INCLUDE 'biblio-title.inc' biblio=OVERDUE link=> 1 %]
776                                                         <span class="item-details">[% OVERDUE.author | html %]</span>
777                                                     </td>
778
779                                                     [% UNLESS ( item_level_itypes ) %]
780                                                         <td>
781                                                             [% IF ( OVERDUE.imageurl  && !Koha.Preference('OpacNoItemTypeImages') ) %]
782                                                                 <img src="[% OVERDUE.imageurl | html %]" title="[% OVERDUE.description | html %]" alt="[% OVERDUE.description | html %]" />
783                                                             [% END %] [% OVERDUE.description | html %]
784                                                         </td>
785                                                     [% END %]
786                                                     [% IF ( show_barcode ) %]
787                                                         <td>
788                                                             <span class="tdlabel">Barcode:</span>
789                                                             [% OVERDUE.barcode | html %]
790                                                         </td>
791                                                     [% END %]
792                                                     <td>
793                                                         <span class="tdlabel">Call number:</span>
794                                                         [% OVERDUE.itemcallnumber | html %]
795                                                     </td>
796                                                     <td data-order="[% OVERDUE.date_due | html %]">
797                                                         <span class="tdlabel">Date due:</span>
798                                                         [% OVERDUE.date_due | $KohaDates  as_due_date => 1 %]
799                                                     </td>
800                                                     [% IF ( OpacRenewalAllowed ) %]
801                                                         <td>
802                                                             [% IF ( OVERDUE.debarred ) %]
803                                                                 Account frozen
804                                                             [% ELSIF ( OVERDUE.status ) %]
805                                                                 [% IF ( canrenew ) %]
806                                                                     <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber | uri %]&amp;bornum=[% OVERDUE.borrowernumber | uri %]">Renew</a>
807                                                                 [% END %]
808                                                                     <span class="renewals">(
809                                                                         [% OVERDUE.renewsleft | html %] of [% OVERDUE.renewsallowed | html %] renewals remaining
810                                                                         [% IF Koha.Preference('UnseenRenewals') && ISSUE.unseenallowed %]
811                                                                             / [% OVERDUE.unseenleft | html %] of [% OVERDUE.unseenallowed | html %] renewals left before the item must be seen by the library
812                                                                         [% END %]
813                                                                     )</span>
814                                                             [% ELSIF ( OVERDUE.norenew_overdue ) %]
815                                                                 Not allowed <span class="renewals">(overdue)</span>
816                                                             [% ELSIF ( OVERDUE.onreserve ) %]
817                                                                 <span>On hold</span>
818                                                             [% ELSE %]
819                                                                <span>No renewals left</span>
820                                                             [% END %]
821                                                         </td>
822                                                     [% END %]
823                                                     [% IF ( OPACFinesTab ) %]
824                                                         <td>
825                                                             <span class="tdlabel">Fines:</span>
826                                                             [% IF ( OVERDUE.charges ) %]
827                                                                 <span>Yes</span>
828                                                             [% ELSE %]
829                                                                 <span>No</span>
830                                                             [% END %]
831                                                         </td>
832                                                     [% END %]
833                                                 </tr>
834                                             [% END %]
835                                         </tbody>
836                                     </table>
837                                 </div> <!-- / #opac-user-overdues -->
838                             [% END # /overdues_count %]
839
840                             [% PROCESS 'holds-table.inc' HOLDS = RESERVES, SuspendHoldsOpac = SuspendHoldsOpac, showpriority = showpriority, AutoResumeSuspendedHolds = AutoResumeSuspendedHolds %]
841
842                             [% IF Koha.Preference('UseRecalls') && RECALLS.count %]
843                                 <div id="opac-user-recalls" class="tab-pane" role="tabpanel" aria-labelledby="opac-user-recalls-tab">
844                                     <table id="recalls-table" class="table table-bordered table-striped">
845                                         <caption>Recalls <span class="count">([% RECALLS.count | html %])</span></caption>
846                                         <thead>
847                                             <tr>
848                                                 <th class="anti-the">Title</th>
849                                                 <th class="psort">Placed on</th>
850                                                 <th>Expires on</th>
851                                                 <th>Pickup location</th>
852                                                 <th>Status</th>
853                                                 <th class="nosort">&nbsp;</th>
854                                             </tr>
855                                         </thead>
856                                         <tbody>
857                                             [% FOREACH RECALL IN RECALLS %]
858                                             <tr>
859                                                 <td class="title">
860                                                     [% INCLUDE 'biblio-title.inc' biblio=RECALL.biblio link=> 1 %]
861                                                     [% IF RECALL.item_level %]<p class="hint">Item recalled: [% RECALL.item.barcode | html %]</p>[% END %]
862                                                 </td>
863                                                 <td class="recalldate" data-order="[% RECALL.created_date | html %]">
864                                                     <span title="[% RECALL.created_date | html %]">
865                                                         <span class="tdlabel">Recall date:</span>
866                                                         [% RECALL.created_date | $KohaDates %]
867                                                     </span>
868                                                 </td>
869                                                 <td class="expirationdate" data-order="[% RECALL.expiration_date | html %]">
870                                                     [% IF ( RECALL.expiration_date ) %]
871                                                         <span title="[% RECALL.expiration_date | html %]">
872                                                             <span class="tdlabel">Expiration:</span>
873                                                             [% RECALL.expiration_date | $KohaDates %]
874                                                         </span>
875                                                     [% ELSE %]
876                                                         <span title="0000-00-00">
877                                                             <span class="tdlabel">Expiration:</span>
878                                                             Never expires
879                                                         </span>
880                                                     [% END %]
881                                                 </td>
882                                                 <td class="branch">
883                                                     <span class="tdlabel">Pick up location:</span>
884                                                     [% RECALL.library.branchname | html %]
885                                                 </td>
886                                                 <td class="status">
887                                                     <span class="tdlabel">Status:</span>
888                                                     [% IF ( RECALL.requested ) %]
889                                                         <span>Requested</span>
890                                                     [% ELSIF ( RECALL.overdue ) %]
891                                                         <span>Overdue to be returned</span>
892                                                     [% ELSIF ( RECALL.in_transit ) %]
893                                                         <span>In transit to [% RECALL.library.branchname | html %]</span>
894                                                     [% ELSIF ( RECALL.waiting ) %]
895                                                         <span>Ready for pickup</span>
896                                                     [% END %]
897                                                 </td>
898                                                 <td class="cancelrecall">
899                                                     [% IF ( RECALL.requested or RECALL.overdue ) %]
900                                                         <form action="/cgi-bin/koha/opac-recall.pl" method="post">
901                                                             <input type="hidden" name="op" value="cancel">
902                                                             <input type="hidden" name="recall_id" value="[% RECALL.id | html %]">
903                                                             <input type="hidden" name="biblionumber" value="[% RECALL.biblio_id | html %]">
904                                                             <button type="submit" name="submit" class="btn btn-sm btn-danger cancel_recall"><i class="fa fa-remove" aria-hidden="true"></i> Cancel</button>
905                                                         </form>
906                                                     [% END %]
907                                                 </td>
908                                             [% END %]
909                                             </tr>
910                                         </tbody>
911                                     </table>
912                                 </div>
913                             [% END # / # RECALLS.count %]
914
915                             [% IF Koha.Preference('ArticleRequests') %]
916                                 <div id="opac-user-article-requests" class="tab-pane" role="tabpanel" aria-labelledby="opac-user-article-requests-tab">
917                                     [% IF current_article_requests.size %]
918                                         <table id="article-requests-table" class="table table-bordered table-striped">
919                                             <caption>Article requests <span class="count"></span></caption>
920                                             <thead>
921                                                 <tr>
922                                                     <th class="anti-the article-request-record-title">Record title</th>
923                                                     <th class="psort article-request-created-on">Placed on</th>
924                                                     <th class="anti-the article-request-title">Title</th>
925                                                     <th class="article-request-author">Author</th>
926                                                     <th class="article-request-volume">Volume</th>
927                                                     <th class="article-request-issue">Issue</th>
928                                                     <th class="article-request-date">Date</th>
929                                                     <th class="article-request-toc" title="Table of contents">TOC</th>
930                                                     <th class="article-request-pages">Pages</th>
931                                                     <th class="article-request-chapters">Chapters</th>
932                                                     <th class="article-request-patron-notes">Notes</th>
933                                                     <th class="article-request-format">Format</th>
934                                                     <th class="article-request-status">Status</th>
935                                                     <th class="article-request-branchcode">Pickup library</th>
936                                                     <th class="nosort article-request-cancel">&nbsp;</th>
937                                                 </tr>
938                                             </thead>
939
940                                             <tbody>
941                                                     [% FOREACH ar IN current_article_requests %]
942                                                         <tr>
943                                                             <td class="article-request-record-title">
944                                                                 [% INCLUDE 'biblio-title.inc' biblio=ar.biblio link=> 1 %]
945                                                                 [% ar.item.enumchron | html %]
946                                                                 [% ar.biblio.author | html %]
947                                                                 [% IF ar.itemnumber %] <em>(only [% ar.item.barcode | html %])</em>[% END %]
948                                                             </td>
949
950                                                             <td class="article-request-created_on">
951                                                                 [% ar.created_on | $KohaDates %]
952                                                             </td>
953
954                                                             <td class="article-request-title">
955                                                                 [% ar.title | html %]
956                                                             </td>
957
958                                                             <td class="article-request-author">
959                                                                 [% ar.author | html %]
960                                                             </td>
961
962                                                             <td class="article-request-volume">
963                                                                 [% ar.volume | html %]
964                                                             </td>
965
966                                                             <td class="article-request-issue">
967                                                                 [% ar.issue | html %]
968                                                             </td>
969
970                                                             <td class="article-request-date">
971                                                                 [% ar.date | html %]
972                                                             </td>
973
974                                                             <td class="article-request-toc">
975                                                                 [% IF ar.toc_request %]Yes[% END %]
976                                                             </td>
977
978                                                             <td class="article-request-pages">
979                                                                 [% ar.pages | html %]
980                                                             </td>
981
982                                                             <td class="article-request-chapters">
983                                                                 [% ar.chapters | html %]
984                                                             </td>
985
986                                                             <td class="article-request-patron-notes">
987                                                                 [% ar.patron_notes | html %]
988                                                             </td>
989
990                                                             <td class="article-request-format">[% IF ar.format == 'PHOTOCOPY' %]<span>Copy</span>[% ELSIF ar.format == 'SCAN' %]<span>Scan</span>[% END %]</td>
991
992                                                             <td class="article-request-status">
993                                                                 [% IF ar.status == 'PENDING' %]
994                                                                     <span>Pending</span>
995                                                                 [% ELSIF ar.status == 'PROCESSING' %]
996                                                                     <span>Processing</span>
997                                                                 [% ELSIF ar.status == 'REQUESTED' %]
998                                                                     <span>New</span>
999                                                                 [% ELSIF ar.status == 'COMPLETED' %]
1000                                                                     <span>Completed</span>
1001                                                                 [% ELSIF ar.status == 'CANCELED' %]
1002                                                                     <span>Canceled</span>
1003                                                                 [% END %]
1004                                                             </td>
1005
1006                                                             <td class="article-request-branchcode">
1007                                                                 [% ar.branch.branchname | html %]
1008                                                             </td>
1009
1010                                                             <td class="article-request-cancel">
1011                                                                 <button data-title="[% ar.biblio.title | html %] [% ar.item.enumchron | html %]" data-article-request_id="[% ar.id | html %]" class="btn btn-sm btn-danger btn-delete-article-request"><i class="fa fa-remove" aria-hidden="true"></i> Cancel</button>
1012                                                             </td>
1013                                                         </tr>
1014                                                     [% END %]
1015                                             </tbody>
1016                                         </table>
1017                                     [% ELSE %]
1018                                         <table class="table table-bordered table-striped">
1019                                             <caption class="sr-only">Article requests</caption>
1020                                             <tr><td>You have no article requests currently.</td></tr>
1021                                         </table>
1022                                     [% END # IF current_article_requests.size %]
1023                                 </div> <!-- / #opac-user-article-requests -->
1024                             [% END %]
1025                         </div> <!-- /.tab-content -->
1026                     </div> <!-- /#opac-user-views -->
1027                 </div> <!-- /#userdetails -->
1028             </div> <!-- /.col-10 -->
1029         </div> <!-- /.row -->
1030     </div> <!-- /.container-fluid -->
1031 </div> <!-- /#main -->
1032
1033 [% # hold suspend modal form %]
1034 <div id="suspendHoldModal" class="modal" tabindex="-1" role="dialog" aria-labelledby="suspendModalLabel" aria-hidden="true" data-focus="false">
1035     <div class="modal-dialog">
1036         <div class="modal-content">
1037             <form action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
1038                 <div class="modal-header">
1039                     [% IF HOLD.suspend %]
1040                         <h5 class="modal-title" id="suspendModalLabel">Resume hold</h5>
1041                     [% ELSE %]
1042                         <h5 class="modal-title" id="suspendModalLabel">Suspend hold</h5>
1043                     [% END %]
1044                     <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
1045                         <span aria-hidden="true">x</span>
1046                     </button>
1047                 </div>
1048                 <div class="modal-body">
1049                     <h6 id="suspendHoldTitle"></h6>
1050                     <input type="hidden" name="reserve_id" id="suspendHoldReserveId" value="" />
1051                     <label for="suspend_untilDate">Suspend until:</label>
1052                     <input type="text" name="suspend_until" id="suspend_untilDate" size="10" />
1053                     [% INCLUDE 'date-format.inc' %]
1054                     <p><a href="#" class="clear-flatpickr" data-fp="suspend_untilDate">Clear date to suspend indefinitely</a></p>
1055                 </div>
1056                 <div class="modal-footer">
1057                     <button class="btn btn-primary"><i class="fa fa-check" aria-hidden="true"></i> Suspend</button>
1058                     <button data-dismiss="modal" class="btn btn-secondary"><i class="fa fa-remove" aria-hidden="true"></i> Do not suspend</button>
1059                 </div>
1060             </form>
1061         </div> <!-- /.modal-content -->
1062     </div> <!-- /.modal-dialog -->
1063 </div>  <!-- /#suspendModal -->
1064
1065 [% IF ( OverDriveCirculation ) %]
1066     [% INCLUDE 'overdrive-checkout.inc' %]
1067     [% IF ( Koha.Preference('OverDrivePasswordRequired') ) %]
1068         [% INCLUDE 'overdrive-login.inc' %]
1069     [% END %]
1070 [% END %]
1071 [% IF ( RecordedBooksCirculation ) %]
1072 [% INCLUDE 'recordedbooks-checkout.inc' %]
1073 [% END %]
1074
1075 [% INCLUDE 'opac-bottom.inc' %]
1076 [% BLOCK jsinclude %]
1077     [% INCLUDE 'calendar.inc' %]
1078     [% INCLUDE 'datatables.inc' %]
1079     <script>
1080         var AR_CAPTION_COUNT = _("(%s total)");
1081
1082
1083         function tableInit( tableId ){
1084             if( tableId == "checkoutst" ){
1085                 $(".dt-buttons").append("<button type=\"button\" class=\"dt-button buttons-ical\" id=\"buttons-ics\">iCal</button> ");
1086                 [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
1087                     $(".dt-buttons").append("<button id=\"renewselected_link\" class=\"dt-button buttons-renew\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> "+_("Renew selected")+"</button> <button id=\"renewall_link\" class=\"dt-button buttons-renewall\"><span class=\"fa-stack\"><i class=\"fa fa-check fa-stack-1x\" aria-hidden=\"true\"></i><i class=\"fa fa-check fa-stack-1x\" aria-hidden=\"true\"></i></span> "+_("Renew all")+"</button>");
1088                 [% END %]
1089             }
1090         }
1091         $(document).ready(function(){
1092             $('#opac-user-article-requests caption .count').html(AR_CAPTION_COUNT.format('[% current_article_requests.size | html %]'));
1093
1094             $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
1095
1096             $(".btn-delete-hold").on("click", function(e){
1097                 e.preventDefault();
1098                 var hold_title = $(this).data("title");
1099                 var reserve_id = $(this).data("reserve_id");
1100                 confirmModal( hold_title, _("Are you sure you want to cancel this hold?"), _("Yes, cancel hold"), _("No, do not cancel hold"), function( result ){
1101                         $("#bootstrap-confirm-box-modal").remove()
1102                         if( result ){
1103                             $("#delete_hold_" + reserve_id ).submit();
1104                         }
1105                     }
1106                 );
1107             });
1108
1109             $(".btn-req-delete-hold").on("click", function(e){
1110                 e.preventDefault();
1111                 var hold_title = $(this).data("title");
1112                 var reserve_id = $(this).data("reserve_id");
1113                 confirmModal( hold_title, _("Are you sure you want to request cancelling this hold?"), _("Yes"), _("No"), function( result ){
1114                         $("#bootstrap-confirm-box-modal").remove()
1115                         if( result ){
1116                             $("#req_cancel_hold_" + reserve_id ).submit();
1117                         }
1118                     }
1119                 );
1120             });
1121
1122             $(".btn-delete-article-request").on("click", function(e){
1123                 e.preventDefault();
1124                 var article_request = $(this).data("title");
1125                 var article_request_id = $(this).data("article-request_id");
1126                 (function(row){
1127                     var doCancel = function( result ){
1128                         $("#bootstrap-confirm-box-modal").remove();
1129                         if( result ){
1130                             $.ajax({
1131                                 type: "DELETE",
1132                                 url: '/api/v1/public/patrons/'+borrowernumber+'/article_requests/'+article_request_id+'?cancellation_reason=OPAC',
1133                                 success: function( data ) {
1134                                     row.parents('tr').hide({
1135                                         duration: 'slow',
1136                                         complete: function() {
1137                                             var ar_tab = $('a[href="#opac-user-article-requests"');
1138                                             var ar_table = $('#article-requests-table');
1139                                             var ar_length = $('tbody tr:visible', ar_table).length;
1140                                             var ar_count = $('caption .count', ar_table);
1141
1142                                             ar_tab.html(ar_tab.html().replace(/\(\d+\)/, '('+ar_length+')'));
1143                                             ar_count.html(AR_CAPTION_COUNT.format(ar_length));
1144                                         }
1145                                     });
1146                                 }
1147                             });
1148                         }
1149                     };
1150                     confirmModal( article_request, _("Are you sure you want to cancel this article request?"), _("Yes, cancel article request"), _("No, do not cancel article request"), doCancel);
1151                 })($(this))
1152             });
1153
1154             /* We initiate this flatpickr instance here so that we can use the variable later */
1155             var suspend_until_date = $("#suspend_untilDate").flatpickr({
1156                 minDate: "today"
1157             });
1158
1159             $(".suspend_hold").on("click", function(e){
1160                 e.preventDefault();
1161                 var title = $(this).data("title");
1162                 var reserve_id = $(this).data("reserve_id");
1163                 $("#suspendHoldReserveId").val( reserve_id );
1164                 $("#suspendHoldTitle").html( "<em>" + title + "</em>" );
1165                 $("#suspendHoldModal").modal("show");
1166             });
1167
1168             $("#suspendHoldModal").on("hidden.bs.modal", function(){
1169                 $("#suspendHoldTitle").html("");
1170                 $("#suspendHoldReserveId").val("");
1171                 suspend_until_date.clear();
1172             });
1173
1174             $("#suspend_all_submit").on("click", function(e){
1175                 e.preventDefault();
1176                 var title = _("Are you sure you want to suspend all holds?");
1177                 var body = _("All holds will be suspended.");
1178                 confirmModal( body, title, _("Yes, suspend all holds"), "", function( result ){
1179                         $("#bootstrap-confirm-box-modal").remove()
1180                         if( result ){
1181                             $("#suspend_all_holds").submit();
1182                         }
1183                     }
1184                 );
1185             });
1186
1187             $("#resume_all_submit").on("click", function(e){
1188                 e.preventDefault();
1189                 var title = _("Are you sure you want to resume all suspended holds?");
1190                 var body = _("All holds will resume.");
1191                 confirmModal( body, title, _("Yes, resume all holds"), _("No, do not resume holds"), function( result ){
1192                         $("#bootstrap-confirm-box-modal").remove()
1193                         if( result ){
1194                             $("#resume_all_holds").submit();
1195                         }
1196                     }
1197                 );
1198             });
1199
1200             var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
1201             dTables.each(function(){
1202                 var thIndex = $(this).find("th.psort").index();
1203                 $(this).on("init.dt", function() {
1204                         tableInit( $(this).attr("id") );
1205                     })
1206                     .dataTable($.extend(true, {}, dataTablesDefaults, {
1207                     "sorting" : [[ thIndex, 'asc' ]],
1208                     "dom": '<"top"<"table_entries"><"table_controls"fB>>t',
1209                     "columnDefs": [
1210                         { "targets": [ "nosort" ],"sortable": false,"searchable": false },
1211                         { "type": "anti-the", "targets" : [ "anti-the" ] },
1212                         { "visible": false, "targets" : [ "hidden" ] }
1213                     ],
1214                     "language": {
1215                         "search": "_INPUT_",
1216                         "searchPlaceholder": _("Search")
1217                     },
1218                     "autoWidth": false,
1219                     buttons: [
1220                         /* Override default button set so that we can extend the options of print and csv */
1221                         'clearFilter', 'copy',
1222                         {
1223                             extend: "print",
1224                             exportOptions: {
1225                                 /* Print view should show all columns (even invisible ones) unless they are .noExport */
1226                                 columns: ":not(.noExport)"
1227                             }
1228                         },
1229                         {
1230                             extend: "csv",
1231                             exportOptions: {
1232                                 /* CSV export should include all columns (even invisible ones) unless they are .noExport */
1233                                 columns: ":not(.noExport)"
1234                             }
1235                         }
1236                     ]
1237                 }));
1238             });
1239
1240             $("body").on("click", "#buttons-ics", function(){
1241                 location.href="/cgi-bin/koha/opac-ics.pl";
1242             });
1243
1244             [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
1245             [% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
1246                 $("#renewselected").submit(function(){
1247                     valid = false;
1248                     $("input[type=checkbox]").each(function(){
1249                         if($(this).is(':checked')){
1250                             valid = true;
1251                         }
1252                     });
1253                     if(!valid){
1254                         alert(_("Nothing has been selected. Check the box for each item you want to renew"));
1255                     }
1256                     return valid;
1257                 });
1258                 $("body").on("click","#renewselected_link",function(e){
1259                     e.preventDefault();
1260                     $("#renewselected").submit();
1261                 });
1262                 $("body").on("click","#renewall_link, #renewall_js",function(e){
1263                     e.preventDefault();
1264                     $("#renewall").submit();
1265                 });
1266             [% END # /IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
1267
1268             [% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
1269
1270                 /* If JS enabled, show button, otherwise show link to redirect to a page where note can be submitted */
1271                 $(".nonjs_submitnote").hide();
1272
1273                 $("input[name='note']").prop('readonly', false);
1274                 $("input[name='note']").keypress(function(e){
1275                     /* prevent submitting of renewselected form */
1276                     if(e.which == 13)
1277                         e.preventDefault();
1278                 });
1279
1280                 $("input[name='note']").keyup(function(e){
1281                     var $btn_save = $('#save_'+$(this).data('issue_id'));
1282                     var origvalue = $(this).data('origvalue');
1283                     var value = $(this).val();
1284
1285                     if(origvalue != value) {
1286                         if(origvalue != "")
1287                             $btn_save.text(_("Submit changes"));
1288                         else
1289                             $btn_save.text(_("Submit note"));
1290                         $btn_save.show();
1291                     } else {
1292                         $btn_save.hide();
1293                     }
1294                 });
1295
1296             [% END %]
1297
1298             $(".change_pickup").on("click", function(){
1299                 var hold_id = $(this).data("hold-id");
1300                 $(this).hide();
1301                 $("#change-pickup-location" + hold_id ).show();
1302             });
1303
1304             if ( $('#opac-user-clubs').length ) {
1305                 $('#opac-user-clubs-tab-link').on('click', function() {
1306                     $('#opac-user-clubs').text(_("Loading..."));
1307                     $('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber | html %]');
1308                 });
1309             }
1310
1311             $(".cancel_recall").click(function(e){
1312                 return confirmDelete(_("Are you sure you want to remove this recall?"));
1313             });
1314
1315             $("body").on("click", ".btn-add-note", function(e){
1316                 e.preventDefault();
1317                 var title = $(this).data("title");
1318                 var issue_id = $(this).data("issueid");
1319                 var note = $("#note_" + issue_id ).val();
1320                 var origvalue = $("#note_" + issue_id ).data("origvalue");
1321                 $("#addNote").val( note );
1322                 $("#addNoteIssueId").val( issue_id );
1323                 $("#addNoteTitle").text( title );
1324                 $("#addNoteModal").modal("show");
1325             });
1326
1327             $("#addNoteForm").on("submit", function(e){
1328                 e.preventDefault();
1329                 var title = $("#addNoteTitle").text();
1330                 var issue_id = $("#addNoteIssueId").val();
1331                 var note = $("#addNote").val();
1332                 submitNote( title, issue_id, note );
1333             });
1334
1335             $("#addNoteModal").on("hidden.bs.modal", function(){
1336                 $("#addNoteTitle").text("");
1337                 $("#addNote").val("");
1338             });
1339
1340             $(".dismiss-message-button").click(function(e){
1341                 return confirmDelete(_("Are you sure you want to dismiss this message?"));
1342             });
1343         });
1344
1345         function submitNote( title, issue_id, note ){
1346             var self = $("#addNoteModal");
1347             var notebutton = $("#save_" + issue_id );
1348             var noteinput = $("#note_" + issue_id );
1349
1350             var ajaxData = {
1351                 'action': 'issuenote',
1352                 'issue_id': issue_id,
1353                 'note': note
1354             };
1355
1356             $.ajax({
1357                 url: '/cgi-bin/koha/svc/checkout_notes/',
1358                 type: 'POST',
1359                 dataType: 'json',
1360                 data: ajaxData,
1361             })
1362             .done(function(data) {
1363                 var message = "";
1364                 if(data.status == 'saved') {
1365                     $("#notesaved").removeClass("alert-error");
1366                     $("#notesaved").addClass("alert-info");
1367                     noteinput.data('origvalue', data.note)
1368                         .val(data.note);
1369                     notebutton.text( _("Edit note" ) );
1370                     $("#viewnote_" + issue_id ).text( data.note );
1371                     message = "<p>" + _("Your note about %s has been saved and sent to the library.").format( em(title) ) + "</p>";
1372                     message += "<p class=\"checkout_note\">" + data.note;
1373                     message += "<a href=\"/cgi-bin/koha/opac-issue-note.pl?issue_id=" + issue_id + "\" class=\"btn btn-link btn-sm btn-add-note\" data-title=\"" + title + "\" data-issueid=\"" + issue_id + "\"><i class=\"fa fa-pencil\" aria-hidden=\"true\"></i> " + _("Edit note") + "</a>";
1374                     message += "</p>";
1375                 } else if(data.status == 'removed') {
1376                     $("#notesaved").removeClass("alert-error");
1377                     $("#notesaved").addClass("alert-info");
1378                     noteinput.data('origvalue', "")
1379                         .val("")
1380                     notebutton.text( _("Add note") );
1381                     $("#viewnote_" + issue_id ).text( data.note );
1382                     message = "<p>" + _("Your note about %s was removed.").format( em(title) ) + "</p>";
1383                 } else {
1384                     $("#notesaved").removeClass("alert-info");
1385                     $("#notesaved").addClass("alert-error");
1386                     message =  "<p>" + _("Your note about %s could not be saved.").format( em(title) ) + "</p>";
1387                     notebutton.text( _("Add note") );
1388                     $("#viewnote_" + issue_id ).text( data.note );
1389                     message += "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
1390                 }
1391                 $("#notesaved").html(message);
1392             })
1393             .fail(function(data) {
1394                 $("#notesaved").removeClass("alert-info");
1395                 $("#notesaved").addClass("alert-error");
1396                 var message = "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
1397                 $("#notesaved").html(message);
1398             })
1399             .always(function() {
1400                 self.modal("hide");
1401                 $("#notesaved").show();
1402             });
1403         }
1404
1405         function em( title ){
1406             return "<em>" + title + "</em>";
1407         }
1408
1409         var borrowernumber = "[% borrowernumber | html %]";
1410     </script>
1411     [% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
1412         [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
1413         [% Asset.js("js/ratings.js") | $raw %]
1414     [% END %]
1415     [% IF Koha.Preference('OverDriveCirculation') %]
1416     [% Asset.js("js/overdrive.js") | $raw %]
1417     <script>
1418     [%- IF Koha.Preference('OverDrivePasswordRequired') -%]
1419         var OD_password_required = 1;
1420     [%- ELSE -%]
1421         var OD_password_required = 0;
1422     [%- END -%]
1423     $(document).ready(function() {
1424         [% IF ( overdrive_error ) %]
1425             KOHA.OverDriveCirculation.display_error("#opac-user-overdrive", "[% overdrive_error.dquote | html %]");
1426         [% END %]
1427
1428         [% IF ( overdrive_tab ) %]
1429             $("#opac-user-views a[href='#opac-user-overdrive']").tab("show");
1430         [% END %]
1431
1432         $("#opac-user-overdrive").each( function() {
1433             KOHA.OverDriveCirculation.display_account_details(this);
1434         } );
1435     });
1436     </script>
1437     [% END %]
1438     [% IF RecordedBooksCirculation %]
1439         [% Asset.js("js/recordedbooks.js") | $raw %]
1440         <script>
1441             $(document).ready(function() {
1442                 [% IF ( recordedbooks_error ) %]
1443                     KOHA.RecordedBooks.display_error("#opac-user-recordedbooks", "[% recordedbooks_error.dquote | html %]");
1444                 [% END %]
1445                 [% IF ( recordedbooks_tab ) %]
1446                     $("#opac-user-views a[href='#opac-user-recordedbooks']").tab("show");
1447                 [% END %]
1448                 $("#opac-user-recordedbooks").each( function() {
1449                     KOHA.RecordedBooks.display_account_details(this);
1450                 } );
1451             });
1452         </script>
1453     [% END %]
1454 [% END %]