diff --git a/module/finc/config/module.config.php b/module/finc/config/module.config.php index 71a8d53f2d1c5927e954bb7ca4a8d14256df6550..514810a7924998402cb5894e65163902cbab5bd5 100644 --- a/module/finc/config/module.config.php +++ b/module/finc/config/module.config.php @@ -12,10 +12,8 @@ $config = [ 'ils_driver' => [ 'factories' => [ 'fincils' => 'finc\ILS\Driver\Factory::getFincILS', - ], - 'invokables' => [ - 'daia' => 'finc\ILS\Driver\DAIA', - 'paia' => 'finc\ILS\Driver\PAIA', + 'daia' => 'finc\ILS\Driver\Factory::getDAIA', + 'paia' => 'finc\ILS\Driver\Factory::getPAIA', ], ], 'recorddriver' => [ diff --git a/module/finc/src/finc/ILS/Driver/DAIA.php b/module/finc/src/finc/ILS/Driver/DAIA.php index 14eef2fdacf7cfe496a7f360bd984d69b7656a3d..86646f832fd4109fe2f83f0c9daa7a9c7424fc44 100644 --- a/module/finc/src/finc/ILS/Driver/DAIA.php +++ b/module/finc/src/finc/ILS/Driver/DAIA.php @@ -99,6 +99,23 @@ class DAIA extends \VuFind\ILS\Driver\AbstractBase implements "json" => "application/json", ]; + /** + * Date converter object + * + * @var \VuFind\Date\Converter + */ + protected $dateConverter; + + /** + * Constructor + * + * @param \VuFind\Date\Converter $converter Date converter + */ + public function __construct(\VuFind\Date\Converter $converter) + { + $this->dateConverter = $converter; + } + /** * Initialize the driver. * @@ -186,10 +203,6 @@ class DAIA extends \VuFind\ILS\Driver\AbstractBase implements */ public function getStatus($id) { - if ($this->checkForILSTestId($id)) { - return []; - } - // let's retrieve the DAIA document by URI try { $rawResult = $this->doHTTPRequest($this->generateURI($id)); @@ -408,22 +421,6 @@ class DAIA extends \VuFind\ILS\Driver\AbstractBase implements return rtrim($multiURI, "|"); } - /** - * Autoconfigure tests ILS with getStatus('1') - use this method if you don't - * have a record with id='1' but don't want Autoconfigure to fail on ILS test. - * - * @param string $id Record id to be tested - * - * @return bool - */ - protected function checkForILSTestId($id) - { - if ($id === '1') { - return true; - } - return false; - } - /** * Parse a DAIA document depending on its type. * @@ -707,7 +704,8 @@ class DAIA extends \VuFind\ILS\Driver\AbstractBase implements } // attribute expected is mandatory for unavailable element if (isset($unavailable["expected"])) { - $duedate = $unavailable["expected"]; + $duedate = $this->dateConverter + ->convertToDisplayDate("Y-m-d", $unavailable['expected']); } // attribute queue can be set @@ -840,5 +838,4 @@ class DAIA extends \VuFind\ILS\Driver\AbstractBase implements } } } -} - +} \ No newline at end of file diff --git a/module/finc/src/finc/ILS/Driver/Factory.php b/module/finc/src/finc/ILS/Driver/Factory.php index a9c36c434de7fda4ca3382138df3bf943b8f7f15..2c7f3bf9d6d6790b8686a50439653b336ae6b3f7 100644 --- a/module/finc/src/finc/ILS/Driver/Factory.php +++ b/module/finc/src/finc/ILS/Driver/Factory.php @@ -50,9 +50,38 @@ class Factory public static function getFincILS(ServiceManager $sm) { return new FincILS( + $sm->getServiceLocator()->get('VuFind\DateConverter'), $sm->getServiceLocator()->get('VuFind\RecordLoader'), $sm->getServiceLocator()->get('VuFind\Config')->get('config') ); } + /** + * Factory for DAIA driver. + * + * @param ServiceManager $sm Service manager. + * + * @return DAIA + */ + public static function getDAIA(ServiceManager $sm) + { + return new DAIA( + $sm->getServiceLocator()->get('VuFind\DateConverter') + ); + } + + /** + * Factory for PAIA driver. + * + * @param ServiceManager $sm Service manager. + * + * @return PAIA + */ + public static function getPAIA(ServiceManager $sm) + { + return new PAIA( + $sm->getServiceLocator()->get('VuFind\DateConverter') + ); + } + } \ 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 9d1a6879b3418ee81fcd1840ce58f3aa207cbedf..a06e9ee1360004b1dba3a110a0bae39f806200ce 100644 --- a/module/finc/src/finc/ILS/Driver/FincILS.php +++ b/module/finc/src/finc/ILS/Driver/FincILS.php @@ -70,6 +70,13 @@ class FincILS extends PAIA implements LoggerAwareInterface */ protected $recordLoader; + /** + * Date converter object + * + * @var \VuFind\Date\Converter + */ + protected $dateConverter; + /** * Main Config * @@ -80,12 +87,15 @@ class FincILS extends PAIA implements LoggerAwareInterface /** * Constructor * - * @param \VuFind\Record\Loader $loader Record loader - * @param \Zend\Config\Config $mainConfig VuFind main configuration (omit for + * @param \VuFind\Date\Converter $converter Date converter + * @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, $mainConfig = null) - { + public function __construct(\VuFind\Date\Converter $converter, + \VuFind\Record\Loader $loader, $mainConfig = null + ) { + $this->dateConverter = $converter; $this->recordLoader = $loader; $this->mainConfig = $mainConfig; }