From 960c700b1d646cf216cb2a683c13055608bc9881 Mon Sep 17 00:00:00 2001 From: Jacob O'Mara Date: Thu, 19 Feb 2026 09:22:16 +0000 Subject: [PATCH] Bug 39658: (follow-up) linked hold pickup all types Linked account hold pickup check now applies to all hold statuses (Reserved, Transferred, Processing), not just Waiting. --- C4/Circulation.pm | 56 +++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 4c66e6ccc85..ec184f7c4b2 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1248,38 +1248,36 @@ sub CanBookBeIssued { my $resbor = $res->{'borrowernumber'}; if ( $resbor ne $patron->borrowernumber ) { my $hold_patron = Koha::Patrons->find($resbor); - if ( $restype eq "Waiting" ) { - # Check if hold is for a linked account - my $is_linked_account = 0; - if ( C4::Context->preference('EnablePatronAccountLinking') - && C4::Context->preference('AllowLinkedAccountHoldPickup') ) - { - my $linked_ids = $patron->all_linked_borrowernumbers; - $is_linked_account = grep { $_ == $resbor } @$linked_ids; - } + # Check if hold is for a linked account + my $is_linked_account = 0; + if ( C4::Context->preference('EnablePatronAccountLinking') + && C4::Context->preference('AllowLinkedAccountHoldPickup') ) + { + my $linked_ids = $patron->all_linked_borrowernumbers; + $is_linked_account = grep { $_ == $resbor } @$linked_ids; + } - if ($is_linked_account) { + if ($is_linked_account) { - # Hold is for a linked account - allow pickup with redirect - $alerts{LINKED_ACCOUNT_HOLD_PICKUP} = { - reserve_id => $res->{reserve_id}, - hold_patron_id => $resbor, - hold_patron => $hold_patron, - }; - } else { + # Hold is for a linked account - allow checkout with redirect + $alerts{LINKED_ACCOUNT_HOLD_PICKUP} = { + reserve_id => $res->{reserve_id}, + hold_patron_id => $resbor, + hold_patron => $hold_patron, + }; + } elsif ( $restype eq "Waiting" ) { - # The item is on reserve and waiting, but has been - # reserved by some other patron. - $needsconfirmation{RESERVE_WAITING} = 1; - $needsconfirmation{'resfirstname'} = $hold_patron->firstname; - $needsconfirmation{'ressurname'} = $hold_patron->surname; - $needsconfirmation{'rescardnumber'} = $hold_patron->cardnumber; - $needsconfirmation{'resborrowernumber'} = $hold_patron->borrowernumber; - $needsconfirmation{'resbranchcode'} = $res->{branchcode}; - $needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'}; - $needsconfirmation{'reserve_id'} = $res->{reserve_id}; - } + # The item is on reserve and waiting, but has been + # reserved by some other patron. + $needsconfirmation{RESERVE_WAITING} = 1; + $needsconfirmation{'resfirstname'} = $hold_patron->firstname; + $needsconfirmation{'ressurname'} = $hold_patron->surname; + $needsconfirmation{'rescardnumber'} = $hold_patron->cardnumber; + $needsconfirmation{'resborrowernumber'} = $hold_patron->borrowernumber; + $needsconfirmation{'resbranchcode'} = $res->{branchcode}; + $needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'}; + $needsconfirmation{'reserve_id'} = $res->{reserve_id}; } elsif ( $restype eq "Reserved" ) { # The item is on reserve for someone else. @@ -3381,7 +3379,7 @@ sub CanBookBeRenewed { unless CanItemBeReserved( $patron_with_reserve, $other_item, undef, { ignore_hold_counts => 1 } - )->{status} eq 'OK'; + )->{status} eq 'OK'; # NOTE: At checkin we call 'CheckReserves' which checks hold 'policy' # CanItemBeReserved checks 'rules' and 'policies' which means -- 2.39.5