Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
Owen Leonard 54dcce1413 Bug 26766: Correct selection of title during OPAC note confirmation
This patch modifies the JavaScript in opac-user.tt which executes when
the user submits a checkout note. The script tries to grab the
checkout's title from an earlier cell in the table row so that it can
display it in the confirmation message.

Before start ratings were enabled on this page, the title of each
checked-out item was the only HTML inside this table cell, so it was
necessary only to grab the HTML contents of the <td>. Now that star
ratings might be displayed as well we must make the selection more
specific.

To test, apply the patch and enable both the  OpacStarRatings and
AllowCheckoutNotes preferences.

 - Log in to the OPAC as a user with checkouts.
 - On the "Your summary" page, fill out and submit the "Note" field for
   one of your checkouts.
 - In the confirmation message, confirm that the correct title
   information is displayed as a link to the bibliographic detail page.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-10-26 00:14:42 +01:00

1043 lines
70 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
[% USE Branches %]
[% USE ItemTypes %]
[% USE Price %]
[% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
[% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
[% SET borrower_club_enrollments = logged_in_user.get_club_enrollments(1) %]
[% SET borrower_enrollable_clubs = logged_in_user.get_enrollable_clubs(1,1) %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your library home</title>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %][% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='opac-user' bodyclass='scrollto' %]
[% INCLUDE 'masthead.inc' %]
[% IF Koha.Preference('AmazonAssocTag') %]
[% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') %]
[% ELSE %]
[% AmazonAssocTag = '' %]
[% END %]
<div class="main">
<nav aria-label="breadcrumb">
<ul class="breadcrumb">
<li class="breadcrumb-item">
<a href="/cgi-bin/koha/opac-main.pl">Home</a>
</li>
<li class="breadcrumb-item">
<a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
<a href="#">Your summary</a>
</li>
</ul>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col col-lg-2 order-2 order-lg-1">
<div id="navigation">
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
</div>
</div>
<div class="col-md-12 col-lg-10 order-1 order-lg-2">
<div id="userdetails" class="maincontent">
[% INCLUDE 'opac-note.inc' %]
<h2>Hello, [% INCLUDE 'patron-title.inc' patron = logged_in_user %]
</h2>
<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>
[% 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 %]
[% IF failed_holds %]
<div class="alert alert-info">
<h3>Notice:</h3>
<p>One or more holds were not placed due to existing holds.</p>
</div>
[% END %]
[% IF ( borrower.blockedonfines ) %]
<div class="alert alert-warning" id="blockedonfines">
<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>
</div>
[% END %]
[% IF ( borrower.warndeparture ) %]
<div class="alert alert-warning" id="warndeparture">
<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>
[% IF ( borrower.returnbeforeexpiry ) %]<span id="warndeparture_returnbeforeexpiry"> Also note that you must return all checked out items before your card expires.</span>[% END %]
</div>
[% END %]
[% IF ( borrower.warnexpired ) %]
<div class="alert alert-warning" id="warnexpired">
<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>
</div>
[% END %]
[% IF ( RENEW_ERROR ) %]
<div class="alert alert-warning">
<strong>Please note:</strong>
Your loan renewal failed because of the following reason(s):
<ul>
[% FOREACH error IN RENEW_ERROR.split('\|') %]
[% IF error == 'card_expired' %]
<li>Your account has expired. Please contact the library for more information.</li>
[% ELSIF error == 'too_many' %]
<li>You have renewed this item the maximum number of times allowed.</li>
[% ELSIF error == 'too_soon' %]
<li>It is too soon after the checkout date for this item to be renewed.</li>
[% ELSIF error == 'on_reserve' %]
<li>This item is on hold for another borrower.</li>
[% ELSIF error == 'item_denied_renewal' %]
<li>Item renewal is not allowed.</li>
[% ELSIF error == 'auto_too_soon' %]
<li>This item is scheduled for auto renewal.</li>
[% END %]
[% END %]
</ul>
</div>
[% END %]
[% IF ( patron_flagged ) %]
<div class="alert alert-warning">
<ul>
[% IF ( userdebarred ) %]
[% IF ( discharge_available ) %]
<li id="discharged">
<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>
</li>
[% ELSE %]
<li id="userdebarred"><strong>Please note:</strong> Your account has been frozen.
[% IF ( borrower.debarredcomment ) %]
Comment:
<span id="userdebarred_comment">
<strong>
[% IF borrower.debarredcomment.search('OVERDUES_PROCESS') %]
Restriction added by overdues process [% borrower.debarredcomment.remove('OVERDUES_PROCESS ') | html_line_break %]
[% ELSE %]
[% borrower.debarredcomment | html_line_break %]
[% END %]
</strong>
</span>
[% END %]
[% IF ( borrower.userdebarreddate && debarred_date != '9999-12-31' ) %]
End date:
<span id="userdebarred_date">[% borrower.userdebarreddate | $KohaDates %]</span>
[% END %]
<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>
[% END %]
[% END %]
[% IF ( borrower.gonenoaddress ) %]
<li id="gonenoaddress"><strong>Please note:</strong> According to our records, we don't have up-to-date contact information. Please contact the library.
<a href="/cgi-bin/koha/opac-memberentry.pl">[% IF ( Koha.Preference('OPACPatronDetails') ) %]Update your contact information[% ELSE %]Go to your contact information[% END %]</a>
[% IF ( Koha.Preference('OPACPatronDetails') ) %]<em>(Please note: there may be a delay in restoring your account if you submit online.)</em>[% END %]
</li>
[% END %]
[% IF ( borrower.lost ) %]
<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>
[% END %]
[% IF ( renewal_blocked_fines.defined ) && ( OpacRenewalAllowed ) %]
<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 %]
[% END %]
</ul>
</div>
[% END # / IF patron_flagged %]
<div class="alert alert-info" id="notesaved" style="display:none;"></div>
[% IF Koha.Preference('OPACMySummaryNote') %]
<div id="opac-my-summary-note">[% Koha.Preference('OPACMySummaryNote') | $raw %]</div>
[% END %]
[% IF Koha.Preference('AllowPatronToControlAutorenewal') %]
<form id="autorenewal_option" action="/cgi-bin/koha/opac-user.pl" method="post">
<label for="yes-autorenew_checkouts">
Allow auto-renewal:
</label>
[% IF ( borrower.autorenew_checkouts ) %]
<label class="radio inline" for="yes-autorenew_checkouts">
Yes
<input type="radio" id="yes-autorenew_checkouts" name="borrower_autorenew_checkouts" value="1" checked="checked" />
</label>
<label class="radio inline" for="no-autorenew_checkouts">
No
<input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" />
</label>
[% ELSE %]
<label class="radio inline" for="yes-autorenew_checkouts">
Yes
<input type="radio" id="yes-autorenew_checkouts" name="borrower_autorenew_checkouts" value="1" />
</label>
<label class="radio inline" for="no-autorenew_checkouts">
No
<input type="radio" id="no-autorenew_checkouts" name="borrower_autorenew_checkouts" value="0" checked="checked" />
</label>
[% END %]
<input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
<input type="hidden" name="update_arc" value="1" />
<input type="submit" value="Update auto-renewal preference" />
</form>
[% END %]
<div id="opac-user-views" class="toptabs">
<ul>
<li><a href="#opac-user-checkouts">Checked out ([% issues_count | html %])</a></li>
[% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
[% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count | html %])</a></li>[% END %]
[% IF ( OPACFinesTab ) %]
[% IF ( amountoutstanding > 0 ) %]<li><a href="#opac-user-fines">Charges ([% amountoutstanding | $Price %])</a></li>[% END %]
[% IF ( amountoutstanding < 0 ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding * -1 | $Price %])</a></li>[% END %]
[% IF relatives_with_fines %]<li><a href="#opac-user-relative-fines">Relatives' fines</a></li>[% END %]
[% END %]
[% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
<li>
<a id="opac-user-clubs-tab-link" href="#opac-user-clubs">
Clubs ([% borrower_club_enrollments.count || 0 | html %]/[% borrower_enrollable_clubs.count || 0 | html %])
</a>
</li>
[% END %]
[% IF ( RESERVES.count ) %]<li><a href="#opac-user-holds">Holds ([% RESERVES.count | html %])</a></li>[% END %]
[% 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 %]
[% IF ( OverDriveCirculation ) %]
<li><a href="#opac-user-overdrive">OverDrive Account</a></li>
[% END %]
[% IF ( RecordedBooksCirculation ) %]
<li><a href="#opac-user-recordedbooks">RecordedBooks Account</a></li>
[% END %]
</ul>
<div id="opac-user-overdrive">
</div>
<div id="opac-user-recordedbooks">
</div>
<div id="opac-user-checkouts">
[% IF ( issues_count ) %]
<form id="renewselected" action="/cgi-bin/koha/opac-renew.pl" method="post">
<input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]">
<input type="hidden" name="from" value="opac_user" />
<table id="checkoutst" class="table table-bordered table-striped">
<caption>[% issues_count | html %] Item(s) checked out</caption>
<thead>
<tr>
[% IF ( JacketImages || AdlibrisEnabled ) %]<th class="nosort">&nbsp;</th>[% END %]
<th class="anti-the">Title</th>
<th>Author</th>
<th class="title-string psort">Due</th>
[% UNLESS ( item_level_itypes ) %]
<th>Item type</th>
[% END %]
[% IF ( show_barcode ) %]
<th>Barcode</th>
[% END %]
<th>Call no.</th>
[% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
<th>Renew</th>
[% END %]
[% IF ( OPACFinesTab ) %]
<th>Fines</th>
[% END %]
[% IF ( OPACMySummaryHTML ) %]
<th class="nosort">Links</th>
[% END %]
[% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
<th id="checkout-notes" class="nosort" title="Use this to report any problems with your currently checked out items">Report a problem</th>
[% END %]
</tr>
</thead>
<tbody>
[% FOREACH ISSUE IN ISSUES %]
[% IF ( ISSUE.overdue ) %]<tr class="overdue">[% ELSE %]<tr>[% END %]
[% IF ( JacketImages || AdlibrisEnabled ) %]<td class="jacketcell">
[% IF ( AdlibrisEnabled && ISSUE.normalized_isbn ) %]
<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>
[% END %]
[% IF ( OPACAmazonCoverImages ) %]
[% IF ( ISSUE.normalized_isbn ) %]
<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>
[% ELSE %]
<a href="#"><span class="no-image">No cover image available</span></a>
[% END %]
[% END %]
[% IF ( GoogleJackets ) %]
[% IF ( ISSUE.normalized_isbn ) %]
<div style="display:block;" title="Click to view in Google Books" class="[% ISSUE.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
[% ELSE %]
<a href="http://books.google.com/books?q=[% ISSUE.title |url %]"><span class="no-image">No cover image available</span></a>
[% END %]
[% END %]
[% IF ( BakerTaylorEnabled ) %]
[% bt_id = ( ISSUE.normalized_upc || ISSUE.normalized_isbn ) %]
[% IF ( bt_id ) %]
<a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
[% ELSE %]
<span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
[% END %]
[% END %]
[% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
<a class="custom_cover_image" href="[% ISSUE.biblio_object.custom_cover_image_url | url %]"><img alt="Cover image" src="[% ISSUE.biblio_object.custom_cover_image_url | url %]" /></a>
[% END %]
[% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %]
<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" />
[% END %]
</td>[% END # / IF JacketImages %]
<td class="title">
<a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ISSUE.biblionumber | html %]">[% INCLUDE 'biblio-title.inc' biblio=ISSUE %]</a>
[% IF ( ISSUE.enumchron ) %] [% ISSUE.enumchron | html %][% END %]
[% IF ( ISSUE.onsite_checkout ) %] <em class="onsite_checkout">(On-site checkout)</em>[% END %]
[% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
[% INCLUDE 'user-star-ratings.inc' item=ISSUE %]
[% END %]
</td>
<td class="author">[% ISSUE.author | html %]</td>
[% IF ( ISSUE.overdue ) %]
<td class="date_due overdue">
<span title="[% ISSUE.date_due | html %]">
<span class="tdlabel">Date due:</span>
[% ISSUE.date_due | $KohaDates as_due_date => 1 %]
</span>
</td>
[% ELSE %]
<td class="date_due">
<span title="[% ISSUE.date_due | html %]">
<span class="tdlabel">Date due:</span>
[% ISSUE.date_due | $KohaDates as_due_date => 1 %]
</span>
</td>
[% END %]
[% UNLESS ( item_level_itypes ) %]
<td class="itype">
<span class="tdlabel">Item type:</span>
[% IF ( ISSUE.imageurl && !Koha.Preference('OpacNoItemTypeImages') ) %]
<img src="[% ISSUE.imageurl | html %]" title="[% ISSUE.description | html %]" alt="[% ISSUE.description | html %]" />
[% END %] [% ISSUE.description | html %]
</td>
[% END %]
[% IF ( show_barcode ) %]
<td class="barcode">
<span class="tdlabel">Barcode:</span>
[% ISSUE.barcode | html %]
</td>
[% END %]
<td class="call_no">
<span class="tdlabel">Call no.:</span>
[% ISSUE.itemcallnumber | html %]
</td>
[% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
[% IF ( ISSUE.status && canrenew ) %]
<td class="renew" data-order="[% ISSUE.renewsleft | html %]">
[% ELSE %]
<td class="renew" data-order="0">
[% END %]
[% IF ISSUE.renewed %]<span class="blabel label-success">Renewed!</span><br />[% END %]
[% IF ( ISSUE.status ) %]
[% IF ( canrenew ) %]
<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>
[% END %]
[% IF ISSUE.renewalfee > 0 %]
<span class="renewalfee label label-warning">Fee for item type '[% ItemTypes.GetDescription( ISSUE.renewalitemtype) | html %]': [% ISSUE.renewalfee | $Price %]</span>
[% END %]
[% IF ISSUE.itemtype_object.rentalcharge_daily > 0 %]
<span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_daily | $Price %] per day</span>
[% END %]
[% IF ISSUE.itemtype_object.rentalcharge_hourly > 0 %]
<span class="renewalfee label label-warning">[% ISSUE.itemtype_object.rentalcharge_hourly | $Price %] per hour</span>
[% END %]
<span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
[% ELSIF ( ISSUE.on_reserve ) %]
Not renewable <span class="renewals">(on hold)</span>
[% ELSIF ( ISSUE.too_many ) %]
Not renewable
[% ELSIF ( ISSUE.norenew_overdue ) %]
Not allowed <span class="renewals">(overdue)</span>
[% ELSIF ( ISSUE.auto_too_late ) %]
No longer renewable
[% ELSIF ISSUE.auto_too_much_oweing %]
Automatic renewal failed, you have unpaid fines.
<span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
[% ELSIF ISSUE.auto_account_expired %]
Automatic renewal failed, your account is expired.
<span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
[% ELSIF ( ISSUE.too_soon ) %]
No renewal before [% ISSUE.soonestrenewdate | html %]
<span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
[% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
Automatic renewal
<span class="renewals">([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining)</span>
[% ELSIF ( ISSUE.item_denied_renewal ) %]
Renewal not allowed
[% END %]
</td>
[% END %]
[% IF ( OPACFinesTab ) %]
<td class="fines">
<span class="tdlabel">Fines:</span>
[% IF ( ISSUE.charges ) %]
Yes (Item overdue or lost)
[% ELSIF ( ISSUE.rentalfines ) %]
Yes (Rental fees)
[% ELSE %]
No
[% END %]
</td>
[% END %]
[% IF ( OPACMySummaryHTML ) %]
<td class="links">[% ISSUE.MySummaryHTML | $raw %]</td>
[% END %]
[% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
<td class="note">
<input type="text" name="note" data-issue_id="[% ISSUE.issue_id | html %]" data-origvalue="[% ISSUE.note | html %]" value="[% ISSUE.note | html %]" readonly>
<button type="button" class="btn btn-primary btn-sm js_submitnote" id="save_[% ISSUE.issue_id | html %]" style="display:none;">Submit note</button>
<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>
</td>
[% END %]
</tr>
[% END # /FOREACH ISSUES %]
</tbody>
</table>
[% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
<input type="submit" class="btn btn-primary" value="Renew selected" />
[% END %]
</form>
[% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
<form id="renewall" action="/cgi-bin/koha/opac-renew.pl" method="post">
<input type="hidden" name="from" value="opac_user" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
[% FOREACH ISSUE IN ISSUES %]
[% IF ISSUE.status %]
<input type="hidden" name="item" value="[% ISSUE.itemnumber | html %]" />
[% END %]
[% END %]
<input type="submit" class="btn btn-primary" value="Renew all" />
</form>
[% END %]
<p><a href="opac-ics.pl">Download as iCal/.ics file</a></p>
[% ELSE %]
<table class="table table-bordered table-striped">
<tr><td>You have nothing checked out</td></tr>
</table>
[% END # IF issues_count %]
</div> <!-- / .opac-user-checkouts -->
[% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
<div id="opac-user-clubs">
Loading...
</div>
[% END %]
[% IF ( OPACFinesTab ) %]
<!-- FINES BOX -->
[% IF ( amountoutstanding > 0 ) %]
<div id="opac-user-fines"> <h3>Charges</h3>
<table class="table table-bordered table-striped">
<thead><tr><th colspan="2">Amount</th></tr></thead>
<tbody>
<tr>
<td>You currently owe fines and charges amounting to:</td>
<td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding | $Price %]</a></td>
</tr>
</tbody>
</table>
</div>
[% END %]
[% IF ( amountoutstanding < 0 ) %]
<div id="opac-user-fines"> <h3>Credits</h3>
<table class="table table-bordered table-striped">
<thead><tr><th colspan="2">Amount</th></tr></thead>
<tbody>
<tr>
<td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding * -1 | $Price %]</a></td>
</tr>
</tbody>
</table>
</div>
[% END %]
[% IF relatives_with_fines %]
<div id="opac-user-relative-fines"> <h3>Fines and charges</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th colspan="2">Amount</th>
</tr>
</thead>
<tbody>
[% FOREACH r IN relatives_with_fines %]
<tr>
<td>[% r.firstname | html %] [% r.surname | html %] currently owes fines and charges amounting to:</td>
<td><a href="/cgi-bin/koha/opac-account.pl#g[% r.id | uri %]">[% r.account.balance | $Price %]</a></td>
</tr>
[% END %]
</tbody>
</table>
</div>
[% END %]
[% END # / OPACFinesTab %]
[% IF relatives %]
<div id="opac-user-relative-issues">
<table id="opac-user-relative-issues-table" class="table table-bordered table-striped">
<thead>
<tr>
<th class="anti-the">Title</th>
<th>Due</th>
<th>Barcode</th>
<th>Call no.</th>
<th class="psort">Relative</th>
</tr>
</thead>
<tbody>
[% FOREACH r IN relatives %]
[% FOREACH c IN r.checkouts %]
<tr>
<td>
<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% c.item.biblio.biblionumber | uri %]">
[% c.item.biblio.title | html %][% IF ( c.item.enumchron ) %] [% c.item.enumchron | html %][% END %]
</a>
</td>
<td>
[% c.date_due | $KohaDates %]
</td>
<td>
[% c.item.barcode | html %]
</td>
<td>
[% c.item.itemcallnumber | html %]
</td>
<td>
[% r.firstname | html %] [% r.surname | html %]
</td>
</tr>
[% END %]
[% END %]
</tbody>
</table>
</div>
[% END %]
[% IF ( overdues_count ) %]
<div id="opac-user-overdues">
<table id="overduest" class="table table-bordered table-striped">
<caption>Overdues <span class="count">([% overdues_count | html %] total)</span></caption>
<!-- OVERDUES TABLE ROWS -->
<thead>
<tr>
[% IF ( JacketImages || AdlibrisEnabled ) %]<th class="nosort">&nbsp;</th>[% END %]
<th class="anti-the">Title</th>
[% UNLESS ( item_level_itypes ) %]<th>Item type</th> [% END %]
[% IF ( show_barcode ) %]<th>Barcode</th>[% END %]
<th>Call no.</th>
<th class="title-string psort">Due</th>
[% IF ( OpacRenewalAllowed ) %]
<th class="nosort">Renew</th>
[% END %]
[% IF ( OPACFinesTab ) %]
<th>Fines</th>
[% END %]
</tr>
</thead>
<tbody>
[% FOREACH OVERDUE IN OVERDUES %]
<tr>
[% IF ( JacketImages || AdlibrisEnabled ) %]
<td class="jacketcell">
[% IF ( AdlibrisEnabled && OVERDUE.normalized_isbn ) %]
<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>
[% END %]
[% IF ( OPACAmazonCoverImages ) %]
[% IF ( OVERDUE.normalized_isbn ) %]
<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>
[% ELSE %]
<a href="#"><span class="no-image">No cover image available</span></a>
[% END %]
[% END %]
[% IF ( GoogleJackets ) %]
[% IF ( OVERDUE.normalized_isbn ) %]
<div style="display:block;" title="Click to view in Google Books" class="[% OVERDUE.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
[% ELSE %]
<a href="http://books.google.com/books?q=[% OVERDUE.title |url %]"><span class="no-image">No cover image available</span></a>
[% END %]
[% END %]
[% IF ( BakerTaylorEnabled ) %]
[% bt_id = ( OVERDUE.normalized_upc || OVERDUE.normalized_isbn ) %]
[% IF ( bt_id ) %]
<a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
[% ELSE %]
<span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
[% END %]
[% END %]
[% IF ( SyndeticsCoverImages ) %]
<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" />
[% END %]
</td>
[% END # /IF jacketcell %]
<td>
<a class="title" href="/cgi-bin/koha/opac-detail.pl?bib=[% OVERDUE.biblionumber | html %]">[% INCLUDE 'biblio-title.inc' biblio=OVERDUE %]</a>
<span class="item-details">[% OVERDUE.author | html %]</span>
</td>
[% UNLESS ( item_level_itypes ) %]
<td>
[% IF ( OVERDUE.imageurl && !Koha.Preference('OpacNoItemTypeImages') ) %]
<img src="[% OVERDUE.imageurl | html %]" title="[% OVERDUE.description | html %]" alt="[% OVERDUE.description | html %]" />
[% END %] [% OVERDUE.description | html %]
</td>
[% END %]
[% IF ( show_barcode ) %]
<td>
<span class="tdlabel">Barcode:</span>
[% OVERDUE.barcode | html %]
</td>
[% END %]
<td>
<span class="tdlabel">Call no.:</span>
[% OVERDUE.itemcallnumber | html %]
</td>
<td>
<span title="[% OVERDUE.date_due | html %]">
<span class="tdlabel">Date due:</span>
[% OVERDUE.date_due | $KohaDates as_due_date => 1 %]
</span>
</td>
[% IF ( OpacRenewalAllowed ) %]
<td>
[% IF ( OVERDUE.debarred ) %]
Account frozen
[% ELSIF ( OVERDUE.status ) %]
[% IF ( canrenew ) %]
<a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber | uri %]&amp;bornum=[% OVERDUE.borrowernumber | uri %]">Renew</a>
[% END %]
<span class="renewals">([% OVERDUE.renewsleft | html %] of [% OVERDUE.renewsallowed | html %] renewals remaining)</span>
[% ELSIF ( OVERDUE.norenew_overdue ) %]
Not allowed<span class="renewals">(overdue)</span>
[% ELSIF ( OVERDUE.onreserve ) %]
On hold
[% ELSE %]
No renewals left
[% END %]
</td>
[% END %]
[% IF ( OPACFinesTab ) %]
<td>
<span class="tdlabel">Fines:</span>
[% IF ( OVERDUE.charges ) %]
Yes
[% ELSE %]
No
[% END %]
</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>
</div> <!-- / #opac-user-overdues -->
[% END # /overdues_count %]
[% PROCESS 'holds-table.inc' HOLDS = RESERVES, SuspendHoldsOpac = SuspendHoldsOpac, showpriority = showpriority, AutoResumeSuspendedHolds = AutoResumeSuspendedHolds %]
[% IF Koha.Preference('ArticleRequests') %]
<div id="opac-user-article-requests">
[% IF logged_in_user.article_requests_current.count %]
<table id="article-requests-table" class="table table-bordered table-striped">
<caption>Article requests <span class="count">([% logged_in_user.article_requests_current.count | html %] total)</span></caption>
<thead>
<tr>
<th class="anti-the article-request-record-title">Record title</th>
<th class="psort article-request-created-on">Placed on</th>
<th class="anti-the article-request-title">Title</th>
<th class="article-request-author">Author</th>
<th class="article-request-volume">Volume</th>
<th class="article-request-issue">Issue</th>
<th class="article-request-date">Date</th>
<th class="article-request-pages">Pages</th>
<th class="article-request-chapters">Chapters</th>
<th class="article-request-patron-notes">Notes</th>
<th class="article-request-status">Status</th>
<th class="article-request-branchcode">Pickup library</th>
<th class="nosort article-request-cancel">&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOREACH ar IN logged_in_user.article_requests_current %]
<td class="article-request-record-title">
<a class="article-request-title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ar.biblionumber | html %]">
[% INCLUDE 'biblio-title.inc' biblio=ar.biblio %]
[% ar.item.enumchron | html %]
</a>
[% ar.biblio.author | html %]
[% IF ar.itemnumber %] <em>(only [% ar.item.barcode | html %])</em>[% END %]
</td>
<td class="article-request-created_on">
[% ar.created_on | $KohaDates %]
</td>
<td class="article-request-title">
[% ar.title | html %]
</td>
<td class="article-request-author">
[% ar.author | html %]
</td>
<td class="article-request-volume">
[% ar.volume | html %]
</td>
<td class="article-request-issue">
[% ar.issue | html %]
</td>
<td class="article-request-date">
[% ar.date | html %]
</td>
<td class="article-request-pages">
[% ar.pages | html %]
</td>
<td class="article-request-chapters">
[% ar.chapters | html %]
</td>
<td class="article-request-patron-notes">
[% ar.patron_notes | html %]
</td>
<td class="article-request-status">
[% IF ar.status == 'PENDING' %]
Pending
[% ELSIF ar.status == 'PROCESSING' %]
Processing
[% ELSIF ar.status == 'COMPLETED' %]
Completed
[% ELSIF ar.status == 'CANCELED' %]
Canceled
[% END %]
</td>
<td class="article-request-branchcode">
[% ar.branch.branchname | html %]
</td>
<td class="article-request-cancel">
<span class="tdlabel">Cancel:</span>
<form action="/cgi-bin/koha/opac-article-request-cancel.pl" id="delete_article_request_[% ar.id | html %]">
<input type="hidden" name="id" value="[% ar.id | html %]" />
<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>
</form>
</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<table class="table table-bordered table-striped">
<tr><td>You have no article requests currently.</td></tr>
</table>
[% END # IF article_requests_current.count %]
</div> <!-- / #opac-user-article-requests -->
[% END %]
</div> <!-- /#opac-user-views -->
</div> <!-- /#userdetails -->
</div> <!-- /.col-10 -->
</div> <!-- /.row -->
</div> <!-- /.container-fluid -->
</div> <!-- /#main -->
[% IF ( OverDriveCirculation ) %]
[% INCLUDE 'overdrive-checkout.inc' %]
[% IF ( Koha.Preference('OverDrivePasswordRequired') ) %]
[% INCLUDE 'overdrive-login.inc' %]
[% END %]
[% END %]
[% IF ( RecordedBooksCirculation ) %]
[% INCLUDE 'recordedbooks-checkout.inc' %]
[% END %]
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'datatables.inc' %]
<script>
$(document).ready(function(){
$('#opac-user-views').tabs();
$(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
$(".suspend-until").prop("readonly",1);
$(".btn-delete-hold").on("click", function(e){
e.preventDefault();
var hold_title = $(this).data("title");
var reserve_id = $(this).data("reserve_id");
confirmModal( hold_title, _("Are you sure you want to cancel this hold?"), _("Yes, cancel hold"), _("No, do not cancel hold"), function( result ){
if( result ){
$("#delete_hold_" + reserve_id ).submit();
}
}
);
});
$(".btn-delete-article-request").on("click", function(e){
e.preventDefault();
var article_request = $(this).data("title");
var article_request_id = $(this).data("article-request_id");
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 ){
if( result ){
$("#delete_article_request_" + article_request_id ).submit();
}
}
);
});
$("#suspend_all_submit").on("click", function(e){
e.preventDefault();
var title = _("Are you sure you want to suspend all holds?");
var body = _("All holds will be suspended.");
confirmModal( body, title, _("Yes, suspend all holds"), "", function( result ){
if( result ){
$("#suspend_all_holds").submit();
}
}
);
});
$("#resume_all_submit").on("click", function(e){
e.preventDefault();
var title = _("Are you sure you want to resume all suspended holds?");
var body = _("All holds will resume.");
confirmModal( body, title, _("Yes, resume all holds"), _("No, do not resume holds"), function( result ){
if( result ){
$("#resume_all_holds").submit();
}
}
);
});
var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table");
dTables.each(function(){
var thIndex = $(this).find("th.psort").index();
$(this).dataTable($.extend(true, {}, dataTablesDefaults, {
"sorting" : [[ thIndex, 'asc' ]],
"columnDefs": [
{ "targets": [ "nosort" ],"sortable": false,"searchable": false },
{ "type": "anti-the", "targets" : [ "anti-the" ] },
{ "type": "title-string", "targets" : [ "title-string" ] }
]
}));
});
[% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
[% IF ( OpacRenewalAllowed && canrenew && !userdebarred ) %]
$("#renewselected").submit(function(){
valid = false;
$("input[type=checkbox]").each(function(){
if($(this).is(':checked')){
valid = true;
}
});
if(!valid){
alert(_("Nothing has been selected. Check the box for each item you want to renew"));
}
return valid;
});
$("body").on("click","#renewselected_link",function(e){
e.preventDefault();
$("#renewselected").submit();
});
$("body").on("click","#renewall_link",function(e){
e.preventDefault();
$("#renewall").submit();
});
[% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %]
$("#checkoutst caption").append("<div id=\"renewcontrols\"><a id=\"renewselected_link\" class=\"btn btn-link\" href=\"#\"><i class=\"fa fa-check\" aria-hidden=\"true\"></i> "+_("Renew selected")+"</a> <a id=\"renewall_link\" class=\"btn btn-link\" href=\"#\"><span class=\"fa-stack\"><i class=\"fa fa-check fa-stack-1x\" aria-hidden=\"true\"></i><i class=\"fa fa-check fa-stack-1x\" aria-hidden=\"true\"></i></span> "+_("Renew all")+"</a></div>");
[% END %]
[% END %]
[% IF ( Koha.Preference('AllowCheckoutNotes') ) %]
/* If JS enabled, show button, otherwise show link to redirect to a page where note can be submitted */
$(".nonjs_submitnote").hide();
$("input[name='note']").prop('readonly', false);
$("input[name='note']").keypress(function(e){
/* prevent submitting of renewselected form */
if(e.which == 13)
e.preventDefault();
});
$("input[name='note']").keyup(function(e){
var $btn_save = $('#save_'+$(this).data('issue_id'));
var origvalue = $(this).data('origvalue');
var value = $(this).val();
if(origvalue != value) {
if(origvalue != "")
$btn_save.text(_("Submit changes"));
else
$btn_save.text(_("Submit note"));
$btn_save.show();
} else {
$btn_save.hide();
}
});
$(".js_submitnote").click(function(e){
var $self = $(this);
var title = $(this).parent().parent().find('a.title')[0].outerHTML;
var $noteinput = $(this).siblings('input[name="note"]').first();
var ajaxData = {
'action': 'issuenote',
'issue_id': $noteinput.data('issue_id'),
'note': $noteinput.val(),
};
$.ajax({
url: '/cgi-bin/koha/svc/checkout_notes/',
type: 'POST',
dataType: 'json',
data: ajaxData,
})
.done(function(data) {
var message = "";
if(data.status == 'saved') {
$("#notesaved").removeClass("alert-error");
$("#notesaved").addClass("alert-info");
$noteinput.data('origvalue', data.note);
$noteinput.val(data.note);
message = "<p>" + _("Your note about %s has been saved and sent to the library.").format(title) + "</p>";
message += "<p style=\"font-style:italic;\">" + data.note + "</p>";
$self.hide();
} else if(data.status == 'removed') {
$("#notesaved").removeClass("alert-error");
$("#notesaved").addClass("alert-info");
$noteinput.data('origvalue', "");
$noteinput.val("");
message = "<p>" + _("Your note about %s was removed.").format(title) + "</p>";
$self.hide();
} else {
$("#notesaved").removeClass("alert-info");
$("#notesaved").addClass("alert-error");
message = "<p>" + _("Your note about %s could not be saved.").format(title) + "</p>";
message += "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
}
$("#notesaved").html(message);
})
.fail(function(data) {
$("#notesaved").removeClass("alert-info");
$("#notesaved").addClass("alert-error");
var message = "<p style=\"font-weight:bold;\">" + _("Something went wrong. The note has not been saved") + "</p>";
$("#notesaved").html(message);
})
.always(function() {
$("#notesaved").show();
});
});
[% END %]
$(".suspend-until").datepicker({
beforeShow: function(input, inst) {
// https://stackoverflow.com/questions/662220/how-to-change-the-pop-up-position-of-the-jquery-datepicker-control#answer-10598178
var calendar = inst.dpDiv;
setTimeout(function() {
calendar.position({
my: 'left top',
at: 'left bottom',
collision: 'none',
of: input
});
}, 1);
},
minDate: 1
});
if ( $('#opac-user-clubs').length ) {
$('#opac-user-clubs-tab-link').on('click', function() {
$('#opac-user-clubs').text(_("Loading..."));
$('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber | html %]');
});
}
});
var borrowernumber = "[% borrowernumber | html %]";
var MSG_YOUR_RATING = _("Your rating: %s, ");
var MSG_AVERAGE_RATING = _("Average rating: %s (%s votes)");
</script>
[% IF ( Koha.Preference('OpacStarRatings') == 'all' ) %]
[% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
[% Asset.js("js/ratings.js") | $raw %]
[% END %]
[% IF Koha.Preference('OverDriveCirculation') %]
[% Asset.js("js/overdrive.js") | $raw %]
<script>
var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired') %]1[% ELSE %]0[% END %];
$(document).ready(function() {
[% IF ( overdrive_error ) %]
KOHA.OverDriveCirculation.display_error("#opac-user-overdrive", "[% overdrive_error.dquote | html %]");
[% END %]
[% IF ( overdrive_tab ) %]
$("#opac-user-views").tabs("select", "#opac-user-overdrive");
[% END %]
$("#opac-user-overdrive").each( function() {
KOHA.OverDriveCirculation.display_account_details(this);
} );
});
</script>
[% END %]
[% IF RecordedBooksCirculation %]
[% Asset.js("js/recordedbooks.js") | $raw %]
<script>
$(document).ready(function() {
[% IF ( recordedbooks_error ) %]
KOHA.RecordedBooks.display_error("#opac-user-recordedbooks", "[% recordedbooks_error.dquote | html %]");
[% END %]
[% IF ( recordedbooks_tab ) %]
$("#opac-user-views").tabs("select", "#opac-user-recordedbooks");
[% END %]
$("#opac-user-recordedbooks").each( function() {
KOHA.RecordedBooks.display_account_details(this);
} );
});
</script>
[% END %]
[% END %]