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

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit afd00523a3)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Tomas Cohen Arazi 2025-06-26 17:08:11 -03:00 committed by Paul Derscheid
parent 1ab7ccde18
commit 746024e2eb
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 2 additions and 2 deletions

View File

@ -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 =