From 6cb8aa14ac987d944615288eb72092ec87c4b970 Mon Sep 17 00:00:00 2001 From: Thibaud Guillot Date: Fri, 3 Nov 2023 15:30:04 +0100 Subject: [PATCH] Bug 29007: Add cancellation reason input on check in Test plan: 1) Check an item in with already a confirmed hold 2) Cancel the hold, it was cancelled without possibility to choosing a reason 3) Apply this patch and do it again, you must see an input to choose your cancellation reason (list from VA) Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi (cherry picked from commit fe93b31ec73f22712189f9e4d385ec453b1cbd5a) Signed-off-by: Fridolin Somers --- circ/returns.pl | 4 +++- .../prog/en/modules/circ/returns.tt | 21 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/circ/returns.pl b/circ/returns.pl index 7fab76dc5f..a5e50989c0 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -147,6 +147,8 @@ if ( $query->param('reserve_id') ) { my $reserve_id = $query->param('reserve_id'); my $diffBranchReturned = $query->param('diffBranch'); my $cancel_reserve = $query->param('cancel_reserve'); + my $cancel_reason = $query->param('cancel_reason'); + # fix up item type for display my $item = Koha::Items->find( $itemnumber ); my $biblio = $item->biblio; @@ -154,7 +156,7 @@ if ( $query->param('reserve_id') ) { if ( $cancel_reserve ) { my $hold = Koha::Holds->find( $reserve_id ); if ( $hold ) { - $hold->cancel( { charge_cancel_fee => !$forgivemanualholdsexpire } ); + $hold->cancel( { charge_cancel_fee => !$forgivemanualholdsexpire, cancellation_reason => $cancel_reason} ); } # FIXME else? } else { my $diffBranchSend = ($userenv_branch ne $diffBranchReturned) ? $diffBranchReturned : undef; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 060dd37cae..7a5265362c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -680,6 +680,7 @@ @@ -1523,7 +1536,9 @@ this.form.submit(); }); $('.cancel-hold').on("click",function(e){ + let cancel_reason = document.getElementById('cancellation-reason').value; this.form.cancel_reserve.value = 1; + this.form.cancel_reason.value = cancel_reason; this.form.submit(); }); -- 2.39.2