From 1d531fd15a7d57acf5802b2f8539effeaf265522 Mon Sep 17 00:00:00 2001 From: Frank Morgner <morgnerf@ub.uni-leipzig.de> Date: Tue, 6 Feb 2018 11:17:46 +0100 Subject: [PATCH] refs #12318 * bugfixing finc\ILS\Driver\FincILS.php method _getFincId ** method cannot resolve main identifier (fincid) return null instead of the request identifier ** [minor] throw Exception with $query than with ambiguous $this->ilsIdentifier --- module/finc/src/finc/ILS/Driver/FincILS.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/module/finc/src/finc/ILS/Driver/FincILS.php b/module/finc/src/finc/ILS/Driver/FincILS.php index 8b309faadcd..98225885485 100644 --- a/module/finc/src/finc/ILS/Driver/FincILS.php +++ b/module/finc/src/finc/ILS/Driver/FincILS.php @@ -1518,19 +1518,25 @@ class FincILS extends PAIA implements LoggerAwareInterface try { // todo: compatible implementation for any SearchBackend (currently Solr only) $query = $ilsIdentifier . ':' . $ilsId; - $result = $this->searchService->search('Solr', new Query($query)); + $result = $this->searchService->search( + 'Solr', + new Query($query) + ); if (count($result) === 0) { throw new \Exception( - 'Problem retrieving finc id for record with ' - . $this->ilsIdentifier . ":" . $ilsId + 'Problem retrieving finc id for record with ' . $query ); } return current($result->getRecords())->getUniqueId(); } catch (\Exception $e) { $this->debug($e); - return $ilsId; + // refs #12318 return null if no main identifier can delivered + return null; } } + // todo: check if return $ilsId is reasonable in context. + // return will be only processed if $ilsIdentifier is defined as + // 'default'. therefore method hasn't been called properly. return $ilsId; } @@ -1549,14 +1555,14 @@ class FincILS extends PAIA implements LoggerAwareInterface $this->baseUrl, $daiaMatches ); - $this->httpService->get($daiaMatches[1], [], $this->ilsTestTimeout ); + $this->httpService->get($daiaMatches[1], [], $this->ilsTestTimeout); // test PAIA service preg_match( "/^(http[s:\/0-9\.]*(:[0-9]*)?\/[a-z]*)/", $this->paiaURL, $paiaMatches ); - $this->httpService->get($paiaMatches[1], [], $this->ilsTestTimeout ); + $this->httpService->get($paiaMatches[1], [], $this->ilsTestTimeout); // test succeeded, save state $this->isOnline = true; -- GitLab