Browse Source

Bug 25534: Use the cancelation reasion for the 'X' hold cancelation links

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Kyle Hall 4 years ago
committed by Jonathan Druart
parent
commit
27c80187ba
  1. 15
      koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
  2. 3
      reserve/request.pl

15
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt

@ -956,6 +956,7 @@
var biblionumber = "[% biblionumber | $raw %]";
var borrowernumber = "[% patron.borrowernumber | $raw %]";
var MSG_CONFIRM_DELETE_HOLD = _("Are you sure you want to cancel this hold?");
var REASON_LABEL = _("Reason: ");
var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %]
[% itemloo.itemnumber | html %]: {
@ -1245,7 +1246,19 @@
// Confirm cancelation of hold
$(".cancel-hold").on("click",function(e) {
return confirmDelete(MSG_CONFIRM_DELETE_HOLD);
e.preventDefault;
let msg = MSG_CONFIRM_DELETE_HOLD ;
if ( $("#cancellation-reason").val() ) {
const reason = $("#cancellation-reason option:selected").text();
msg += "\n\n" + REASON_LABEL + reason;
}
const confirm = confirmDelete(msg);
if ( confirm ) {
let href = $(this).attr('href');
href += "&cancellation-reason=" + $("#cancellation-reason").val();
window.location = href;
}
return false;
});
[% UNLESS ( patron || patron.borrowernumber || borrowers || noitems ) %]

3
reserve/request.pl

@ -106,8 +106,9 @@ if ( $action eq 'move' ) {
}
} elsif ( $action eq 'cancel' ) {
my $reserve_id = $input->param('reserve_id');
my $cancellation_reason = $input->param("cancellation-reason");
my $hold = Koha::Holds->find( $reserve_id );
$hold->cancel if $hold;
$hold->cancel({ cancellation_reason => $cancellation_reason }) if $hold;
} elsif ( $action eq 'setLowestPriority' ) {
my $reserve_id = $input->param('reserve_id');
ToggleLowestPriority( $reserve_id );

Loading…
Cancel
Save