Bugzilla – Attachment 112731 Details for
Bug 20936
Holds history for patrons in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20936: Add patron's hold history menu in OPAC
Bug-20936-Add-patrons-hold-history-menu-in-OPAC.patch (text/plain), 15.62 KB, created by
Nick Clemens (kidclamp)
on 2020-10-30 17:54:46 UTC
(
hide
)
Description:
Bug 20936: Add patron's hold history menu in OPAC
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-10-30 17:54:46 UTC
Size:
15.62 KB
patch
obsolete
>From 11690fd595bdacb2c104bdee38ff89eeeb451125 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Wed, 6 May 2020 19:38:19 -0300 >Subject: [PATCH] Bug 20936: Add patron's hold history menu in OPAC > >This patch adds patron's hold history in OPAC. > >To test: >1. apply this patch >2. Find a patron, place several holds and cancel or fulfill them >3. Go to patron's opac >CHECK => There is no 'your holds history' option in menu >4. In admin preferences enable OPACHoldsHistory >5. Go back to patron's opac >SUCCESS => There is a 'your holds history' menu option > => Holds history displays all holds >6. Change order, and list limit >SUCCESS => All controls work as expected >7. Sign off. > >Signed-off-by: Todd <tgoatley@gmail.com> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../opac-tmpl/bootstrap/en/includes/usermenu.inc | 25 ++- > .../bootstrap/en/modules/opac-holdshistory.tt | 184 +++++++++++++++++++++ > opac/opac-holdshistory.pl | 83 ++++++++++ > 3 files changed, 285 insertions(+), 7 deletions(-) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt > create mode 100755 opac/opac-holdshistory.pl > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >index 80e626df83..fd5096153c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >@@ -57,14 +57,16 @@ > <a href="/cgi-bin/koha/opac-search-history.pl">your search history</a></li> > [% END %] > >- [% IF ( opacreadinghistory ) %] >- [% IF ( readingrecview ) %] >- <li class="active"> >- [% ELSE %] >- <li> >+ [% IF opacreadinghistory || Koha.Preference('OPACHoldsHistory') == 1 %] >+ [% IF opacreadinghistory %] >+ [% IF ( readingrecview ) %] >+ <li class="active"> >+ [% ELSE %] >+ <li> >+ [% END %] >+ <a href="/cgi-bin/koha/opac-readingrecord.pl">your reading history</a></li> > [% END %] >- <a href="/cgi-bin/koha/opac-readingrecord.pl">your reading history</a></li> >- [% IF ( OPACPrivacy ) %] >+ [% IF ( OPACPrivacy || Koha.Preference('OPACHoldsPrivacy') == 1 ) %] > [% IF ( privacyview ) %] > <li class="active"> > [% ELSE %] >@@ -74,6 +76,15 @@ > [% END %] > [% END # / opacreadinghistory %] > >+ [% IF Koha.Preference('OPACHoldsHistory') == 1 %] >+ [% IF ( holdshistoryview ) %] >+ <li class="active"> >+ [% ELSE %] >+ <li> >+ [% END %] >+ <a href="/cgi-bin/koha/opac-holdshistory.pl">your holds history</a></li> >+ [% END %] >+ > [% IF Koha.Preference( 'suggestion' ) == 1 %] > [% IF ( suggestionsview ) %] > <li class="active"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt >new file mode 100644 >index 0000000000..ccfb294eb7 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt >@@ -0,0 +1,184 @@ >+[% USE raw %] >+[% USE Koha %] >+[% USE KohaDates %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Your holds history</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% BLOCK cssinclude %] >+ <style> >+ >+ .controls .paginate_button { >+ font-family: 'FontAwesome'; >+ text-decoration: none; >+ } >+ >+ .controls .paginate_button:not(.disabled) { >+ cursor: pointer; >+ } >+ >+ .controls .paginate_button.disabled { >+ color: grey; >+ } >+ >+ .controls .previous:before { >+ content: "\f104"; >+ padding-right: .5em; >+ } >+ >+ .controls .next:after { >+ content: "\f105"; >+ padding-left: .5em; >+ } >+ </style> >+[% END %] >+</head> >+[% INCLUDE 'bodytag.inc' bodyid='opac-holdshistory' %] >+[% INCLUDE 'masthead.inc' %] >+ >+<div class="main"> >+ <ul class="breadcrumb"> >+ <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> >+ <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">›</span></li> >+ <li><a href="#">Your holds history</a></li> >+ </ul> >+ >+ <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"> >+ <div id="userholdshistory"> >+ <h3>Holds history</h3> >+ >+ [% IF !holds %] >+ You have never placed a hold from this library. >+ [% ELSE %] >+ <div id="opac-user-holdsrec"> >+ <div id="tabs-container" style="overflow:auto"> >+ <div class="controls"> >+ <div class="resultscontrol resort"> >+ <form id="sortform" action="/cgi-bin/koha/opac-holdshistory.pl" method="get"> >+ [% IF ( unlimit ) %]<input type="hidden" name="unlimit" value="1" />[% END %] >+ <select name="sort" id="sort"> >+ [% IF ( sort == 'reservedate' ) %]<option value="reservedate" selected="selected">Order by date</option>[% ELSE %]<option value="reservedate">Order by date</option>[% END %] >+ [% IF ( sort == 'biblio.title' ) %]<option value="biblio.title" selected="selected">Order by title</option>[% ELSE %]<option value="biblio.title">Order by title</option>[% END %] >+ [% IF ( sort == 'biblio.author' ) %]<option value="biblio.author" selected="selected">Order by author</option>[% ELSE %]<option value="biblio.author">Order by author</option>[% END %] >+ </select> >+ <input type="submit" value="Go" id="sortsubmit" class="submit clearfix" /> >+ </form> >+ </div> >+ >+ [% UNLESS unlimit %] >+ <p> >+ Showing 50 items. <a href="/cgi-bin/koha/opac-holdshistory.pl?unlimit=1[% IF ( sort ) %]&sort=[% sort | url %][% END %]">Show all items</a> >+ </p> >+ [% ELSE %] >+ <p> >+ Showing all items. <a href="/cgi-bin/koha/opac-holdshistory.pl[% IF ( sort ) %]?sort=[% sort | url %][% END %]">Show 50 items</a> >+ </p> >+ [% END %] >+ </div> >+ <table id="table_holdshistory" class="table table-bordered table-striped"> >+ <thead> >+ <tr> >+ <th class="anti-the">Title</th> >+ <th>Author</th> >+ <th>Barcode</th> >+ <th>Library</th> >+ <th class="title-string">Hold date</th> >+ <th class="title-string">Expiration date</th> >+ <th class="title-string">Waiting date</th> >+ <th class="title-string">Cancellation date</th> >+ [% IF show_itemtype_column %] >+ <th>Requested item type</th> >+ [% END %] >+ <th>Status</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH hold IN holds %] >+ <tr> >+ <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% hold.biblio.biblionumber | uri %]">[% INCLUDE 'biblio-title.inc' biblio=hold.biblio %]</a></td> >+ <td>[% hold.biblio.author | html %]</td> >+ <td>[% hold.item.barcode | html %]</td> >+ <td>[% Branches.GetName( hold.branchcode ) | html %]</td> >+ <td><span title="[% hold.reservedate | html %]">[% hold.reservedate | $KohaDates %]</span></td> >+ <td> >+ [% IF hold.expirationdate %] >+ <span title="[% hold.expirationdate | html %]">[% hold.expirationdate | $KohaDates %]</span> >+ [% ELSE %] >+ <span title="0000-00-00"></span> >+ [% END %] >+ </td> >+ <td> >+ [% IF hold.waitingdate %] >+ <span title="[% hold.waitingdate | html %]">[% hold.waitingdate | $KohaDates %]</span> >+ [% ELSE %] >+ <span title="0000-00-00"></span> >+ [% END %] >+ </td> >+ <td> >+ [% IF hold.cancellationdate %] >+ <span title="[% hold.cancellationdate | html %]">[% hold.cancellationdate | $KohaDates %]</span> >+ [% ELSE %] >+ <span title="0000-00-00"></span> >+ [% END %] >+ </td> >+ [% IF show_itemtype_column %] >+ <td> >+ [% IF hold.itemtype %] >+ [% ItemTypes.GetDescription( hold.itemtype ) | html %] >+ [% ELSE %] >+ <span>Any item type</span> >+ [% END %] >+ </td> >+ [% END %] >+ <td> >+ [% IF hold.found == 'F' %] >+ Fulfilled >+ [% ELSIF hold.cancellationdate %] >+ Cancelled >+ [% ELSIF hold.found == 'W' %] >+ Waiting >+ [% ELSIF hold.found == 'T' %] >+ In transit >+ [% ELSE %] >+ Pending >+ [% END %] >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ </div> <!-- / .tabs-container --> >+ </div> <!-- / .opac-user-holdsrec --> >+ [% END # / IF old_holds_count %] >+ </div> <!-- / .userholdshistory --> >+ </div> <!-- / .span10 --> >+ </div> <!-- / .row-fluid --> >+ </div> <!-- / .container-fluid --> >+</div> <!-- / .main --> >+ >+[% INCLUDE 'opac-bottom.inc' %] >+[% BLOCK jsinclude %] >+[% INCLUDE 'datatables.inc' %] >+<script> >+ $(document).ready(function() { >+ $('#sort').change(function() { >+ $('#sortform').submit(); >+ }); >+ var table = $("table_holdshistory").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "sPaginationType": "four_button", >+ "aaSorting": [[4, 'desc']], >+ "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', >+ "aoColumnDefs": [ >+ { "sType": "anti-the", "aTargets" : [ "anti-the" ] }, >+ { "sType": "title-string", "aTargets" : [ "title-string" ] } >+ ] >+ })); >+ }); >+</script> >+[% END %] >diff --git a/opac/opac-holdshistory.pl b/opac/opac-holdshistory.pl >new file mode 100755 >index 0000000000..e55ae1ad04 >--- /dev/null >+++ b/opac/opac-holdshistory.pl >@@ -0,0 +1,83 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+ >+use Modern::Perl; >+ >+use CGI qw ( -utf8 ); >+ >+use C4::Auth; >+use C4::Output; >+ >+use Koha::Patrons; >+ >+my $query = CGI->new; >+my @all_holds; >+ >+# if opacreadinghistory is disabled, leave immediately >+unless ( C4::Context->preference('OPACHoldsHistory') ) { >+ print $query->redirect("/cgi-bin/koha/errors/404.pl"); >+ exit; >+} >+ >+my ( $template, $patron_id, $cookie ) = get_template_and_user( >+ { >+ template_name => "opac-holdshistory.tt", >+ query => $query, >+ type => "opac" >+ } >+); >+ >+my $patron = Koha::Patrons->find( $patron_id ); >+ >+my $holds = $patron->holds; >+my $old_holds = $patron->old_holds; >+ >+while (my $hold = $holds->next) { >+ push @all_holds, $hold; >+} >+ >+while (my $hold = $old_holds->next) { >+ push @all_holds, $hold; >+} >+ >+my $sort = $query->param('sort'); >+ >+$sort = 'reservedate' unless $sort; >+ >+if($sort eq 'reservedate') { >+ @all_holds = sort {$b->$sort cmp $a->$sort} @all_holds; >+} else { >+ my ($obj, $col) = split /\./, $sort; >+ @all_holds = sort {$a->$obj->$col cmp $b->$obj->$col} @all_holds; >+} >+ >+my $unlimit = $query->param('unlimit'); >+ >+unless($unlimit) { >+ @all_holds = splice(@all_holds, 0, 50); >+} >+ >+$template->param( >+ holdshistoryview => 1, >+ patron => $patron, >+ holds => \@all_holds, >+ unlimit => $unlimit, >+ sort => $sort >+); >+ >+output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20936
:
98629
|
98630
|
100115
|
100116
|
100117
|
100205
|
100206
|
100207
|
100471
|
100472
|
100473
|
100474
|
101724
|
101725
|
101726
|
101727
|
101772
|
101915
|
102166
|
103948
|
103949
|
103950
|
103951
|
104040
|
104041
|
104466
|
104467
|
105131
|
112667
|
112668
|
112730
|
112731
|
112732
|
112733
|
113446
|
113447
|
113448
|
113449