Skip to content
Snippets Groups Projects
Commit 91d04998 authored by Robert Lange's avatar Robert Lange
Browse files

refs #22072 [finc] move hasILSData from de_l152 to fincils

* allow negative method filter, meaning, we don't query the ILS when a method with leading "!" matches
parent 51d57225
No related merge requests found
......@@ -1504,15 +1504,25 @@ class FincILS extends PAIA implements LoggerAwareInterface
protected function hasILSData($id)
{
foreach ($this->config['General']['queryIls'] as $value) {
[$methodName, $methodReturn] = explode(':', $value);
list($methodName, $methodReturn) = explode(':', $value);
// if we have one mismatch we can already stop as this record does
// not qualify for querying the ILS
if ($methodReturn === "") {
if (null !== $this->getRecord($id)->tryMethod($methodName)) {
return false;
}
} elseif (!in_array($methodReturn, (array)$this->getRecord($id)->tryMethod($methodName))) {
return false;
} elseif (strpos($methodName, '!') === 0) {
// we have a negative filter, meaning, we don't query the ILS
// if the return value matches
$methodName = substr($methodName, 1);
if (in_array($methodReturn, (array) $this->getRecord($id)->tryMethod($methodName))) {
return false;
}
} else {
// this is a positive filter i.e. the return value MUST match
if (!in_array($methodReturn, (array) $this->getRecord($id)->tryMethod($methodName))) {
return false;
}
}
}
// if we got this far the record qualifies for querying the ILS
......
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