From ebb1c29603cf514962a0692a88259ba516a84402 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 15 Nov 2017 22:10:37 +0000 Subject: [PATCH] Bug 19532: Recalls queue This patch adds a recalls queue page to the circulation reports You can see all recalls made in the system, who requested them, their status and other relevant info. you can cancel individual or multiple recalls. --- Koha/Recall.pm | 14 ++++ circ/recalls_queue.pl | 61 ++++++++++++++ .../intranet-tmpl/prog/en/includes/circ-nav.inc | 3 + .../prog/en/includes/recalls-reports.inc | 92 ++++++++++++++++++++++ .../intranet-tmpl/prog/en/includes/recalls.inc | 4 +- .../prog/en/modules/circ/circulation-home.tt | 3 + .../prog/en/modules/circ/recalls_queue.tt | 63 +++++++++++++++ .../prog/en/modules/members/recallshistory.tt | 13 --- koha-tmpl/intranet-tmpl/prog/js/recalls.js | 23 ++++++ 9 files changed, 261 insertions(+), 15 deletions(-) create mode 100755 circ/recalls_queue.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/recalls-reports.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_queue.tt diff --git a/Koha/Recall.pm b/Koha/Recall.pm index dccb069..3df902d 100644 --- a/Koha/Recall.pm +++ b/Koha/Recall.pm @@ -70,6 +70,20 @@ sub item { return $self->{_item}; } +=head3 borrower + +Returns the related Koha::Patron object for this Hold + +=cut + +sub borrower { + + my ($self) = @_; + + $self->{_borrower} ||= Koha::Patrons->find( $self->borrowernumber() ); + + return $self->{_borrower}; +} =head3 branch Returns the related Koha::Library object for this Hold diff --git a/circ/recalls_queue.pl b/circ/recalls_queue.pl new file mode 100755 index 0000000..06c7c66 --- /dev/null +++ b/circ/recalls_queue.pl @@ -0,0 +1,61 @@ +#!/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_queue.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'); +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' + } +} + +if ($op eq 'list') { + my $recalls = Koha::Recalls->search({}); + $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/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc index 844926c..9835d13 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc @@ -49,6 +49,9 @@ [% IF Koha.Preference('OnSiteCheckouts') %]
  • Pending on-site checkouts
  • [% END %] +
  • Recalls queue
  • +
  • Overdue recalls
  • +
  • Recalls awaiting pickup
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls-reports.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls-reports.inc new file mode 100644 index 0000000..1685b7b --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls-reports.inc @@ -0,0 +1,92 @@ +
    +[% IF recalls.count %] + + + + + + + + + + + + + + + + [% FOREACH recall IN recalls %] + + + + + + + + + + + + + + + + + [% END %] + +
     BorrowerTitlePlaced onExpires onPickup locationStatusCancel
    + [% IF recall.is_requested || recall.is_waiting || recall.is_overdue %] + + [% ELSE %] +   + [% END %] + + + [% 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 %] + + [% IF ( recall.is_waiting ) %] + [% IF ( recall.expirationdate ) %] + [% recall.expirationdate | $KohaDates %] + [% ELSE %] + Never expires + [% END %] + [% ELSIF ( recall.has_expired && recall.expirationdate ) %] + [% recall.expirationdate | $KohaDates %] + [% ELSE %] + - + [% END %] + + [% recall.branch.branchname %] + + [% IF ( recall.is_requested ) %] + Requested + [% ELSIF ( recall.is_waiting ) %] + 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 && ( recall.is_requested || recall.is_overdue ) ) %] + Cancel + [% END %] +
    + [% ELSE %] + No recalls have been made. + [% END %] +
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc index 2608e75..b17288b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc @@ -1,6 +1,6 @@
    [% IF recalls.count %] - +
    @@ -64,7 +64,7 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt index fa49df9..c212257 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt @@ -55,6 +55,9 @@ [% IF Koha.Preference('OnSiteCheckouts') %]
  • Pending on-site checkouts
  • [% END %] +
  • Recalls queue
  • +
  • Overdue recalls
  • +
  • Recalls awaiting pickup
  • 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 new file mode 100644 index 0000000..274f1d9 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_queue.tt @@ -0,0 +1,63 @@ +[% USE Koha %] +[% USE KohaDates %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Circulation › Recalls queue +[% 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 %] +
    + +

    Recalls queue

    + + [% IF recalls.count %] + +
    + + + Select all + + [% INCLUDE 'recalls-reports.inc' %] + +
    + +
    + + + [% ELSE %] + +
    No recalls have been made.
    + + [% END %] + +
    +
    + +
    + + [% IF Koha.Preference('CircSidebar') %] +
    + [% INCLUDE 'circ-nav.inc' %] +
    + [% END %] +
    + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt index 7d21bbe..a7ee266 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt @@ -6,19 +6,6 @@ [% INCLUDE 'datatables.inc' %] - [% INCLUDE 'header.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/recalls.js b/koha-tmpl/intranet-tmpl/prog/js/recalls.js index 1d29668..1174286 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/recalls.js +++ b/koha-tmpl/intranet-tmpl/prog/js/recalls.js @@ -26,4 +26,27 @@ $(document).ready(function() { } }); + $("#recalls-table").dataTable($.extend(true, {}, dataTablesDefaults, { + "aoColumnDefs": [ + { "aTargets": [ 'nosort' ], "bSortable": false, "bSearchable": false }, + ], + "aaSorting": [[ 1, "asc" ]], + "sPaginationType": "full_numbers" + })); + + $("#cancel_selected").click(function(e){ + if ($("input[name='recall_ids']:checked").length > 0){ + return confirmDelete(_("Are you sure you want to remove the selected recall(s)?")); + } else { + alert(_("Please make a selection.")); + } + }); + + $("#select_all").click(function(){ + if ($("#select_all").prop("checked")){ + $("input[name='recall_ids']").prop("checked", true); + } else { + $("input[name='recall_ids']").prop("checked", false); + } + }); }); -- 2.1.4
    Title [% IF ( !recall.cancellationdate && ( recall.is_requested || recall.is_overdue ) ) %] - Cancel + Cancel [% END %]