diff --git a/module/Finna/src/Finna/ILS/Driver/Alma.php b/module/Finna/src/Finna/ILS/Driver/Alma.php index 82c319c95cc..7aa78fe4ee7 100644 --- a/module/Finna/src/Finna/ILS/Driver/Alma.php +++ b/module/Finna/src/Finna/ILS/Driver/Alma.php @@ -2031,10 +2031,11 @@ public function getHolding($id, $patron = null, array $options = []) $this->config['Holdings']['externalInterfaceUrl'] ?? '' ); $summary = [ + 'id' => $id, 'available' => $items['available'], 'total' => $items['total'], 'availability' => null, - 'callnumber' => null, + 'callnumber' => '', 'location' => '__HOLDINGSSUMMARYLOCATION__', 'externalInterfaceUrl' => $externalInterfaceUrl, ]; @@ -2160,11 +2161,12 @@ public function getHolding($id, $patron = null, array $options = []) // Add summary $summary = [ + 'id' => $id, 'available' => $totalAvailable, 'total' => $total, 'locations' => count($locations), 'availability' => null, - 'callnumber' => null, + 'callnumber' => '', 'location' => '__HOLDINGSSUMMARYLOCATION__', ]; if ($displayRequests) { @@ -2841,12 +2843,13 @@ protected function getStatusesForInventoryTypes($ids, $types) // we need to add a few dummy-fields that VuFind expects to be // defined for all elements. $summary = [ + 'id' => (string)$bib->mms_id, 'available' => $itemsAvailable, 'total' => $itemsTotal, 'ordered' => $itemsOrdered, 'locations' => count(array_unique(array_column($status, 'location'))), 'availability' => null, - 'callnumber' => null, + 'callnumber' => '', 'location' => '__HOLDINGSSUMMARYLOCATION__', 'externalInterfaceUrl' => $externalInterfaceUrl, ]; diff --git a/module/Finna/src/Finna/ILS/Driver/AxiellWebServices.php b/module/Finna/src/Finna/ILS/Driver/AxiellWebServices.php index 290e8467b93..7c6220d474f 100644 --- a/module/Finna/src/Finna/ILS/Driver/AxiellWebServices.php +++ b/module/Finna/src/Finna/ILS/Driver/AxiellWebServices.php @@ -198,14 +198,14 @@ class AxiellWebServices extends \VuFind\ILS\Driver\AbstractBase implements /** * Institution settings for the order of organisations * - * @var string + * @var array */ protected $holdingsOrganisationOrder; /** * Institution settings for the order of branches * - * @var string + * @var array */ protected $holdingsBranchOrder; @@ -1108,7 +1108,7 @@ public function getHolding($id, array $patron = null, array $options = []) if (!empty($result)) { usort($result, [$this, 'holdingsSortFunction']); - $summary = $this->getHoldingsSummary($result); + $summary = $this->getHoldingsSummary($result, $id); $result[] = $summary; } @@ -1273,11 +1273,12 @@ protected function parseHoldings($organisationHoldings, $id, $journalInfo = null /** * Return summary of holdings items. * - * @param array $holdings Parsed holdings items + * @param array $holdings Parsed holdings items + * @param string $id Record id * * @return array summary */ - protected function getHoldingsSummary($holdings) + protected function getHoldingsSummary($holdings, $id) { $holdable = false; $journal = isset($holdings[0]['journalInfo']); @@ -1315,15 +1316,16 @@ protected function getHoldingsSummary($holdings) // we need to add a few dummy-fields that VuFind expects to be // defined for all elements. return [ - 'available' => $availableTotal, - 'ordered' => $orderedTotal, - 'total' => $itemsTotal - $orderedTotal, - 'reservations' => $reservationsTotal, - 'locations' => count($locations), - 'holdable' => $holdable, - 'availability' => null, - 'callnumber' => '', - 'location' => '__HOLDINGSSUMMARYLOCATION__', + 'id' => $id, + 'available' => $availableTotal, + 'ordered' => $orderedTotal, + 'total' => $itemsTotal - $orderedTotal, + 'reservations' => $reservationsTotal, + 'locations' => count($locations), + 'holdable' => $holdable, + 'availability' => null, + 'callnumber' => '', + 'location' => '__HOLDINGSSUMMARYLOCATION__', ]; } diff --git a/module/Finna/src/Finna/ILS/Driver/Demo.php b/module/Finna/src/Finna/ILS/Driver/Demo.php index a801ac8d4c6..25f88c13fdc 100644 --- a/module/Finna/src/Finna/ILS/Driver/Demo.php +++ b/module/Finna/src/Finna/ILS/Driver/Demo.php @@ -109,7 +109,7 @@ public function getStatus($id) { $result = parent::getStatus($id); if (!empty($result)) { - $result[] = $this->getHoldingsSummary($result); + $result[] = $this->getHoldingsSummary($result, $id); } return $result; } @@ -132,7 +132,7 @@ public function getHolding($id, array $patron = null, array $options = []) { $result = parent::getHolding($id, $patron, $options); if (!empty($result['holdings'])) { - $result['holdings'][] = $this->getHoldingsSummary($result['holdings']); + $result['holdings'][] = $this->getHoldingsSummary($result['holdings'], $id); } return $result; } @@ -484,11 +484,12 @@ protected function pickUpLocationIsValid($pickUpLocation, $patron, $holdDetails) /** * Return summary of holdings items. * - * @param array $holdings Parsed holdings items + * @param array $holdings Parsed holdings items + * @param string $id Record id * * @return array summary */ - protected function getHoldingsSummary($holdings) + protected function getHoldingsSummary($holdings, $id) { $availableTotal = $itemsTotal = 0; $requests = 0; @@ -512,14 +513,15 @@ protected function getHoldingsSummary($holdings) // Use a stupid location name to make sure this doesn't get mixed with // real items that don't have a proper location. $result = [ - 'available' => $availableTotal, - 'total' => $itemsTotal, - 'locations' => count($locations), - 'availability' => null, - 'callnumber' => null, - 'location' => '__HOLDINGSSUMMARYLOCATION__', - 'reservations' => rand(0, 8), - 'ordered' => rand(0, 20), + 'id' => $id, + 'available' => $availableTotal, + 'total' => $itemsTotal, + 'locations' => count($locations), + 'availability' => null, + 'callnumber' => '', + 'location' => '__HOLDINGSSUMMARYLOCATION__', + 'reservations' => rand(0, 8), + 'ordered' => rand(0, 20), ]; return $result; } diff --git a/module/Finna/src/Finna/ILS/Driver/KohaRest.php b/module/Finna/src/Finna/ILS/Driver/KohaRest.php index bcd116d1007..a220c54b9d1 100644 --- a/module/Finna/src/Finna/ILS/Driver/KohaRest.php +++ b/module/Finna/src/Finna/ILS/Driver/KohaRest.php @@ -1333,13 +1333,14 @@ protected function getItemStatusesForBiblio($id, $patron = null, $brief = false) // Add summary $summary = [ - 'available' => $availableTotal, - 'total' => $itemsTotal, - 'ordered' => $orderedTotal, - 'locations' => count(array_unique(array_column($statuses, 'location'))), - 'availability' => null, - 'callnumber' => null, - 'location' => '__HOLDINGSSUMMARYLOCATION__', + 'id' => $id, + 'available' => $availableTotal, + 'total' => $itemsTotal, + 'ordered' => $orderedTotal, + 'locations' => count(array_unique(array_column($statuses, 'location'))), + 'availability' => null, + 'callnumber' => '', + 'location' => '__HOLDINGSSUMMARYLOCATION__', ]; if (!empty($this->config['Holdings']['display_total_hold_count'])) { $summary['reservations'] = $requestsTotal; diff --git a/module/Finna/src/Finna/ILS/Driver/KohaRestSuomi.php b/module/Finna/src/Finna/ILS/Driver/KohaRestSuomi.php index 17d524693ad..59334d9b8f6 100644 --- a/module/Finna/src/Finna/ILS/Driver/KohaRestSuomi.php +++ b/module/Finna/src/Finna/ILS/Driver/KohaRestSuomi.php @@ -153,7 +153,7 @@ public function getHolding($id, array $patron = null, array $options = []) { $data = parent::getHolding($id, $patron); if (!empty($data['holdings'])) { - $summary = $this->getHoldingsSummary($data['holdings']); + $summary = $this->getHoldingsSummary($data['holdings'], $id); // Remove request counts before adding the summary if necessary if ( @@ -185,7 +185,7 @@ public function getStatus($id) { $data = parent::getStatus($id); if (!empty($data)) { - $summary = $this->getHoldingsSummary($data); + $summary = $this->getHoldingsSummary($data, $id); $data[] = $summary; } return $data; @@ -1078,13 +1078,14 @@ public function getPickUpLocations($patron = false, $holdDetails = null) /** * Return summary of holdings items. * - * @param array $holdings Parsed holdings items + * @param array $holdings Parsed holdings items + * @param string $id Record id * * @return array summary */ - protected function getHoldingsSummary($holdings) + protected function getHoldingsSummary($holdings, $id) { - $availableTotal = $itemsTotal = $reservationsTotal = 0; + $availableTotal = $itemsTotal = 0; $requests = 0; $locations = []; @@ -1108,12 +1109,13 @@ protected function getHoldingsSummary($holdings) // Use a stupid location name to make sure this doesn't get mixed with // real items that don't have a proper location. $result = [ - 'available' => $availableTotal, - 'total' => $itemsTotal, - 'locations' => count($locations), - 'availability' => null, - 'callnumber' => null, - 'location' => '__HOLDINGSSUMMARYLOCATION__', + 'id' => $id, + 'available' => $availableTotal, + 'total' => $itemsTotal, + 'locations' => count($locations), + 'availability' => null, + 'callnumber' => '', + 'location' => '__HOLDINGSSUMMARYLOCATION__', ]; if (!empty($this->config['Holdings']['display_total_hold_count'])) { $result['reservations'] = $requests; diff --git a/module/Finna/src/Finna/ILS/Driver/Mikromarc.php b/module/Finna/src/Finna/ILS/Driver/Mikromarc.php index 8ac235dfa2f..270cf501a1c 100644 --- a/module/Finna/src/Finna/ILS/Driver/Mikromarc.php +++ b/module/Finna/src/Finna/ILS/Driver/Mikromarc.php @@ -257,7 +257,7 @@ public function getHolding($id, array $patron = null, array $options = []) { $data = $this->getItemStatusesForBiblio($id, $patron); if (!empty($data)) { - $summary = $this->getHoldingsSummary($data); + $summary = $this->getHoldingsSummary($data, $id); $data[] = $summary; } return $data; @@ -1769,11 +1769,12 @@ protected function getItemStatusesForBiblio($id, $patron = null) /** * Return summary of holdings items. * - * @param array $holdings Parsed holdings items + * @param array $holdings Parsed holdings items + * @param string $id Record id * * @return array summary */ - protected function getHoldingsSummary($holdings) + protected function getHoldingsSummary($holdings, $id) { $holdable = false; $titleHold = true; @@ -1803,17 +1804,18 @@ protected function getHoldingsSummary($holdings) // we need to add a few dummy-fields that VuFind expects to be // defined for all elements. return [ - 'available' => $availableTotal, - 'ordered' => $orderedTotal, - 'total' => $itemsTotal, - 'reservations' => $reservationsTotal, - 'locations' => count($locations), - 'holdable' => $holdable, - 'availability' => null, - 'callnumber' => null, - 'location' => '__HOLDINGSSUMMARYLOCATION__', - 'groupBranches' => false, - 'titleHold' => $titleHold, + 'id' => $id, + 'available' => $availableTotal, + 'ordered' => $orderedTotal, + 'total' => $itemsTotal, + 'reservations' => $reservationsTotal, + 'locations' => count($locations), + 'holdable' => $holdable, + 'availability' => null, + 'callnumber' => '', + 'location' => '__HOLDINGSSUMMARYLOCATION__', + 'groupBranches' => false, + 'titleHold' => $titleHold, ]; } diff --git a/module/Finna/src/Finna/ILS/Driver/SierraRest.php b/module/Finna/src/Finna/ILS/Driver/SierraRest.php index e21d9f79c7f..ecee314be13 100644 --- a/module/Finna/src/Finna/ILS/Driver/SierraRest.php +++ b/module/Finna/src/Finna/ILS/Driver/SierraRest.php @@ -1255,12 +1255,13 @@ protected function getItemStatusesForBib(string $id, bool $checkHoldings, ?array // we need to add a few dummy-fields that VuFind expects to be // defined for all elements. $summary = [ + 'id' => $id, 'available' => $itemsAvailable, 'total' => $itemsTotal, 'ordered' => $itemsOrdered, 'locations' => count(array_unique(array_column($statuses, 'location'))), 'availability' => null, - 'callnumber' => null, + 'callnumber' => '', 'location' => '__HOLDINGSSUMMARYLOCATION__', ]; if ($this->config['Holdings']['display_total_hold_count'] ?? true) {