Revert "Bug 12461 - Add patron clubs feature"
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-user.tt
index 3c4754a..c862a14 100644 (file)
@@ -1,18 +1,21 @@
 [% USE Koha %]
 [% USE KohaDates %]
+[% USE Branches %]
+[% USE ItemTypes %]
+[% USE Price %]
 
 [% INCLUDE 'doc-head-open.inc' %]
-[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your library home
+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your library home</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% BLOCK cssinclude %][% END %]
 </head>
-<body id="opac-user" class="scrollto">
+[% INCLUDE 'bodytag.inc' bodyid='opac-user' bodyclass='scrollto' %]
 [% INCLUDE 'masthead.inc' %]
 
 <div class="main">
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
-        <li>[% FOREACH BORROWER_INF IN BORROWER_INFO %]<a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' category_type = BORROWER_INF.category_type firstname = BORROWER_INF.firstname surname = BORROWER_INF.surname othernames = BORROWER_INF.othernames cardnumber = BORROWER_INF.cardnumber %]</a>[% END %] <span class="divider">&rsaquo;</span></li>
+        <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' category_type = BORROWER_INFO.category_type firstname = BORROWER_INFO.firstname surname = BORROWER_INFO.surname othernames = BORROWER_INFO.othernames cardnumber = BORROWER_INFO.cardnumber %]</a> <span class="divider">&rsaquo;</span></li>
         <li><a href="#">Your summary</a></li>
     </ul>
 
             </div>
             <div class="span10">
                 <div id="userdetails" class="maincontent">
-                    [% IF ( bor_messages ) %]
-                        <div class="alert alert-info">
-                            <h3>Messages for you</h3>
-                                <ul>
-                                    [% FOREACH bor_messages_loo IN bor_messages_loop %]
-                                        <li>
-                                        <strong>[% bor_messages_loo.message %]</strong><br>
-                                        &nbsp;&nbsp;&nbsp;<i>Written on [% bor_messages_loo.message_date | $KohaDates %] by [% bor_messages_loo.branchname %]</i>
-                                        </li>
-                                    [% END %]
 
-                                    [% IF ( opacnote ) %]<li>[% opacnote %]</li>[% END %]
-                                </ul>
+                    [% IF adminWarning %]
+                        <div id="adminwarning" class="dialog alert">
+                            <p>
+<strong><i class="fa fa-exclamation-triangle"> </i> Warning:</strong>
+Using this account is not recommended because some parts of Koha will not function as expected. Instead, please log in with a different account.
+<a class="btn btn-small" href="/cgi-bin/koha/opac-main.pl?logout.x=1">
+<i class="fa fa-sign-out"> </i> Log out</a>
+                            </p>
                         </div>
-                    [% END # / IF bor_messages %]
-                    [% FOREACH BORROWER_INF IN BORROWER_INFO %]
-                    <h2>Hello, [% INCLUDE 'patron-title.inc' category_type = BORROWER_INF.category_type firstname = BORROWER_INF.firstname surname = BORROWER_INF.surname othernames = BORROWER_INF.othernames cardnumber = BORROWER_INF.cardnumber %]
+                    [% END %]
+
+                    [% INCLUDE 'opac-note.inc' %]
+
+                    <h2>Hello, [% INCLUDE 'patron-title.inc' category_type = BORROWER_INFO.category_type firstname = BORROWER_INFO.firstname surname = BORROWER_INFO.surname othernames = BORROWER_INFO.othernames cardnumber = BORROWER_INFO.cardnumber %]
                     </h2>
 
-                    <p><a href="/cgi-bin/koha/opac-main.pl?logout.x=1">Click here if you're not [% BORROWER_INF.title %] [% INCLUDE 'patron-title.inc' category_type = BORROWER_INF.category_type firstname = BORROWER_INF.firstname surname = BORROWER_INF.surname othernames = BORROWER_INF.othernames cardnumber = BORROWER_INF.cardnumber %]</a></p>
+                    <p><a href="/cgi-bin/koha/opac-main.pl?logout.x=1">Click here if you're not [% BORROWER_INFO.title %] [% INCLUDE 'patron-title.inc' category_type = BORROWER_INFO.category_type firstname = BORROWER_INFO.firstname surname = BORROWER_INFO.surname othernames = BORROWER_INFO.othernames cardnumber = BORROWER_INFO.cardnumber %]</a></p>
 
                     [% 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 ( BORROWER_INF.warndeparture ) %]
+                    [% 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_INFO.warndeparture ) %]
                         <div class="alert" id="warndeparture">
-                            <strong>Please note:</strong><span> Your card will expire on <span id="warndeparture_date">[% BORROWER_INF.warndeparture | $KohaDates %]</span>. Please contact the library for more information.</span>
-                                [% IF ( BORROWER_INF.returnbeforeexpiry ) %]<span id="warndeparture_returnbeforeexpiry"> Also note that you must return all checked out items before your card expires.</span>[% END %]
+                            <strong>Please note:</strong><span> Your card will expire on <span id="warndeparture_date">[% BORROWER_INFO.warndeparture | $KohaDates %]</span>. Please contact the library for more information.</span>
+                                [% IF ( BORROWER_INFO.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_INF.warnexpired ) %]
+                    [% IF ( BORROWER_INFO.warnexpired ) %]
                         <div class="alert" id="warnexpired">
-                            <strong>Please note: </strong><span>Your account has expired as of [% BORROWER_INF.warnexpired | $KohaDates %]. Please contact the library if you wish to renew your account.</span>
+                            <strong>Please note: </strong><span>Your account has expired as of [% BORROWER_INFO.warnexpired | $KohaDates %]. Please contact the library if you wish to renew your account.</span>
                         </div>
                     [% END %]
 
@@ -71,6 +79,8 @@
                                         Your account has expired. Please contact the library for more information.
                                     [% ELSIF error == 'too_many' %]
                                         You have renewed this item the maximum number of times allowed.
+                                    [% ELSIF error == 'too_soon' %]
+                                        It is too soon after the checkout date for this item to be renewed.
                                     [% ELSIF error == 'on_reserve' %]
                                         This item is on hold for another patron.
                                     [% END %]
                         <div class="alert">
                             <ul>
                                 [% IF ( userdebarred ) %]
-                                    <li id="userdebarred"><strong>Please note:</strong> Your account has been frozen[% IF ( BORROWER_INF.userdebarreddate ) %] until <span id="userdebarred_date">[% BORROWER_INF.userdebarreddate | $KohaDates %]</span>[% END %][% IF ( BORROWER_INF.debarredcomment ) %] with the comment <span id="userdebarred_comment">"[% BORROWER_INF.debarredcomment %]"</span>[% END %]. Usually the reason for freezing an account is old overdues or damage fees. If <a href="/cgi-bin/koha/opac-user.pl">your account page</a> shows your account to be clear, please contact the library.</li>
+                                    [% 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_INFO.debarredcomment ) %] Comment: <span id="userdebarred_comment">"[% BORROWER_INFO.debarredcomment %]"</span>[% END %]
+                                        [% IF ( BORROWER_INFO.userdebarreddate ) %] End date: <span id="userdebarred_date">[% BORROWER_INFO.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_INF.gonenoaddress ) %]
-                                    <li id="gonenoaddress"><strong>Please note:</strong> According to our records, we don't have up-to-date [% UNLESS ( BORROWER_INF.OPACPatronDetails ) %]<a href="/cgi-bin/koha/opac-userupdate.pl">contact information</a>[% ELSE %]contact information[% END %] on file.  Please contact the library[% IF ( BORROWER_INF.OPACPatronDetails ) %] or use the <a href="/cgi-bin/koha/opac-userupdate.pl">online update form</a> to submit current information (<em>Please note:</em> there may be a delay in restoring your account if you submit online)[% END %].</li>
+                                [% IF ( BORROWER_INFO.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_INF.lost ) %]
-                                    <li id="lost"><strong>Please note: </strong> Your library card has been marked as lost or stolen. If this is an error, please contact the library.</li>
+                                [% IF ( BORROWER_INFO.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 ) && ( OpacRenewalAllowed ) %]
-                                    <li id="renewal_blocked_fines"><strong>Please note: </strong> Since you have <a href="/cgi-bin/koha/opac-account.pl">[% IF renewal_blocked_fines != "0.00" %] more than <span id="renewal_blocked_fines_amount">[% renewal_blocked_fines %]</span> in [% END %] fines</a>, you cannot renew your books online. Please pay your fines if you wish to renew your books.</li>
+                                [% 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>
                     <div id="opac-user-views" class="toptabs">
                         <ul>
                             <li><a href="#opac-user-checkouts">Checked out ([% issues_count %])</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 %])</a></li>[% END %]
                             [% IF ( OPACFinesTab ) %]
-                                [% IF ( BORROWER_INF.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% BORROWER_INF.amountoutstanding %])</a></li>[% END %]
-                                [% IF ( BORROWER_INF.amountoverzero ) %]<li><a href="#opac-user-fines">Fines ([% BORROWER_INF.amountoutstanding %])</a></li>[% END %]
-                                [% IF ( BORROWER_INF.amountlessthanzero ) %]<li><a href="#opac-user-fines">Credits ([% BORROWER_INF.amountoutstanding %])</a></li>[% END %]
+                                [% IF ( BORROWER_INFO.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %]
+                                [% IF ( BORROWER_INFO.amountoverzero ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %]
+                                [% IF ( BORROWER_INFO.amountlessthanzero ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding | $Price %])</a></li>[% END %]
+                            [% END %]
+                            [% IF ( RESERVES.count ) %]<li><a href="#opac-user-holds">Holds ([% RESERVES.count %])</a></li>[% END %]
+                            [% IF Koha.Preference('ArticleRequests') && borrower.article_requests_current %]<li><a href="#opac-user-article-requests">Article requests ([% borrower.article_requests_current.count %])</a></li>[% END %]
+                            [% IF ( OverDriveCirculation ) %]
+                            <li><a href="#opac-user-overdrive">OverDrive Account</a></li>
                             [% END %]
-                            [% IF ( waiting_count ) %][% IF ( BORROWER_INF.atdestination ) %]<li><a href="#opac-user-waiting">Waiting ([% waiting_count %])</a></li>[% END %][% END %]
-                            [% IF ( reserves_count ) %]<li><a href="#opac-user-holds">Holds ([% reserves_count %])</a></li>[% END %]
                         </ul>
 
+                        <div id="opac-user-overdrive">
+                        </div>
                         <div id="opac-user-checkouts">
                             [% IF ( issues_count ) %]
                                 <form id="renewselected" action="/cgi-bin/koha/opac-renew.pl" method="post">
                                                 [% IF ( show_barcode ) %]
                                                     <th>Barcode</th>
                                                 [% END %]
-                                                    <th>Call No.</th>
-                                                [% IF ( OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
+                                                    <th>Call no.</th>
+                                                [% IF ( OpacRenewalAllowed && !( borrower.is_expired && borrower.category.effective_BlockExpiredPatronOpacActions ) ) %]
                                                     <th class="nosort">Renew</th>
                                                 [% END %]
                                                 [% IF ( OPACFinesTab ) %]
                                                     [% END %]
 
                                                     [% IF ( BakerTaylorEnabled ) %]
-                                                        [% IF ( ISSUE.normalized_isbn ) %]
-                                                            <a href="https://[% BakerTaylorBookstoreURL |html %][% ISSUE.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% ISSUE.normalized_isbn %]" /></a>
+                                                        [% bt_id = ( ISSUE.normalized_upc || ISSUE.normalized_isbn ) %]
+                                                        [% IF ( bt_id ) %]
+                                                            <a href="https://[% BakerTaylorBookstoreURL |html %][% bt_id %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% bt_id %]" /></a>
                                                         [% ELSE %]
-                                                            <span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_isbn! -->
+                                                            <span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
                                                         [% END %]
                                                     [% END %]
 
 
                                                 <td class="title">
                                                     <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ISSUE.biblionumber %]">[% ISSUE.title |html %] [% FOREACH subtitl IN ISSUE.subtitle %] [% subtitl.subfield %][% END %]</a>
+                                                    [% IF ( ISSUE.enumchron ) %] [% ISSUE.enumchron %][% END %]
                                                     <span class="item-details">[% ISSUE.author %]</span>
                                                 </td>
                                                 [% IF ( ISSUE.overdue ) %]
                                                     <td class="date_due overdue">
                                                         <span title="[% ISSUE.date_due %]">
                                                             <span class="tdlabel">Date due:</span>
-                                                            [% ISSUE.date_due | $KohaDates as_due_date => 1 %]
+                                                            [% ISSUE.date_due_sql | $KohaDates as_due_date => 1 %]
                                                         </span>
                                                     </td>
                                                 [% ELSE %]
                                                     <td class="date_due">
                                                         <span title="[% ISSUE.date_due %]">
                                                             <span class="tdlabel">Date due:</span>
-                                                            [% ISSUE.date_due | $KohaDates as_due_date => 1 %]
+                                                            [% ISSUE.date_due_sql | $KohaDates as_due_date => 1 %]
                                                         </span>
                                                     </td>
                                                 [% END %]
                                                     </td>
                                                 [% END %]
                                                 <td class="call_no">
-                                                    <span class="tdlabel">Call number:</span>
+                                                    <span class="tdlabel">Call no.:</span>
                                                     [% ISSUE.itemcallnumber %]
                                                 </td>
-                                                [% IF ( OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
+                                                [% IF ( OpacRenewalAllowed && !( borrower.is_expired && borrower.category.effective_BlockExpiredPatronOpacActions ) ) %]
                                                     <td class="renew">
                                                     [% IF ISSUE.renewed %]<span class="blabel label-success">Renewed!</span><br />[% END %]
                                                     [% IF ( ISSUE.status ) %]
                                                             <input type="checkbox" name="item" value="[% ISSUE.itemnumber %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% ISSUE.itemnumber %]&amp;borrowernumber=[% ISSUE.borrowernumber %]">Renew</a>
                                                         [% END %]
                                                         <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] 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_renew || ISSUE.auto_too_soon ) %]
                                                         Automatic renewal
                                                         <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>
                                                     [% ELSIF ( ISSUE.too_soon ) %]
                                                         No renewal before [% ISSUE.soonestrenewdate %]
                                                         <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>
-                                                    [% ELSIF ( ISSUE.on_reserve ) %]
-                                                        <span class="renewals">(On hold)</span>
                                                     [% END %]
                                                     </td>
                                                 [% END %]
                                         [% END # /FOREACH ISSUES %]
                                     </tbody>
                                 </table>
-                                [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
+                                [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.category.effective_BlockExpiredPatronOpacActions ) ) %]
                                     <input type="submit" class="btn" value="Renew selected" />
                                 [% END %]
                                 </form>
 
-                                [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
+                                [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.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 %]" />
                                     <input type="submit" class="btn" 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>
 
                         [% IF ( OPACFinesTab ) %]
                             <!-- FINES BOX -->
-                            [% IF ( BORROWER_INF.amountoverfive ) %]
+                            [% IF BORROWER_INFO.amountoverfive %]
                                 <div id="opac-user-fines"> <h3>Fines and 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">[% BORROWER_INF.amountoutstanding %]</a></td>
+                                                <td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding | $Price %]</a></td>
                                             </tr>
                                         </tbody>
                                     </table>
                                 </div>
                             [% END %]
 
-                            [% IF ( BORROWER_INF.amountoverzero ) %]
+                            [% IF BORROWER_INFO.amountoverzero %]
                                <div id="opac-user-fines"> <h3>Fines and 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">[% BORROWER_INF.amountoutstanding %]</a></td>
+                                                <td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding %]</a></td>
                                             </tr>
                                         </tbody>
                                     </table>
                                 </div>
                             [% END %]
 
-                            [% IF ( BORROWER_INF.amountlessthanzero ) %]
+                            [% IF BORROWER_INFO.amountlessthanzero %]
                                 <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">[% BORROWER_INF.amountoutstanding %]</a></td>
+                                                <td>You have a credit of:</td><td><a href="/cgi-bin/koha/opac-account.pl">[% amountoutstanding %]</a></td>
                                             </tr>
                                         </tbody>
                                     </table>
                             [% END %]
                         [% END # / OPACFinesTab %]
 
-                    [% END # / FOREACH BORROWER_INFO %]
-
-                        [% IF ( waiting_count && atdestination ) %]
-                            <div id="opac-user-waiting">
-                                <table id="waitingt" class="table table-bordered table-striped">
-                                    <caption>Holds waiting</caption>
+                        [% 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>Hold date</th>
-                                            <th>Pick up library</th>
+                                            <th>Due</th>
+                                            <th>Barcode</th>
+                                            <th>Call no.</th>
+                                            <th class="psort">Relative</th>
                                         </tr>
                                     </thead>
+
                                     <tbody>
-                                        [% FOREACH WAITIN IN WAITING %]
-                                            <tr>
-                                                <td><img src="[% themelang %]/images/[% WAITIN.itemtype %].gif" alt="[% WAITIN.itemtype %]" title="[% WAITIN.itemtype %]" /></td>
-                                                <td>
-                                                    <a class="title" href="opac-detail.pl?biblionumber=[% WAITIN.biblionumber %]">
-                                                        [% WAITIN.waiting_title %] [% FOREACH subtitl IN WAITIN.subtitle %] [% subtitl.subfield %][% END %]
-                                                    </a>
-                                                    <span class="item-details">
-                                                        [% WAITIN.author %]
-                                                    </span></td>
-                                                <td>
-                                                    <span class="tdlabel">Hold date:</span>
-                                                    [% WAITIN.reservedate | $KohaDates %]</td>
-                                                <td>
-                                                    [% IF ( WAITIN.atdestination ) %]
-                                                        <strong>Waiting</strong> at [% WAITIN.branch %]
-                                                    [% ELSE %]
-                                                        In transit from [% WAITIN.holdingbranch %] to [% WAITIN.branch %]
-                                                    [% END %]
-                                                </td>
-                                            </tr>
+                                        [% FOREACH r IN relatives %]
+                                            [% FOREACH i IN r.issues %]
+                                                <tr>
+                                                    <td>
+                                                        <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% i.item.biblio.biblionumber %]">
+                                                            [% i.item.biblio.title %][% IF ( i.item.enumchron ) %] [% i.item.enumchron %][% END %]
+                                                        </a>
+                                                    </td>
+
+                                                    <td>
+                                                        [% i.date_due | $KohaDates %]
+                                                    </td>
+
+                                                    <td>
+                                                        [% i.item.barcode %]
+                                                    </td>
+
+                                                    <td>
+                                                        [% i.item.itemcallnumber %]
+                                                    </td>
+
+                                                    <td>
+                                                        [% r.firstname %] [% r.surname %]
+                                                    </td>
+                                                </tr>
+                                            [% END %]
                                         [% END %]
                                     </tbody>
                                 </table>
-                            </div> <!-- /#opac-user-waiting -->
-                        [% END # waiting_count && atdestination %]
-
+                            </div>
+                        [% END %]
 
                         [% IF ( overdues_count ) %]
                             <div id="opac-user-overdues">
                                                     [% END %]
 
                                                     [% IF ( BakerTaylorEnabled ) %]
-                                                        [% IF ( OVERDUE.normalized_isbn ) %]
-                                                            <a href="https://[% BakerTaylorBookstoreURL |html %][% OVERDUE.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% OVERDUE.normalized_isbn %]" /></a>
+                                                        [% bt_id = ( OVERDUE.normalized_upc || OVERDUE.normalized_isbn ) %]
+                                                        [% IF ( bt_id ) %]
+                                                            <a href="https://[% BakerTaylorBookstoreURL |html %][% bt_id %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% bt_id %]" /></a>
                                                         [% ELSE %]
-                                                            <!-- BakerTaylor needs normalized_isbn! --><span class="no-image">No cover image available</span>
+                                                            <span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_upc or normalized_isbn! -->
                                                         [% END %]
                                                     [% END %]
 
                                                     </td>
                                                 [% END %]
                                                 <td>
-                                                    <span class="tdlabel">Call number:</span>
+                                                    <span class="tdlabel">Call no.:</span>
                                                     [% OVERDUE.itemcallnumber %]
                                                 </td>
                                                 <td>
                                                     <span title="[% OVERDUE.date_due %]">
                                                         <span class="tdlabel">Date due:</span>
-                                                        [% OVERDUE.date_due | $KohaDates as_due_date => 1 %]
+                                                        [% OVERDUE.date_due_sql | $KohaDates as_due_date => 1 %]
                                                     </span>
                                                 </td>
                                                 [% IF ( OpacRenewalAllowed ) %]
                                                                 <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber %]&amp;bornum=[% OVERDUE.borrowernumber %]">Renew</a>
                                                             [% END %]
                                                                 <span class="renewals">([% OVERDUE.renewsleft %] of [% OVERDUE.renewsallowed %] renewals remaining)</span>
+                                                        [% ELSIF ( OVERDUE.norenew_overdue ) %]
+                                                            Not allowed<span class="renewals">(overdue)</span>
                                                         [% ELSIF ( OVERDUE.onreserve ) %]
                                                             On hold
                                                         [% ELSE %]
                         [% END # /overdues_count %]
 
 
-                        [% IF ( reserves_count ) %]
+                        [% IF ( RESERVES.count ) %]
                             <div id="opac-user-holds">
                                 <table id="holdst" class="table table-bordered table-striped">
-                                    <caption>Holds <span class="count">([% reserves_count %] total)</span></caption>
+                                    <caption>Holds <span class="count">([% RESERVES.count %] total)</span></caption>
                                     <!-- RESERVES TABLE ROWS -->
                                     <thead>
                                         <tr>
                                     </thead>
                                     <tbody>
                                     [% FOREACH RESERVE IN RESERVES %]
-                                        [% IF ( RESERVE.wait ) %]
-                                            [% IF ( RESERVE.atdestination ) %]
-                                                [% IF ( RESERVE.found ) %]
+                                        [% IF ( RESERVE.is_waiting ) %]
+                                            [% IF ( RESERVE.is_at_destination ) %]
+                                                [% IF ( RESERVE.is_found ) %]
                                                     <tr class="reserved">
                                                 [% ELSE %]
                                                     <tr>
                                             <tr>
                                         [% END %]
                                             <td class="title">
-                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">[% RESERVE.reserves_title %] [% FOREACH subtitl IN RESERVE.subtitle %] [% subtitl.subfield %][% END %]</a>
-                                                [% RESERVE.author %]
+                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">
+                                                    [% RESERVE.biblio.title %]
+                                                    [% FOREACH s IN RESERVE.biblio.subtitles %]
+                                                        [% s %]
+                                                    [% END %]
+                                                    [% RESERVE.item.enumchron %]
+                                                </a>
+                                                [% RESERVE.biblio.author %]
                                             </td>
                                             <td class="reservedate">
                                                 <span title="[% RESERVE.reservedate %]">
                                                 </span>
                                             </td>
                                             <td class="expirationdate">
-                                                [% IF ( RESERVE.expirationdate ) %]
-                                                    <span>
+                                                [% IF ! RESERVE.found %]
+                                                    [% IF ( RESERVE.expirationdate ) %]
+                                                        <span>
+                                                            <span class="tdlabel">Expiration:</span>
+                                                                [% RESERVE.expirationdate | $KohaDates %]
+                                                        </span>
+                                                    [% ELSE %]
                                                         <span class="tdlabel">Expiration:</span>
-                                                        [% RESERVE.expirationdate | $KohaDates %]
-                                                    </span>
+                                                        Never expires
+                                                    [% END %]
                                                 [% ELSE %]
-                                                    <span class="tdlabel">Expiration:</span>
-                                                    Never expires
+                                                    -
                                                 [% END %]
                                             </td>
                                             <td class="branch">
                                                 <span class="tdlabel">Pick up location:</span>
-                                                [% RESERVE.branch %]
+                                                [% RESERVE.branch.branchname %]
                                             </td>
                                             [% IF ( showpriority ) %]
                                                  <td class="priority">
                                             [% END %]
                                             <td class="status">
                                                 <span class="tdlabel">Status:</span>
-                                                [% IF ( RESERVE.wait ) %]
-                                                    [% IF ( RESERVE.atdestination ) %]
+                                                [% IF ( RESERVE.is_waiting ) %]
+                                                    [% IF ( RESERVE.is_at_destination ) %]
                                                         [% IF ( RESERVE.found ) %]
-                                                            Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %][% END %]
-                                                            <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
+                                                            Item waiting at <b> [% RESERVE.branch.branchname %]</b>
+                                                            [% IF ( RESERVE.waitingdate ) %]
+                                                                since [% RESERVE.waitingdate | $KohaDates %]
+                                                                [% IF RESERVE.waiting_expires_on %]
+                                                                    until [% RESERVE.waiting_expires_on | $KohaDates %]
+                                                                [% END %]
+                                                            [% END %]
+                                                            <input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" />
                                                         [% ELSE %]
-                                                            Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b>
+                                                            Item waiting to be pulled from <b> [% Branches.GetName( RESERVE.branchcode ) %]</b>
                                                         [% END %]
                                                     [% ELSE %]
-                                                        Item in transit to <b> [% RESERVE.wbrname %]</b> <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
+                                                        Item in transit to <b> [% Branches.GetName( RESERVE.branchcode ) %]</b> <input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" />
                                                     [% END %]
                                                 [% ELSE %]
-                                                    [% IF ( RESERVE.intransit ) %]
-                                                        Item in transit from <b> [% RESERVE.frombranch %]</b> since
-                                                        [% RESERVE.datesent | $KohaDates %]
+                                                    [% IF ( RESERVE.is_in_transit ) %]
+                                                        [% SET transfer = RESERVE.item.get_transfer %]
+                                                        Item in transit from <b> [% Branches.GetName( transfer.frombranch ) %]</b> since
+                                                        [% transfer.datesent | $KohaDates %]
                                                     [% ELSIF ( RESERVE.suspend ) %]
                                                         Suspended [% IF ( RESERVE.suspend_until ) %] until [% RESERVE.suspend_until %] [% END %]
                                                     [% ELSE %]
-                                                        Pending
+                                                        [% IF RESERVE.itemtype %]
+                                                            Pending for next available item of item type '[% ItemTypes.GetDescription( RESERVE.itemtype ) %]'
+                                                        [% ELSE %]
+                                                            Pending
+                                                        [% END %]
                                                     [% END %]
                                                 [% END %]
                                             </td>
                                             [% IF SuspendHoldsOpac %]
                                                 <td>
-                                                    [% IF ( RESERVE.cancelable ) %]
+                                                    [% IF ( RESERVE.is_cancelable ) %]
                                                         [% IF RESERVE.suspend %]
                                                             <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
                                                                 <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
                                                                         <div class="modal-header">
                                                                             <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
                                                                             [% IF RESERVE.suspend %]
-                                                                                <h3 id="suspendModal[% RESERVE.reserve_id %]Label">Resume your hold on <i>[% RESERVE.reserves_title %]</i></h3>
+                                                                                <h3 id="suspendModal[% RESERVE.reserve_id %]Label">Resume your hold on <i>[% RESERVE.biblio.title %]</i></h3>
                                                                             [% ELSE %]
-                                                                                <h3 id="suspendModal[% RESERVE.reserve_id %]Label">Suspend your hold on <i>[% RESERVE.reserves_title %]</i></h3>
+                                                                                <h3 id="suspendModal[% RESERVE.reserve_id %]Label">Suspend your hold on <i>[% RESERVE.biblio.title %]</i></h3>
                                                                             [% END %]
                                                                         </div>
                                                                         <div class="modal-body">
                                                                 </form>
                                                             [% END # / IF AutoResumeSuspendedHolds %]
                                                         [% END # / IF RESERVE.suspend %]
-                                                    [% END # / IF ( RESERVE.cancelable )%]
+                                                    [% END # / IF ( RESERVE.is_cancelable )%]
                                                 </td>
                                             [% END # / IF SuspendHoldsOpac %]
                                             <td class="modify">
-                                                [% IF ( RESERVE.cancelable ) %]
+                                                [% IF ( RESERVE.is_cancelable ) %]
                                                     <form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
                                                     <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" />
                                                     <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" />
                                 </div>
                             [% END %]
                         </div> <!-- / #opac-user-holds -->
-                        [% END # / #reserves_count %]
+                        [% END # / #RESERVES.count %]
+
+                        [% IF Koha.Preference('ArticleRequests') && borrower.article_requests_current.count %]
+                            <div id="opac-user-article-requests">
+                                <table id="article-requests-table" class="table table-bordered table-striped">
+                                    <caption>Article requests <span class="count">([% borrower.article_requests_current.count %] 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 borrower.article_requests_current %]
+                                            <td class="article-request-record-title">
+                                                <a class="article-request-title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ar.biblionumber %]">
+                                                    [% ar.biblio.title %]
+                                                    [% ar.item.enumchron %]
+                                                </a>
+                                                [% ar.biblio.author %]
+                                                [% IF ar.itemnumber %] <i>(only [% ar.item.barcode %])</i>[% END %]
+                                            </td>
+
+                                            <td class="article-request-created_on">
+                                                [% ar.created_on | $KohaDates %]
+                                            </td>
+
+                                            <td class="article-request-title">
+                                                [% ar.title %]
+                                            </td>
+
+                                            <td class="article-request-author">
+                                                [% ar.author %]
+                                            </td>
+
+                                            <td class="article-request-volume">
+                                                [% ar.volume %]
+                                            </td>
+
+                                            <td class="article-request-issue">
+                                                [% ar.issue %]
+                                            </td>
+
+                                            <td class="article-request-date">
+                                                [% ar.date %]
+                                            </td>
+
+                                            <td class="article-request-pages">
+                                                [% ar.pages %]
+                                            </td>
+
+                                            <td class="article-request-chapters">
+                                                [% ar.chapters %]
+                                            </td>
+
+                                            <td class="article-request-patron-notes">
+                                                [% ar.patron_notes %]
+                                            </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 %]
+                                            </td>
+
+                                            <td class="article-request-cancel">
+                                                <span class="tdlabel">Cancel:</span>
+                                                <a class="btn btn-mini btn-danger" href="opac-article-request-cancel.pl?id=[% ar.id %]" onclick="return confirmDelete(MSG_CONFIRM_DELETE_HOLD);"><i class="icon-remove icon-white"></i> Cancel</a>
+                                                <!-- TODO: replace MSG_CONFIRM_DELETE_HOLD with correct message -->
+                                            </td>
+                                        </tr>
+                                    [% END %]
+                                </tbody>
+                            </table>
+                        </div> <!-- / #opac-user-article-requests -->
+                    [% END %]
+
                     </div> <!-- /#opac-user-views -->
                 </div> <!-- /#userdetails -->
             </div> <!-- /.span10 -->
     </div> <!-- /.container-fluid -->
 </div> <!-- /#main -->
 
+[% IF ( OverDriveCirculation ) %]
+[% INCLUDE 'overdrive-checkout.inc' %]
+[% END %]
+
 [% INCLUDE 'opac-bottom.inc' %]
 
 
             $(".js-hide").hide();
             $(".modal-nojs").addClass("modal").addClass("hide").removeClass("modal-nojs");
             $(".suspend-until").prop("readonly",1);
-            var dTables = $("#checkoutst,#holdst,#overduest");
+
+            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, {
                     e.preventDefault();
                     $("#renewall").submit();
                 });
-                [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
+                [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.category.effective_BlockExpiredPatronOpacActions ) ) %]
                     $("#checkoutst caption").append("<div id=\"renewcontrols\"><a id=\"renewselected_link\" href=\"#\">"+_("Renew selected")+"</a> <a id=\"renewall_link\" href=\"#\">"+_("Renew all")+"</a></div>");
                 [% END %]
             [% END %]
         });
         //]]>
     </script>
+    <script type="text/javascript" src="[% interface %]//[% theme %]/js/overdrive.js"></script>
+    <script type="text/JavaScript">
+    $(document).ready(function() {
+    [% IF ( overdrive_error ) %]
+        KOHA.OverDriveCirculation.display_error("#opac-user-overdrive", "[% overdrive_error.dquote %]");
+    [% 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 %]