From e5fd600a217c7e921804da1ad3f814beaa649ba7 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 15 Jan 2021 13:10:09 +0000 Subject: [PATCH] Bug 26282: Update pendingreserves to use buttons This patch updates circ/pendingreserves to use two buttons; "Cancel hold" and "Cancel hold and notify" for the pending reserves page. It will only display the notify option when a notice template exists. --- circ/pendingreserves.pl | 10 +++++++++- .../prog/en/modules/circ/pendingreserves.tt | 13 ++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index 5934e9d982..a9a853de0c 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -215,7 +215,8 @@ my $strsth = count(DISTINCT items.itemnumber) as icount, count(DISTINCT reserves.borrowernumber) as rcount, borrowers.firstname, - borrowers.surname + borrowers.surname, + borrowers.branchcode as bbranch FROM reserves LEFT JOIN items ON items.biblionumber=reserves.biblionumber LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber @@ -249,6 +250,12 @@ $strsth .= " GROUP BY reserves.biblionumber ORDER BY biblio.title "; my $sth = $dbh->prepare($strsth); $sth->execute(@query_params); +my $cancel_notify_templates = Koha::Notice::Templates->search({ module => 'reserves', code => 'HOLD_CANCELLATION' }); +my $cancel_notice_exists; +while ( my $notice = $cancel_notify_templates->next ) { + $cancel_notice_exists->{$notice->branchcode} = 1; +} + while ( my $data = $sth->fetchrow_hashref ) { push( @reservedata, { @@ -280,6 +287,7 @@ while ( my $data = $sth->fetchrow_hashref ) { homebranch => $data->{homebranch}, itemnumber => $data->{itemnumber}, publicationyear => C4::Context->preference('marcflavour') eq "MARC21" ? $data->{copyrightdate} : $data->{publicationyear}, + cancel_notify => exists($cancel_notice_exists->{$data->{bbranch}}) ? 1 : exists($cancel_notice_exists->{''}), } ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt index c9a04b6dff..71657c06f3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt @@ -167,16 +167,19 @@ [% END %] - - - [% END %] [% IF reserveloo.holdingbranch != reserveloo.homebranch %] - + + [% IF reserveloo.cancel_notify %] + + + [% IF reserveloo.cancel_notify %] + + [% END %] [% END %] -- 2.20.1