Skip to content
Snippets Groups Projects
Commit 4fccb9b7 authored by Dorian Merz's avatar Dorian Merz Committed by Robert Lange
Browse files

refs #20819 [finc] refactor getMyILLRequests

* refactor ILL request handling
** adds getMyILLRequests-Method to FincILS
** introduces checkMethodILLRequests to check for the existence of adequate config
* add ILLpattern to init()
* add label filter
* from DE-15, refs #15214
* allow for more general label filters
* added documentation on config
parent f9adfb4c
No related merge requests found
......@@ -95,4 +95,11 @@ queryIls[] = 'getFacetAvail:Local'
; through user input. E.g. to select an email profile according to the selected
; pickUpLocation you have to set the value to "pickUpLocation".
; By default it is left empty using the default profile "EmailHold".
;emailProfileSelector =
;emailProfileSelector =
; the ILLRequests section contains regex patterns for inter library loan item detection
; itemPattern matches the item ID, labelPattern matches the item's label
; as used in a PAIA regex filter
;[ILLRequests]
;itemPattern = "/^(?:(?!DE-15)).*$/"
;labelPattern = "/^ILL Status String$"
\ No newline at end of file
......@@ -91,4 +91,30 @@ class Connection extends \VuFind\ILS\Connection implements TranslatorAwareInterf
}
return $response;
}
/**
* Check ILLRequests
*
* A support method for checkFunction(). This is responsible for checking
* the driver configuration to determine if the system supports ILL requests.
*
* @param array $functionConfig The ILL request configuration values
* @param array $params An array of function-specific params (or null)
*
* @return mixed On success, an associative array with specific function keys
* and values either for placing requests via a form; on failure, false.
*/
protected function checkMethodILLRequests($functionConfig, $params)
{
if (
method_exists($this, 'getMyILLRequests')
&&
isset($functionConfig['daiaILLpattern'])
) {
return ['daiaILLpattern' => $functionConfig['daiaILLpattern']];
}
return false;
}
}
......@@ -108,6 +108,22 @@ class FincILS extends PAIA implements LoggerAwareInterface
*/
protected $isil;
/**
* Regex to be used in getMyILLRequests,
* finds item IDs denoting inter library loan requests
*
* @var string
*/
protected $illItemPattern;
/**
* Regex to be used in getMyILLRequests,
* finds item labels denoting inter library loan requests
*
* @var string
*/
protected $illLabelPattern;
/**
* Connection timeout in seconds used for _testILSConnection()
*
......@@ -223,6 +239,16 @@ class FincILS extends PAIA implements LoggerAwareInterface
$this->ilsTestTimeout = isset($this->config['General'])
&& isset($this->config['General']['ilsTestTimeout'])
? $this->config['General']['ilsTestTimeout'] : 90;
// set filter for reserved item IDs at ILL request
$this->illItemPattern =
(isset($this->config['ILLRequests']['itemPattern']))
? $this->config['ILLRequests']['itemPattern'] : null;
// set filter for reserved item labels at ILL request
$this->illLabelPattern =
(isset($this->config['ILLRequests']['labelPattern']))
? $this->config['ILLRequests']['labelPattern'] : null;
}
/**
......@@ -1704,4 +1730,34 @@ class FincILS extends PAIA implements LoggerAwareInterface
// overriden in FincLibero
return $limitations;
}
/**
* Customized getMyILLRequests, relies on PAIA-URI pattern
* @param array $patron
* @return array
*/
public function getMyILLRequests($patron)
{
// filters for getMyILLRequests are:
// document.item = URI has to match config pattern
if (!empty($this->illItemPattern)) {
$filter['regex']['item'] = $this->illItemPattern;
}
if (!empty($this->illLabelPattern)) {
// filter out some item according their status label
// cf. #15214
$filter['regex']['label'] = $this->illLabelPattern;
}
if (!empty($filter)) {
// get items-docs for given filters
$items = $this->paiaGetItems($patron, $filter);
return $this->mapPaiaItems($items, 'myHoldsMapping');
}
return [];
}
}
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