From a355d489964e4081219b23634d9aa35c92d5972d Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Fri, 3 Dec 2021 15:31:06 +1300 Subject: [PATCH] Bug 15516: (follow-up) Prevent cancelling unintended holds And a fix for consistent TT code --- C4/Reserves.pm | 18 +++++++++++------- .../intranet-tmpl/prog/en/includes/holds_table.inc | 4 ++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index d1954c938c..f8193e546f 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1127,9 +1127,11 @@ sub ModReserveFill { if C4::Context->preference('HoldsLog'); # if this hold was part of a group, cancel other holds in the group - my @holds = Koha::Holds->search({ hold_group_id => $hold->hold_group_id }); - foreach my $h ( @holds ) { - $h->cancel unless $h->reserve_id == $hold->reserve_id; + if ( $hold->hold_group_id ) { + my @holds = Koha::Holds->search({ hold_group_id => $hold->hold_group_id }); + foreach my $h ( @holds ) { + $h->cancel unless $h->reserve_id == $hold->reserve_id; + } } # FIXME Must call Koha::Hold->cancel ? => No, should call ->filled and add the correct log @@ -1240,10 +1242,12 @@ sub ModReserveAffect { $transfer->receive if $transfer; # if this hold was part of a group, cancel other holds in the group - my @holds = Koha::Holds->search({ hold_group_id => $hold->hold_group_id }); - foreach my $h ( @holds ) { - push @reserve_ids, $h->reserve_id; - $h->cancel unless $h->reserve_id == $hold->reserve_id; + if ( $hold->hold_group_id ) { + my @holds = Koha::Holds->search({ hold_group_id => $hold->hold_group_id }); + foreach my $h ( @holds ) { + push @reserve_ids, $h->reserve_id; + $h->cancel unless $h->reserve_id == $hold->reserve_id; + } } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc index 4971418e5c..0ee8f85d8a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -177,9 +177,9 @@ [%- IF hold.non_priority -%]
Non priority hold [%- END -%] - [% IF hold.hold_group_id %] + [%- IF hold.hold_group_id -%]
(part of a hold group)
- [% END %] + [%- END -%] [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%] [%- UNLESS hold.found -%] -- 2.11.0