From d4ac2671007b16fd9280f4de486543d08b9b4fd5 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Thu, 1 Nov 2018 13:42:57 -0400 Subject: [PATCH] Smarter hasHoldings method. - We should not assume ils-none means no holdings; a use case exists where a user has no real-time ILS but still encodes holding information in MARC records. - We should actually check whether getHolding returns data to determine whether holdings exist. - TODO: consider introducing a local record driver cache if performance issues are encountered (but probably not necessary). --- module/VuFind/src/VuFind/ILS/Driver/NoILS.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/module/VuFind/src/VuFind/ILS/Driver/NoILS.php b/module/VuFind/src/VuFind/ILS/Driver/NoILS.php index f707850f54f..15972e22ac0 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/NoILS.php +++ b/module/VuFind/src/VuFind/ILS/Driver/NoILS.php @@ -284,17 +284,13 @@ class NoILS extends AbstractBase implements TranslatorAwareInterface */ public function hasHoldings($id) { - // If the ILS is disabled, there will never be holdings: - if ($this->getOfflineMode() == 'ils-none') { - return false; - } - // If the ILS is offline, we should if we can look up details: $useHoldings = $this->config['settings']['useHoldings'] ?? ''; // "none" will be processed differently in the config depending // on whether it's in or out of quotes; handle both cases. - return $useHoldings != 'none' && !empty($useHoldings); + return $useHoldings != 'none' && !empty($useHoldings) + && !empty($this->getHolding($id)); } /** -- GitLab