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