From c3c4a9e8f23db70746ec8d6d7cd6987247a6c3cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Lahmann?= <lahmann@ub.uni-leipzig.de> Date: Thu, 4 Feb 2021 17:06:55 +0100 Subject: [PATCH] refs #18382 [finc] moved some code from HMT getCustomData to finc getCustomData * add pickuplocations instead of overwrite each one with newly found ones * fixed impossible condition edited: empty() instead of count() == 0, Dorian Merz <merz@ub.uni-leipzig.de> --- module/finc/src/finc/ILS/Driver/FincLibero.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/module/finc/src/finc/ILS/Driver/FincLibero.php b/module/finc/src/finc/ILS/Driver/FincLibero.php index 3448b5bb62a..47858569991 100644 --- a/module/finc/src/finc/ILS/Driver/FincLibero.php +++ b/module/finc/src/finc/ILS/Driver/FincLibero.php @@ -384,6 +384,7 @@ class FincLibero extends FincILS implements TranslatorAwareInterface protected function getCustomData($item) { $customData = []; + $customData['pickUpLocations'] = []; foreach (['available', 'unavailable'] as $availability) { if (isset($item[$availability])) { foreach ($item[$availability] as $available) { @@ -398,17 +399,20 @@ class FincLibero extends FincILS implements TranslatorAwareInterface ) { // if we have limitations qualifying for pickUpLocations, // save those in customData - $customData['pickUpLocations'] = $pickUpLocations; - } elseif (!isset($customData['pickUpLocations']) && isset($item['department'])) { + $customData['pickUpLocations'] = array_merge( + $customData['pickUpLocations'], + $pickUpLocations + ); + } elseif (empty($customData['pickUpLocations']) && isset($item['department'])) { // if we have no explicit limitations qualifying for // pickUpLocations, assume the item's department as single // pickUpLocation - $customData['pickUpLocations'] = [ + $customData['pickUpLocations'] = array_merge($customData['pickUpLocations'], [ [ 'locationID' => $item['department']['id'], 'locationDisplay' => $item['department']['content'] ] - ]; + ]); } // deal with EmailHold information if (isset($available['limitation'])) { -- GitLab