From 97a4c1b3345621fbcd4703b658709689c28ead2b Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 16 Nov 2017 00:40:14 +0000 Subject: [PATCH] Bug 19532: Overdue recalls report Signed-off-by: Nick Clemens --- Koha/Recall.pm | 23 +++- circ/recalls_overdue.pl | 59 +++++++++++ circ/recalls_queue.pl | 2 - .../prog/en/includes/recalls-reports.inc | 2 +- .../prog/en/modules/circ/recalls_overdue.tt | 118 +++++++++++++++++++++ .../prog/en/modules/circ/recalls_queue.tt | 2 +- 6 files changed, 198 insertions(+), 8 deletions(-) create mode 100755 circ/recalls_overdue.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_overdue.tt diff --git a/Koha/Recall.pm b/Koha/Recall.pm index 3df902d..6e2280b 100644 --- a/Koha/Recall.pm +++ b/Koha/Recall.pm @@ -43,7 +43,7 @@ sub _type { =head3 biblio -Returns the related Koha::Biblio object for this hold +Returns the related Koha::Biblio object for this recall =cut @@ -57,7 +57,7 @@ sub biblio { =head3 item -Returns the related Koha::Item object for this Hold +Returns the related Koha::Item object for this recall =cut @@ -72,7 +72,7 @@ sub item { =head3 borrower -Returns the related Koha::Patron object for this Hold +Returns the related Koha::Patron object for this recall =cut @@ -84,9 +84,10 @@ sub borrower { return $self->{_borrower}; } + =head3 branch -Returns the related Koha::Library object for this Hold +Returns the related Koha::Library object for this recall =cut @@ -98,6 +99,20 @@ sub branch { return $self->{_branch}; } +=head3 checkout + +Returns the related Koha::Checkout object for this recall + +=cut + +sub checkout { + my ($self) = @_; + + $self->{_checkout} ||= Koha::Checkouts->find({ itemnumber => $self->itemnumber() }); + + return $self->{_checkout}; +} + =head3 is_waiting Returns true if recall is awaiting pickup diff --git a/circ/recalls_overdue.pl b/circ/recalls_overdue.pl new file mode 100755 index 0000000..4ea5b85 --- /dev/null +++ b/circ/recalls_overdue.pl @@ -0,0 +1,59 @@ +#!/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::BiblioFrameworks; +use Koha::DateUtils; + +my $query = new CGI; +my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( + { + template_name => "circ/recalls_overdue.tt", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => "circulate_remaining_permissions" }, + debug => 1, + } +); + +my $op = $query->param('op') || 'list'; +my @recall_ids = $query->multi_param('recall_ids'); + +if ($op eq 'cancel_multiple_recalls') { + foreach my $id (@recall_ids) { + Koha::Recalls->find($id)->update({ cancellationdate => dt_from_string(), status => 'C' }); + $op = 'list' + } +} + +if ($op eq 'list') { + my $recalls = Koha::Recalls->search({ status => 'O' }); + $template->param( recalls => $recalls ); +} + +# Checking if there is a Fast Cataloging Framework +$template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' ); + +# writing the template +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/circ/recalls_queue.pl b/circ/recalls_queue.pl index 06c7c66..223dfe0 100755 --- a/circ/recalls_queue.pl +++ b/circ/recalls_queue.pl @@ -39,11 +39,9 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( my $op = $query->param('op') || 'list'; my @recall_ids = $query->multi_param('recall_ids'); -warn($op); if ($op eq 'cancel_multiple_recalls') { foreach my $id (@recall_ids) { - warn($id); Koha::Recalls->find($id)->update({ cancellationdate => dt_from_string(), status => 'C' }); $op = 'list' } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls-reports.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls-reports.inc index 1685b7b..825f98c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls-reports.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls-reports.inc @@ -4,7 +4,7 @@   - Borrower + Requested by Title Placed on Expires on diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_overdue.tt new file mode 100644 index 0000000..494cfdc --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_overdue.tt @@ -0,0 +1,118 @@ +[% USE Koha %] +[% USE KohaDates %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Circulation › Overdue recalls +[% INCLUDE 'doc-head-close.inc' %] + + + +[% INCLUDE 'datatables.inc' %] +[% INCLUDE 'columns_settings.inc' %] + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'cat-search.inc' %] + + + +[% IF Koha.Preference('CircSidebar') %]
[% ELSE %]
[% END %] + +
+
+ [% IF Koha.Preference('CircSidebar') %]
[% END %] +
+ +

Overdue recalls

+ + [% IF recalls.count %] + +
+ + + Select all + +
+ + + + + + + + + + + + + + + [% FOREACH recall IN recalls %] + + + + + + + + + + + [% END %] + +
 Requested byTitlePlaced onDue dateCurrently checked out toPickup locationCancel
+ + + + [% recall.borrower.firstname %] [% recall.borrower.surname %] ([% recall.borrowernumber %]) + + + + [% recall.biblio.title %] + [% FOREACH s IN recall.biblio.subtitles %] + [% s %] + [% END %] + [% recall.item.enumchron %] + + [% recall.biblio.author %] + + [% recall.recalldate | $KohaDates %] + + [% recall.checkout.date_due %] + + + [% recall.checkout.patron.firstname %] [% recall.checkout.patron.surname %] ([% recall.checkout.borrowernumber %]) + + + [% recall.branch.branchname %] + + Cancel +
+
+
+ +
+
+ + [% ELSE %] + +
There are no overdue recalls.
+ + [% END %] + +
+
+ +
+ + [% IF Koha.Preference('CircSidebar') %] +
+ [% INCLUDE 'circ-nav.inc' %] +
+ [% END %] +
+ +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_queue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_queue.tt index 274f1d9..5d28ac1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_queue.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_queue.tt @@ -9,7 +9,7 @@ [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] - + [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] -- 2.1.4