From dd0844103d5f751b25b61d22bb81862eb4824a22 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 15 Nov 2017 00:59:20 +0000 Subject: [PATCH] Bug 19532: recalls history this patch - adds recalls history (similar to holds history) to OPAC and intranet - edits the tables in opac-user.pl (OPAC), moremember.pl and circulation.pl (staff) so that it only shows active recalls (recalls that have been requested or are waiting) - some extra datatables fixes Signed-off-by: Nick Clemens --- circ/circulation.pl | 2 +- .../prog/en/includes/circ-menu.inc | 1 + .../prog/en/includes/recalls.inc | 8 +- .../prog/en/modules/members/recallshistory.tt | 51 ++++++ .../bootstrap/en/includes/usermenu.inc | 6 + .../bootstrap/en/modules/opac-recalls.tt | 145 ++++++++++++++++++ .../bootstrap/en/modules/opac-user.tt | 10 +- members/moremember.pl | 2 +- members/recallshistory.pl | 53 +++++++ opac/opac-recalls.pl | 45 ++++++ opac/opac-user.pl | 2 +- 11 files changed, 312 insertions(+), 13 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt create mode 100755 members/recallshistory.pl create mode 100755 opac/opac-recalls.pl diff --git a/circ/circulation.pl b/circ/circulation.pl index 908ee6c441..1b8be091fb 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -466,7 +466,7 @@ if ($patron) { my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } ); # FIXME must be Koha::Patron->holds my $waiting_holds = $holds->waiting; - my $recalls = Koha::Recalls->search({ borrowernumber => $borrowernumber }); + my $recalls = Koha::Recalls->search({ borrowernumber => $borrowernumber, status => { '=', ['R','W'] } }); $template->param( holds_count => $holds->count(), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index a16ca2bf9b..356b304d03 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -124,5 +124,6 @@ [% IF Koha.Preference('ILLModule') && CAN_user_ill %]
  • Interlibrary loans
  • [% END %] +
  • Recalls history
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc index 9ee1342f84..2608e75574 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc @@ -55,14 +55,16 @@ Ready for pickup [% ELSIF ( recall.has_expired ) %] Expired + [% ELSIF ( recall.is_cancelled ) %] + Cancelled + [% ELSIF ( recall.is_overdue ) %] + Overdue to be returned [% END %] - [% IF ( !recall.cancellationdate ) %] + [% IF ( !recall.cancellationdate && ( recall.is_requested || recall.is_overdue ) ) %] Cancel - [% ELSE %] - Cancelled [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt new file mode 100644 index 0000000000..7d21bbee16 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt @@ -0,0 +1,51 @@ +[% USE KohaDates %] +[% USE Koha %] +[% INCLUDE 'doc-head-open.inc' %] +Recalls history for [% patron.firstname %] [% patron.surname %] +[% INCLUDE 'doc-head-close.inc' %] + +[% INCLUDE 'datatables.inc' %] + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'patron-search.inc' %] + + + +
    +
    +
    +
    + + [% INCLUDE 'members-toolbar.inc' %] + +

    Recalls history

    + + [% INCLUDE 'recalls.inc' %] + +
    +
    + +
    + [% INCLUDE 'circ-menu.inc' %] +
    +
    +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc index 42f073b9fe..cb69b39591 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc @@ -131,6 +131,12 @@ your interlibrary loan requests [% END %] + [% IF ( recallsview ) %] +
  • + [% ELSE %] +
  • + [% END %] + your recalls history
  • [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt new file mode 100644 index 0000000000..cb6e382539 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt @@ -0,0 +1,145 @@ +[% USE Koha %] +[% USE KohaDates %] + +[% INCLUDE 'doc-head-open.inc' %] +[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your recalls history +[% INCLUDE 'doc-head-close.inc' %] +[% BLOCK cssinclude %][% END %] + +[% INCLUDE 'bodytag.inc' bodyid='opac-recalls' bodyclass='scrollto' %] +[% INCLUDE 'masthead.inc' %] + +
    + + +
    +
    +
    + +
    +
    +
    + +

    Recalls history

    + + [% IF RECALLS.count %] +
    + + + + + + + + + + + + + [% FOREACH RECALL IN RECALLS %] + + + + + + + + [% END %] + + +
    TitlePlaced onExpires onPickup locationStatusCancel
    + + [% RECALL.biblio.title %] + [% FOREACH s IN RECALL.biblio.subtitles %] + [% s %] + [% END %] + [% RECALL.item.enumchron %] + + [% RECALL.biblio.author %] + + + Recall date: + [% RECALL.recalldate | $KohaDates %] + + + [% IF ( RECALL.is_waiting ) %] + [% IF ( RECALL.expirationdate ) %] + + Expiration: + [% RECALL.expirationdate | $KohaDates %] + + [% ELSE %] + + Expiration: + Never expires + + [% END %] + [% ELSIF ( RECALL.has_expired && RECALL.expirationdate ) %] + + Expiration: + [% RECALL.expirationdate | $KohaDates %] + + [% ELSE %] + - + [% END %] + + Pick up location: + [% RECALL.branch.branchname %] + + Status: + [% IF ( RECALL.is_requested ) %] + Requested + [% ELSIF ( RECALL.is_waiting ) %] + Ready for pickup + [% ELSIF ( RECALL.has_expired ) %] + Expired + [% ELSIF ( RECALL.is_cancelled ) %] + Cancelled + [% END %] + + [% IF ( !RECALL.cancellationdate && ( RECALL.is_requested || RECALL.is_overdue ) ) %] +
    + + + + +
    + [% END %] +
    + + [% END # / # RECALLS.count %] + + + + + + + +[% INCLUDE 'opac-bottom.inc' %] + +[% BLOCK jsinclude %] + [% INCLUDE 'datatables.inc' %] + +[% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 0b586245b1..e1bbf92ec0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -799,7 +799,7 @@ - + @@ -853,20 +853,16 @@ Requested [% ELSIF ( RECALL.is_waiting ) %] Ready for pickup - [% ELSIF ( RECALL.has_expired ) %] - Expired [% END %] [% END %] @@ -1020,7 +1016,7 @@ return confirmDelete(MSG_CONFIRM_CANCEL_RECALL); }); - var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table"); + var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table,#recalls-table"); dTables.each(function(){ var thIndex = $(this).find("th.psort").index(); $(this).dataTable($.extend(true, {}, dataTablesDefaults, { diff --git a/members/moremember.pl b/members/moremember.pl index 41f8b86a97..8189b523ae 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -233,7 +233,7 @@ if ( $data->{dateofbirth} ) { # BUILD HTML # show all recalls and reserves of this borrower, and the position of the reservation .... if ($borrowernumber) { - my $recalls = Koha::Recalls->search({ borrowernumber => $borrowernumber }); + my $recalls = Koha::Recalls->search({ borrowernumber => $borrowernumber, status => { '=', ['R','W'] } }); $template->param( holds_count => Koha::Database->new()->schema()->resultset('Reserve') ->count( { borrowernumber => $borrowernumber } ), diff --git a/members/recallshistory.pl b/members/recallshistory.pl new file mode 100755 index 0000000000..3a6bc2f308 --- /dev/null +++ b/members/recallshistory.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl + +# Copyright 2017 Aleisha Amohia +# +# 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 . + +use Modern::Perl; + +use CGI qw ( -utf8 ); + +use C4::Auth; +use C4::Output; + +use Koha::Recalls; +use Koha::Patrons; + +my $input = CGI->new; + +my ($template, $loggedinuser, $cookie)= get_template_and_user( + { + template_name => "members/recallshistory.tt", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {borrowers => 1}, + debug => 1, + } +); + +my $recalls = Koha::Recalls->search({ borrowernumber => $loggedinuser }); + +my $patron = Koha::Patrons->find($loggedinuser); + +$template->param( + recalls => $recalls, + patron => $patron, + recallsview => 1 +); + +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/opac/opac-recalls.pl b/opac/opac-recalls.pl new file mode 100755 index 0000000000..dc8b6813a6 --- /dev/null +++ b/opac/opac-recalls.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl + +# Copyright 2017 Aleisha Amohia +# +# 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 . + +use Modern::Perl; + +use CGI qw ( -utf8 ); +use Encode qw( encode ); +use C4::Auth; # get_template_and_user +use C4::Output; +use Koha::Recalls; + +my $input = new CGI; + +my ( $template, $borrowernumber, $cookie ) = get_template_and_user( + { + template_name => "opac-recalls.tt", + query => $input, + type => "opac", + authnotrequired => 0, + } +); + +my $recalls = Koha::Recalls->search({ borrowernumber => $borrowernumber }); +$template->param( + RECALLS => $recalls, + recallsview => 1 +); + +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/opac/opac-user.pl b/opac/opac-user.pl index c27c150196..60eddb1921 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -305,7 +305,7 @@ $template->param( show_barcode => 1 ) if $show_barcode; # now the reserved items.... my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } ); -my $recalls = Koha::Recalls->search( { borrowernumber => $borrowernumber } ); +my $recalls = Koha::Recalls->search( { borrowernumber => $borrowernumber, status => { '=', ['R', 'W'] } } ); $template->param( RESERVES => $reserves, -- 2.19.1
    Expires on Pickup location StatusCancelCancel
    - [% IF ( !RECALL.cancellationdate ) %] + [% IF ( !RECALL.cancellationdate && ( RECALL.is_requested || RECALL.is_overdue ) ) %]
    - [% ELSE %] - Cancelled [% END %]