From 205d57a1da5adc0bb6e0061e96931949d36f08df Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 26 Jun 2025 17:08:11 -0300 Subject: [PATCH] Bug 40254: Fix error in overrides check allowing too much This patch fixes a subtle (yet naive) error making the controller not care about blocking conditions if they were more than one and the first one was overridden. To test: 1. Apply the regression tests 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/holds.t => FAIL: Tests fail! Some tests expect a 409 (denied for a conflict) but return a 201! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D --- Koha/REST/V1/Holds.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm index b6c80906e82..33c885774c8 100644 --- a/Koha/REST/V1/Holds.pm +++ b/Koha/REST/V1/Holds.pm @@ -163,7 +163,7 @@ sub add { openapi => { error => 'The supplied pickup location is not valid' } ) unless $valid_pickup_location; - my $can_place_holds = $patron->can_place_holds(); + my $can_place_holds = $patron->can_place_holds( { overrides => $overrides } ); if ( !$can_place_holds ) { my $error_code = $can_place_holds->messages->[0]->message; @@ -173,7 +173,7 @@ sub add { error => 'Hold cannot be placed. Reason: ' . $error_code, error_code => $error_code, } - ) unless $overrides->{$error_code}; + ); } my $can_hold_be_placed = -- 2.50.0