Skip to content

Commit

Permalink
KohaRest: Fix holdings with older Koha DI plugin versions.
Browse files Browse the repository at this point in the history
Older Koha REST DI plugins don't return the item count, but it's still needed for all items to display in holdings even if paging isn't enabled.
  • Loading branch information
EreMaijala committed Aug 27, 2024
1 parent 9ecb064 commit 1092fdb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions module/VuFind/src/VuFind/ILS/Driver/KohaRest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2056,8 +2056,9 @@ protected function getItemStatusesForBiblio($id, $patron = null, array $options
return [];
}

// Return total number of results for pagination.
$results['total'] = (int)$result['data']['items_total'];
// Return total number of results for pagination (with fallback for older
// Koha DI plugin versions that don't support paging).
$results['total'] = (int)($result['data']['items_total'] ?? count($result['data']['item_availabilities']));

foreach ($result['data']['item_availabilities'] as $i => $item) {
$avail = $item['availability'];
Expand Down

0 comments on commit 1092fdb

Please sign in to comment.