From 8f7e0bd8b01880694ffcb922f637264cfe344fe0 Mon Sep 17 00:00:00 2001 From: Ere Maijala <ere.maijala@helsinki.fi> Date: Thu, 15 Sep 2016 20:16:23 +0300 Subject: [PATCH] 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. --- module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php b/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php index f2324e6d141..ef9b5b4502d 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php +++ b/module/VuFind/src/VuFind/ILS/Driver/MultiBackend.php @@ -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 ); -- GitLab