The Gitlab instance will be restarted on Monday April 28th at 2AM. There will be a short interruption of service.

Skip to content
Snippets Groups Projects
Commit bf160aa1 authored by André Lahmann's avatar André Lahmann
Browse files

* updating DAIA driver to latest version of...

* updating DAIA driver to latest version of finc/paia-driver->lahmann/paia-driver with proper date conversion support
parent 84cae7ce
No related merge requests found
......@@ -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' => [
......
......@@ -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
......@@ -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
......@@ -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;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment