diff --git a/code/web/Drivers/Koha.php b/code/web/Drivers/Koha.php index 92a4e51902..6886add4ec 100644 --- a/code/web/Drivers/Koha.php +++ b/code/web/Drivers/Koha.php @@ -539,12 +539,17 @@ public function getCheckouts(User $patron): array { $circulationRulesForCheckout = []; /** @noinspection SqlResolve */ /** @noinspection SqlDialectInspection */ - $circulationRulesSql = "SELECT * FROM circulation_rules where (categorycode IN ('$patronType', '*') OR categorycode IS NULL) and (itemtype IN('$itemType', '*') OR itemtype is null) and (branchcode IN ('$checkoutBranch', '*') OR branchcode IS NULL) order by branchcode desc, categorycode desc, itemtype desc"; + $circulationRulesSql = " + SELECT * FROM circulation_rules + WHERE (categorycode IN ('$patronType', '*') OR categorycode IS NULL) + AND (itemtype IN('$itemType', '*') OR itemtype is null) + AND (branchcode IN ('$checkoutBranch', '*') OR branchcode IS NULL) + ORDER BY branchcode desc, categorycode desc, itemtype desc LIMIT 1 + "; $circulationRulesRS = mysqli_query($this->dbConnection, $circulationRulesSql); if ($circulationRulesRS !== false) { - while ($circulationRulesRow = $circulationRulesRS->fetch_assoc()) { - $circulationRulesForCheckout[] = $circulationRulesRow; - } + $circulationRulesRow = $circulationRulesRS->fetch_assoc(); + $circulationRulesForCheckout[] = $circulationRulesRow; $circulationRulesRS->close(); } $timer->logTime("Load circulation rules for checkout"); diff --git a/code/web/release_notes/24.09.00.MD b/code/web/release_notes/24.09.00.MD index 78591c86f7..77d81a8a9e 100644 --- a/code/web/release_notes/24.09.00.MD +++ b/code/web/release_notes/24.09.00.MD @@ -132,6 +132,7 @@ - Remove superfluous loop in Koha driver function updateHomeLibrary #1968 (*KMH*) - Hide empty item groups for volume-level holds in Koha (*KMH*) - Remove old pre-production Koha volumes code (*KMH*) +- Fix query to select circulation rules for Koha (*KMH*) ### GitHub Actions - Add GitHub Actions to check pull requests for release notes (*KMH*)