Skip to content
Snippets Groups Projects
Commit 8f7e0bd8 authored by Ere Maijala's avatar Ere Maijala Committed by Demian Katz
Browse files

Improvements to patron prefix stripping for ILL (#795)

- Made sure patron prefix is not stripped by MultiBackend::placeILLRequest even if the patron is from the same source as the bib record.
parent b47efe87
Branches
Tags
No related merge requests found
......@@ -1044,7 +1044,8 @@ class MultiBackend extends AbstractBase
if ($driver
&& $this->methodSupported($driver, 'placeILLRequest', compact($details))
) {
$details = $this->stripIdPrefixes($details, $source, ['id']);
// Patron is not stripped so that the correct library can be determined
$details = $this->stripIdPrefixes($details, $source, ['id'], ['patron']);
return $driver->placeILLRequest($details);
}
throw new ILSException('No suitable backend driver found');
......@@ -1425,12 +1426,13 @@ class MultiBackend extends AbstractBase
* array or array of arrays
* @param string $source Source code
* @param array $modifyFields Fields to be modified in the array
* @param array $ignoreFields Fields to be ignored during recursive processing
*
* @return mixed Modified array or empty/null if that input was
* empty/null
*/
protected function stripIdPrefixes($data, $source,
$modifyFields = ['id', 'cat_username']
$modifyFields = ['id', 'cat_username'], $ignoreFields = []
) {
if (!isset($data) || empty($data)) {
return $data;
......@@ -1439,6 +1441,9 @@ class MultiBackend extends AbstractBase
foreach ($array as $key => $value) {
if (is_array($value)) {
if (in_array($key, $ignoreFields)) {
continue;
}
$array[$key] = $this->stripIdPrefixes(
$value, $source, $modifyFields
);
......
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