diff --git a/local/config/vufind/FincILS.ini b/local/config/vufind/FincILS.ini index 3d869dcbcb86e30b6e3ae5b48a51e02bcbc87b42..ac4fc97621ee5a87639e641f0c4fff6b93b3a4a5 100644 --- a/local/config/vufind/FincILS.ini +++ b/local/config/vufind/FincILS.ini @@ -12,14 +12,12 @@ ;FincILS configuration ; refer to ticket #4499 for further info on configuring it ;ilsIdentifier = "default" -;ISIL = "ISIL" ; config-examples: ; DE-15 ; baseUrl = http://data.ub.uni-leipzig.de/item/DE-15/barcode/ ; ilsIdentifier = "barcode" -; ISIL = "DE-15" ; DE-Gla 1 ; baseUrl = http://139.18.19.238:8080/DaiaThecaMssql/rs/DE-Gla%201/daia/ diff --git a/module/finc/src/finc/ILS/Driver/DAIA.php b/module/finc/src/finc/ILS/Driver/DAIA.php index bc1506f78b88f2ea64ea84a19f13ef688eee73e2..54bccd83b114122f3a7bc15b15b2a325ab6151cb 100644 --- a/module/finc/src/finc/ILS/Driver/DAIA.php +++ b/module/finc/src/finc/ILS/Driver/DAIA.php @@ -865,26 +865,33 @@ class DAIA extends \VuFind\ILS\Driver\AbstractBase implements HttpServiceAwareIn protected function calculateStatus($item) { $availability = false; - $status = null; + $status = ''; // status cannot be null as this will crash the translator $duedate = null; if (array_key_exists("available", $item)) { // check if item is loanable or presentation foreach ($item["available"] as $available) { - if ($available["service"] == "loan") { - $availability = true; - } - if ($available["service"] == "presentation") { - $availability = true; + // attribute service can be set once or not + if (isset($available["service"])) { + if ($available["service"] == "loan") { + $availability = true; + } + if ($available["service"] == "presentation") { + $availability = true; + } } } } if (array_key_exists("unavailable", $item)) { foreach ($item["unavailable"] as $unavailable) { - if ($unavailable["service"] == "loan") { - if (isset($unavailable["expected"])) { - $duedate = $unavailable["expected"]; + // attribute service can be set once or not + if (isset($unavailable["service"])) { + if ($unavailable["service"] == "loan") { + $status = "dummy text"; } - $status = "dummy text"; + } + // attribute expected is mandatory for unavailable element + if (isset($unavailable["expected"])) { + $duedate = $unavailable["expected"]; } } } diff --git a/module/finc/src/finc/ILS/Driver/Factory.php b/module/finc/src/finc/ILS/Driver/Factory.php index 5386b9131f514e6b8e3abc4dfe71e93c8610fd8a..a9c36c434de7fda4ca3382138df3bf943b8f7f15 100644 --- a/module/finc/src/finc/ILS/Driver/Factory.php +++ b/module/finc/src/finc/ILS/Driver/Factory.php @@ -49,7 +49,10 @@ class Factory */ public static function getFincILS(ServiceManager $sm) { - return new FincILS($sm->getServiceLocator()->get('VuFind\RecordLoader')); + return new FincILS( + $sm->getServiceLocator()->get('VuFind\RecordLoader'), + $sm->getServiceLocator()->get('VuFind\Config')->get('config') + ); } } \ No newline at end of file diff --git a/module/finc/src/finc/ILS/Driver/FincILS.php b/module/finc/src/finc/ILS/Driver/FincILS.php index 397a27725d20c5dc4f9e06055c4a669ac66f954b..3ebcad7948fab308b77c917d4c48868dc36bcd62 100644 --- a/module/finc/src/finc/ILS/Driver/FincILS.php +++ b/module/finc/src/finc/ILS/Driver/FincILS.php @@ -69,14 +69,24 @@ class FincILS extends PAIA implements \Zend\Log\LoggerAwareInterface */ protected $recordLoader; + /** + * Main Config + * + * @var null|\Zend\Config\Config + */ + protected $mainConfig; + /** * Constructor * - * @param \VuFind\Record\Loader $loader Record loader + * @param \VuFind\Record\Loader $loader Record loader + * @param \Zend\Config\Config $mainConfig VuFind main configuration (omit for + * built-in defaults) */ - public function __construct(\VuFind\Record\Loader $loader) + public function __construct(\VuFind\Record\Loader $loader, $mainConfig = null) { $this->recordLoader = $loader; + $this->mainConfig = $mainConfig; } /** @@ -108,13 +118,11 @@ class FincILS extends PAIA implements \Zend\Log\LoggerAwareInterface // get ISIL from config if ILS-specific recordId is barcode for // interaction with ILS - - // get the ILS-specific identifier - if (!isset($this->config['Global']['ISIL'])) { - $this->debug("No ISIL for ILS-driver configured."); + if (!isset($this->mainConfig['InstitutionInfo']['isil'])) { + $this->debug("No ISIL defined in section InstitutionInfo in config.ini."); $this->isil = ''; } else { - $this->isil = $this->config['Global']['ISIL']; + $this->isil = $this->mainConfig['InstitutionInfo']['isil']; } } else { // set the ILS-specific recordId for interaction with ILS @@ -131,13 +139,11 @@ class FincILS extends PAIA implements \Zend\Log\LoggerAwareInterface // get ISIL from config if ILS-specific recordId is barcode for // interaction with ILS - - // get the ILS-specific identifier - if (!isset($this->config['DAIA']['ISIL'])) { - $this->debug("No ISIL for ILS-driver configured."); + if (!isset($this->mainConfig['InstitutionInfo']['isil'])) { + $this->debug("No ISIL defined in section InstitutionInfo in config.ini."); $this->isil = ''; } else { - $this->isil = $this->config['DAIA']['ISIL']; + $this->isil = $this->mainConfig['InstitutionInfo']['isil']; } } }