From a6ba34ff00966100e519cdfc12662e23a0c3c249 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 --- circ/circulation.pl | 2 +- .../intranet-tmpl/prog/en/includes/circ-menu.inc | 1 + .../intranet-tmpl/prog/en/includes/recalls.inc | 8 +- .../prog/en/modules/members/recallshistory.tt | 51 ++++++++ .../opac-tmpl/bootstrap/en/includes/usermenu.inc | 8 ++ .../opac-tmpl/bootstrap/en/modules/opac-recalls.tt | 145 +++++++++++++++++++++ .../opac-tmpl/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, 314 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 93d5390..bd92ad4 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -464,7 +464,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 bdcc8af..871fc6e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -120,5 +120,6 @@ [% IF Koha.Preference('ILLModule') %]
  • 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 9ee1342..2608e75 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 0000000..7d21bbe --- /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 7d27f22..02f6f29 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc @@ -113,6 +113,14 @@ [% END %] 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 0000000..cb6e382 --- /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 fda493e..a325ff6 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -789,7 +789,7 @@ Using this account is not recommended because some parts of Koha will not functi - + @@ -843,20 +843,16 @@ Using this account is not recommended because some parts of Koha will not functi Requested [% ELSIF ( RECALL.is_waiting ) %] Ready for pickup - [% ELSIF ( RECALL.has_expired ) %] - Expired [% END %] [% END %] @@ -1004,7 +1000,7 @@ Using this account is not recommended because some parts of Koha will not functi 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 2da7d18..936e3d8 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -254,7 +254,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 0000000..3a6bc2f --- /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 0000000..dc8b681 --- /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 d0a58ed..e3274c3 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -294,7 +294,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.1.4
    Expires on Pickup location StatusCancelCancel
    - [% IF ( !RECALL.cancellationdate ) %] + [% IF ( !RECALL.cancellationdate && ( RECALL.is_requested || RECALL.is_overdue ) ) %]
    - [% ELSE %] - Cancelled [% END %]