From 27a0a642ab168e7840162070e6e3ae0f42f3eb9f Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 23 Apr 2020 15:35:33 +0000 Subject: [PATCH] Bug 19532: Recalls on intranet --- circ/circulation.pl | 2 + .../intranet-tmpl/prog/en/includes/circ-menu.inc | 3 + .../intranet-tmpl/prog/en/includes/circ-nav.inc | 8 ++ .../intranet-tmpl/prog/en/includes/recalls.inc | 114 ++++++++++++++++ .../prog/en/modules/circ/circulation-home.tt | 12 ++ .../prog/en/modules/circ/circulation.tt | 15 ++ .../prog/en/modules/members/recallshistory.tt | 45 ++++++ .../prog/en/modules/recalls/recalls_queue.tt | 68 ++++++++++ .../prog/en/modules/recalls/recalls_to_pull.tt | 151 +++++++++++++++++++++ koha-tmpl/intranet-tmpl/prog/js/recalls.js | 136 +++++++++++++++++++ members/recallshistory.pl | 46 +++++++ recalls/recalls_queue.pl | 57 ++++++++ recalls/recalls_to_pull.pl | 95 +++++++++++++ tools/letter.pl | 2 +- 14 files changed, 753 insertions(+), 1 deletion(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_queue.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_to_pull.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/js/recalls.js create mode 100755 members/recallshistory.pl create mode 100755 recalls/recalls_queue.pl create mode 100755 recalls/recalls_to_pull.pl diff --git a/circ/circulation.pl b/circ/circulation.pl index 81c3bcdf561..993a145331b 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -453,9 +453,11 @@ if (@$barcodes) { 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, old => undef }); $template->param( holds_count => $holds->count(), WaitingHolds => $waiting_holds, + recalls => $recalls, ); } 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 d665e811045..8f5d996c936 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -139,6 +139,9 @@ [% IF Koha.Preference('ILLModule') && CAN_user_ill %] [% IF illview %]
  • [% ELSE %]
  • [% END %]ILL requests history
  • [% END %] + [% IF Koha.Preference('UseRecalls') && CAN_user_recalls %] + [% IF recallsview %]
  • [% ELSE %]
  • [% END %]Recalls history
  • + [% END %] 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 979871a0b99..535ba7be900 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc @@ -39,6 +39,14 @@ [% IF Koha.Preference('OnSiteCheckouts') %]
  • Pending on-site checkouts
  • [% END %] + + [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %] +
  • Recalls queue
  • +
  • Recalls to pull
  • +
  • Overdue recalls
  • +
  • Recalls awaiting pickup
  • +
  • Old recalls
  • + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc new file mode 100644 index 00000000000..1556e246541 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc @@ -0,0 +1,114 @@ +
    +[% IF recalls.count %] + + + + [% IF checkboxes %][% END %] + + + + + + + [% UNLESS viewing_old %][% END %] + + + + + [% FOREACH recall IN recalls %] + [% IF recall.old %][% ELSE %][% END %] + [% IF checkboxes %] + + [% END %] + + + + + + + + + + + + + [% UNLESS viewing_old %] + + [% END %] + + + [% END %] + +
     TitlePlaced onExpires onPickup locationStatusDue date 
    + [% IF recall.old %] +   + [% ELSE %] + + [% END %] + + + [% recall.biblio.title %] + [% FOREACH s IN recall.biblio.subtitle %] + [% s %] + [% END %] + + [% IF recall.item %][% recall.item.barcode %][% END %] + [% recall.biblio.author %] + + [% recall.recalldate | $KohaDates %] + + [% IF ( recall.expirationdate ) %] + [% recall.expirationdate | $KohaDates %] + [% ELSIF ( !recall.old ) %] + Never expires + [% ELSE %] + - + [% END %] + + [% recall.library.branchname %] + + [% IF ( recall.in_transit ) %] + In transit to [% recall.library.branchname %] + [% ELSIF ( recall.waiting ) %] + Ready for pickup + [% ELSIF ( recall.expired ) %] + Expired on [% recall.expirationdate | $KohaDates %] + [% ELSIF ( recall.cancelled ) %] + Cancelled on [% recall.cancellationdate | $KohaDates %] + [% ELSIF ( recall.overdue ) %] + Overdue to be returned + [% ELSIF ( recall.finished ) %] + Fulfilled + [% ELSE %] + Requested + [% END %] + + [% IF recall.requested %] + Due to be returned by [% recall.checkout.date_due | $KohaDates %] + [% ELSIF recall.waiting and RECALL.expirationdate %] + Pick up by [% RECALL.expirationdate | $KohaDates %] + [% ELSE %] + - + [% END %] + +
    + Actions + +
    +
    + [% ELSE %] + [% IF patron.borrowernumber %] + Patron has no current recalls. + [% ELSE %] + There are no recalls to show. + [% END %] + [% END %] +
    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 fbabec67457..429a595367b 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 @@ -70,6 +70,18 @@ Hold ratios + + [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %] +

    Recalls

    + + + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 74231648506..6e002440421 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -900,6 +900,14 @@ [% END %] + + [% IF Koha.Preference('UseRecalls') %] +
  • + + [% recalls.count %] Recalls + +
  • + [% END %] @@ -914,6 +922,12 @@ [% END %] + [% IF Koha.Preference('UseRecalls') %] +
    + [% INCLUDE 'recalls.inc' %] +
    + [% END %] + [% INCLUDE borrower_debarments.inc %]
    @@ -1154,6 +1168,7 @@ [% INCLUDE 'str/members-menu.inc' %] [% Asset.js("js/members-menu.js") | $raw %] + [% Asset.js("js/recalls.js") %] [% 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 new file mode 100644 index 00000000000..860d2653341 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt @@ -0,0 +1,45 @@ +[% USE KohaDates %] +[% USE Koha %] +[% USE Asset %] +[% SET footerjs = 1 %] +[% INCLUDE 'doc-head-open.inc' %] +Recalls history for [% INCLUDE 'patron-title.inc' %] +[% INCLUDE 'doc-head-close.inc' %] + + + + + [% INCLUDE 'header.inc' %] + [% INCLUDE 'patron-search.inc' %] + + +
    +
    +
    +
    + [% INCLUDE 'members-toolbar.inc' %] +

    Recalls history

    + [% IF Koha.Preference('UseRecalls') %] + [% INCLUDE 'recalls.inc' %] + [% ELSE %] +
    Recalls have not been enabled. Enable the UseRecalls system preference to use recalls.
    + [% END %] +
    +
    +
    + +
    +
    + +[% MACRO jsinclude BLOCK %] + [% INCLUDE 'datatables.inc' %] + [% Asset.js("js/recalls.js") %] +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_queue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_queue.tt new file mode 100644 index 00000000000..70f4cb5dfe6 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_queue.tt @@ -0,0 +1,68 @@ +[% USE Koha %] +[% USE KohaDates %] +[% USE Asset %] +[% SET footerjs = 1 %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Circulation › Recalls queue +[% INCLUDE 'doc-head-close.inc' %] + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'cat-search.inc' %] + + + +
    +
    + [% IF Koha.Preference('CircSidebar') %] +
    + [% ELSE %] +
    + [% END %] +
    + +

    Recalls queue

    + [% IF Koha.Preference('UseRecalls') %] + [% IF recalls.count %] +
    + + Select all + [% INCLUDE 'recalls.inc' %] +
    + +
    +
    + [% ELSE %] +
    No recalls have been made.
    + [% END %] + [% ELSE %] +
    Recalls have not been enabled. Enable the UseRecalls system preference to use recalls.
    + [% END %] + +
    +
    + + [% IF Koha.Preference('CircSidebar') %] +
    + +
    + [% END %] + +
    +
    + +[% MACRO jsinclude BLOCK %] + [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'columns_settings.inc' %] + [% Asset.js("js/recalls.js") %] +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_to_pull.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_to_pull.tt new file mode 100644 index 00000000000..460d5551753 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_to_pull.tt @@ -0,0 +1,151 @@ +[% USE Koha %] +[% USE KohaDates %] +[% USE AuthorisedValues %] +[% USE Branches %] +[% USE ItemTypes %] +[% USE Asset %] +[% SET footerjs = 1 %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Circulation › Recalls to pull +[% INCLUDE 'doc-head-close.inc' %] + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'cat-search.inc' %] + + + +
    +
    + [% IF Koha.Preference('CircSidebar') %] +
    + [% ELSE %] +
    + [% END %] +
    + +

    Recalls to pull

    + [% IF Koha.Preference('UseRecalls') %] +
    + [% IF recalls.count %] + + + + + + + + + + + + + + + + + + + + [% FOREACH recall IN recalls %] + + + + + + + + + + + + + + + + [% END %] + +
    Pull this many itemsItems availablePatrons with recallsFirst patronTitleLibrariesAvailable call numbersAvailable copy numbersAvailable enumerationAvailable item typesAvailable locationsEarlier recall date 
    [% recall.pull_count %][% recall.items_count %][% recall.patrons_count %][% recall.first_patron.firstname %] [% recall.first_patron.surname %] + [% INCLUDE 'biblio-default-view.inc' biblionumber=recall.biblio.biblionumber %] + [% INCLUDE 'biblio-title.inc' biblio=recall.biblio %] + [% IF recall.biblio.author %] by [% recall.biblio.author %][% END %] + +
      + [% FOREACH library IN recall.libraries %] +
    • [% Branches.GetName( library ) %]
    • + [% END %] +
    +
    +
      + [% FOREACH callnumber IN recall.callnumbers %] +
    • [% callnumber %]
    • + [% END %] +
    +
    +
      + [% FOREACH copyno IN recall.copynumbers %] +
    • [% copyno %]
    • + [% END %] +
    +
    +
      + [% FOREACH enumchron IN recall.enumchrons %] +
    • [% enumchron %]
    • + [% END %] +
    +
    +
      + [% FOREACH itemtype IN recall.itemtypes %] +
    • [% ItemTypes.GetDescription( itemtype ) %]
    • + [% END %] +
    +
    +
      + [% FOREACH loc IN recall.locations %] +
    • [% AuthorisedValues.GetByCode('LOC', loc) %]
    • + [% END %] +
    +
    + [% recall.first_date | $KohaDates %] in [% recall.first_library.branchname %] + +
    + + + +
    +
    + [% ELSE %] +
    There are no recalls to pull.
    + [% END %] +
    + [% ELSE %] +
    Recalls have not been enabled. Enable the UseRecalls system preference to use recalls.
    + [% END %] + +
    +
    + + [% IF Koha.Preference('CircSidebar') %] +
    + +
    + [% END %] + +
    +
    + +[% MACRO jsinclude BLOCK %] + [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'columns_settings.inc' %] + [% Asset.js("js/recalls.js") %] +[% END %] + +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/recalls.js b/koha-tmpl/intranet-tmpl/prog/js/recalls.js new file mode 100644 index 00000000000..0c77102a246 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/recalls.js @@ -0,0 +1,136 @@ +$(document).ready(function() { + + $(".cancel_recall").click(function(e){ + if (confirmDelete(_("Are you sure you want to remove this recall?"))){ + var $self = $(this); + var $recall_id = $(this).data('id'); + var $action = $(this).data('action'); + var ajaxData = { + 'recall_id': $recall_id, + 'action' : $action, + }; + var $howmanyparents = $(this).data('parent'); + + $.ajax({ + url: '/cgi-bin/koha/svc/recall', + type: 'POST', + dataType: 'json', + data: ajaxData, + }) + .done(function(data) { + var message = ""; + if(data.success == 0) { + message = _("The recall may have already been cancelled. Please refresh the page."); + } else { + message = _("Cancelled"); + } + if ( $howmanyparents == "one" ){ + $self.parent().html(message); + } else { + $self.parent().parent().parent().parent().html(message); + } + }); + } + }); + + $(".checkin_recall").click(function(e){ + if (confirmDelete(_("Are you sure you want to check in this item and confirm the recall as 'waiting'?"))){ + var $self = $(this); + var $recall_id = $(this).data('id'); + var $action = $(this).data('action'); + var ajaxData = { + 'recall_id': $recall_id, + 'action' : $action, + }; + + $.ajax({ + url: '/cgi-bin/koha/svc/recall', + type: 'POST', + dataType: 'json', + data: ajaxData, + }) + .done(function(data) { + var message = ""; + if(data.success == 0) { + message = _("The recall may have already been checked in. Please refresh the page."); + } else { + message = _("Completed"); + } + $self.parent().parent().parent().parent().html(message); + }); + } + }); + + $(".expire_recall").click(function(e){ + if (confirmDelete(_("Are you sure you want to expire this recall?"))){ + var $self = $(this); + var $recall_id = $(this).data('id'); + var $action = $(this).data('action'); + var ajaxData = { + 'recall_id': $recall_id, + 'action' : $action, + }; + + var $howmanyparents = $(this).data('parent'); + + $.ajax({ + url: '/cgi-bin/koha/svc/recall', + type: 'POST', + dataType: 'json', + data: ajaxData, + }) + .done(function(data) { + var message = ""; + if(data.success == 0) { + message = _("The recall may have already been expired. Please refresh the page."); + } else { + message = _("Expired"); + } + if ( $howmanyparents == "one" ){ + $self.parent().html(message); + } else { + $self.parent().parent().parent().parent().html(message); + } + }); + } + }); + + $("#recalls-table").dataTable($.extend(true, {}, dataTablesDefaults, { + "aoColumnDefs": [ + { "aTargets": [ 'nosort' ], "bSortable": false, "bSearchable": false }, + ], + "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.")); + } + }); + + $("#expire_selected").click(function(e){ + if ($("input[name='recall_ids']:checked").length > 0){ + return confirmDelete(_("Are you sure you want to expire 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); + } + }); + + $("#hide_old").click(function(){ + if ($("#hide_old").prop("checked")){ + $(".old").show(); + } else { + $(".old").hide(); + } + }); +}); diff --git a/members/recallshistory.pl b/members/recallshistory.pl new file mode 100755 index 00000000000..d3edc62d2f2 --- /dev/null +++ b/members/recallshistory.pl @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +# Copyright 2020 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; + +my $input = CGI->new; +my ($template, $loggedinuser, $cookie)= get_template_and_user( + { + template_name => "members/recallshistory.tt", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { recalls => 1 }, + debug => 1, + } +); + +my $borrowernumber = $input->param('borrowernumber'); +my $recalls = Koha::Recalls->search({ borrowernumber => $borrowernumber }); +my $patron = Koha::Patrons->find($borrowernumber); + +$template->param( + patron => $patron, + recalls => $recalls, + recallsview => 1, +); + +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/recalls/recalls_queue.pl b/recalls/recalls_queue.pl new file mode 100755 index 00000000000..05349f74003 --- /dev/null +++ b/recalls/recalls_queue.pl @@ -0,0 +1,57 @@ +#!/usr/bin/perl + +# Copyright 2020 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::BiblioFrameworks; + +my $query = new CGI; +my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( + { + template_name => "recalls/recalls_queue.tt", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { recalls => 'manage_recalls' }, + 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) { + $id->set_cancelled; + } + $op = 'list' +} +elsif ( $op eq 'list' ) { + my $recalls = Koha::Recalls->search({ old => undef }); + $template->param( + recalls => $recalls, + checkboxes => 1, + ); +} + +# 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/recalls/recalls_to_pull.pl b/recalls/recalls_to_pull.pl new file mode 100755 index 00000000000..e6e37fae040 --- /dev/null +++ b/recalls/recalls_to_pull.pl @@ -0,0 +1,95 @@ +#!/usr/bin/perl + +# Copyright 2020 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::BiblioFrameworks; + +my $query = new CGI; +my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( + { + template_name => "recalls/recalls_to_pull.tt", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { recalls => 'manage_recalls' }, + debug => 1, + } +); + +my $op = $query->param('op') || 'list'; +my $recall_id = $query->param('recall_id'); +if ( $op eq 'cancel' ) { + Koha::Recalls->find( $recall_id )->set_cancelled; + $op = 'list'; +} +elsif ( $op eq 'list' ) { + my @recalls = Koha::Recalls->search({ status => [ 'R','O' ] }); + my @pull_list; + foreach my $recall ( @recalls ) { + my @items = Koha::Items->search({ biblionumber => $recall->biblionumber }); + my $distinct_recalls = Koha::Recalls->search({ biblionumber => $recall->biblionumber, status => [ 'R','O' ] }, { columns => [ 'borrowernumber' ], distinct => 1, order_by => { -asc => 'recalldate' } }); + my $recalls_count = $distinct_recalls->count; + my $first_recall = $distinct_recalls->next; + my $items_count; + my @callnumbers; + my @copynumbers; + my @enumchrons; + my @itemtypes; + my @locations; + my @libraries; + foreach my $item ( @items ) { + if ( $item->can_be_waiting_recall ) { + $items_count++; + push( @callnumbers, $item->itemcallnumber ); + push( @copynumbers, $item->copynumber ); + push( @enumchrons, $item->enumchron ); + push( @itemtypes, $item->effective_itemtype ); + push( @locations, $item->location ); + push( @libraries, $item->holdingbranch ); + } + } + push( @pull_list, { + recall => $recall, + biblio => $recall->biblio, + items_count => $items_count, + recalls_count => $recalls_count, + pull_count => $items_count <= $recalls_count ? $items_count : $recalls_count, + first_patron => $first_recall->patron, + first_date => $first_recall->recalldate, + #first_library => $first_recall->library, + callnumbers => @callnumbers, + copynumbers => @copynumbers, + enumchrons => @enumchrons, + itemtypes => @itemtypes, + locations => @locations, + libraries => @libraries, + }); + } + $template->param( + recalls => \@pull_list, + ); +} + +# 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/tools/letter.pl b/tools/letter.pl index 6044243c090..e95746e1e21 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -248,7 +248,7 @@ sub add_form { {value => 'items.fine', text => 'items.fine'}, add_fields('borrowers'); if ($module eq 'circulation') { - push @{$field_selection}, add_fields('opac_news'); + push @{$field_selection}, add_fields('opac_news', 'recalls'); } -- 2.11.0