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

refs #19733 [fid] bugfix and refactoring in \fid\Controller\MyResearchController::databasesAction

* fix problems with unset homeLibrary
parent 91c1835a
Branches
Tags
No related merge requests found
...@@ -105,7 +105,9 @@ class MyResearchController extends \VuFind\Controller\MyResearchController ...@@ -105,7 +105,9 @@ class MyResearchController extends \VuFind\Controller\MyResearchController
try { try {
$library = $this->getHomeLibrary($patron); $library = $this->getHomeLibrary($patron);
$view->homeLibrary = $library->getDbis(); if (!is_null($library)) {
$view->homeLibrary = $library->getDbis();
}
$view->map_bibid_to_dbis = false; $view->map_bibid_to_dbis = false;
} catch (ClientException $exception) { } catch (ClientException $exception) {
// TODO: Implement logging (in database?) // TODO: Implement logging (in database?)
...@@ -159,14 +161,14 @@ class MyResearchController extends \VuFind\Controller\MyResearchController ...@@ -159,14 +161,14 @@ class MyResearchController extends \VuFind\Controller\MyResearchController
protected function getHomeLibrary($patron): ?Library protected function getHomeLibrary($patron): ?Library
{ {
if (is_a($patron['user'], 'fid\Service\DataTransferObject\User') if (is_a($patron['user'], 'fid\Service\DataTransferObject\User')
&& $patron['user']->getHomeLibrary()) && $homeLibrary = $patron['user']->getHomeLibrary())
{ {
if (isset($patron['libs'][$patron['user']->getHomeLibrary()])) { if (isset($patron['libs'][$homeLibrary])) {
return $patron['libs'][$patron['user']->getHomeLibrary()]; return $patron['libs'][$homeLibrary];
} }
/* no home library found in patron object? => fetch library from api directly */ /* no home library found in patron object? => fetch library from api directly */
return $this->fidClient->requestLibraryById($patron['user']->getHomeLibrary()); return $this->fidClient->requestLibraryById($homeLibrary);
} }
return null; return null;
......
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