From ec4c256ac09d278531702c6f375b1c9ee0fbb1c4 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 21 Nov 2024 14:23:19 -0100 Subject: [PATCH] Bug 38505: CanBookBeIssued preparation: Appropriate behavior when barcode is falsy Before applying this patch, apply the CanBookBeIssued preparation: tests patch and run that, Verify it fails, apply this patch. Run that same tests file again. ----- About this change ----- CanBookBeIssued wants to find one item given a barcode. If a falsy (undef, empty) barcode is supplied, UNKNOWN_BARCODE should be returned. Ensure this change does not introduce any regressions: prove t/db_dependent/Circulation* prove t/db_dependent/DecreaseLoanHighHolds.t prove t/db_dependent/rollingloans.t prove t/db_dependent/api/v1/checkouts.t prove t/db_dependent/Patron/Borrower_PrevCheckout.t Signed-off-by: R --- C4/Circulation.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index b9b66974be..80cead8a96 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -780,7 +780,7 @@ sub CanBookBeIssued { my $onsite_checkout = $params->{onsite_checkout} || 0; my $override_high_holds = $params->{override_high_holds} || 0; - my $item_object = $params->{item} + my $item_object = !$barcode ? undef : $params->{item} // Koha::Items->find( { barcode => $barcode } ); # MANDATORY CHECKS - unless item exists, nothing else matters -- 2.39.5