@@ -, +, @@ --- 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 --- a/Koha/Recall.pm +++ a/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 --- a/circ/recalls_queue.pl +++ a/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; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc +++ a/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
  • --- a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls-reports.inc +++ a/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 %] +
    --- a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc @@ -1,6 +1,6 @@
    [% IF recalls.count %] - +
    @@ -64,7 +64,7 @@ --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt +++ a/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
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_queue.tt +++ a/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' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt @@ -6,19 +6,6 @@ [% INCLUDE 'datatables.inc' %] - [% INCLUDE 'header.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/js/recalls.js +++ a/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); + } + }); }); --
    Title [% IF ( !recall.cancellationdate && ( recall.is_requested || recall.is_overdue ) ) %] - Cancel + Cancel [% END %]