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 %]: {
// 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 ) %]
}
} 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 );