diff --git a/module/finc/src/finc/Controller/RecordController.php b/module/finc/src/finc/Controller/RecordController.php index 7e3702e24fc965f7940d620fc308c59fa759020b..ee9b3d49e75883ef2668a262f5024d94a658cbd5 100644 --- a/module/finc/src/finc/Controller/RecordController.php +++ b/module/finc/src/finc/Controller/RecordController.php @@ -113,4 +113,30 @@ class RecordController extends \VuFind\Controller\RecordController implements // No followup info found? Send back to record view: return $this->redirectToRecord(); } + + /** + * Home (default) action -- forward to requested (or default) tab. + * + * @return mixed + */ + public function homeAction() + { + if ($this->params()->fromQuery('catchMissing', null)) { + try { + return parent::homeAction(); + } catch (\VuFind\Exception\RecordMissing $ex) { + $lookfor = $this->params()->fromQuery('catchMissing_lookfor',''); + if (empty($lookfor)) throw $ex; + $type = $this->params()->fromQuery('catchMissing_searchType','Allfields'); + $link = $this->redirect()->toRoute( + 'search-results', + [], + ['query' => compact('lookfor','type')] + ); + return $link; + } + } + + return parent::homeAction(); + } } diff --git a/module/finc/src/finc/View/Helper/Root/RecordLink.php b/module/finc/src/finc/View/Helper/Root/RecordLink.php index 12e27d4066fc9d9758aaf9db0483ef1545e3031c..aedb06a3acd190874e0e0c84dff7b94709791066 100644 --- a/module/finc/src/finc/View/Helper/Root/RecordLink.php +++ b/module/finc/src/finc/View/Helper/Root/RecordLink.php @@ -150,13 +150,31 @@ class RecordLink extends \VuFind\View\Helper\Root\RecordLink * * @return string */ - public function getUrl($driver) + public function getUrl( + $driver, $catchMissingLookfor = '', $catchMissingSearchType = 'AllFields' + ) { - try { - return $this->getTabUrl($driver); - } catch (RecordMissingException $exception) { - // return default result on Missing Record - // throw all other Exceptions + if (is_object($driver)) { + try { + return $this->getTabUrl($driver); + } catch (RecordMissingException $exception) { + // return default result on Missing Record + // throw all other Exceptions + } + } elseif (is_string($driver)) { + $ids = explode('|',$driver); + $id = array_shift($ids); + if ($id === 'Solr') $id = array_shift($ids); + $params['id'] = $id; + if (!empty($catchMissingLookfor)) { + $options['query'] = [ + 'catchMissing' => true, + 'catchMissing_lookfor' => $catchMissingLookfor, + 'catchMissing_searchType' => $catchMissingSearchType + ]; + } + $urlHelper = $this->getView()->plugin('url'); + return $urlHelper('record',$params,$options ?? []); } return ""; } diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/data-hierarchyParentTitle.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/data-hierarchyParentTitle.phtml index fc59049c3a471ef7e8c71d4c15009f7c394c15b1..c926289b579d9570cc206820aef55a85b6396351 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/data-hierarchyParentTitle.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/data-hierarchyParentTitle.phtml @@ -3,7 +3,7 @@ <?php $hierarchyParentId = $this->driver->tryMethod('getHierarchyParentID'); ?> <?php foreach ($data as $key => $title): ?> <?php if (isset($hierarchyParentId[$key])): ?> - <a href="<?=$this->recordLink()->getUrl($hierarchyParentId[$key]);?>"><?=$this->escapeHtml($title)?></a> + <a href="<?=$this->recordLink()->getUrl($hierarchyParentId[$key],$hierarchyParentId[$key],'ParentID');?>"><?=$this->escapeHtml($title)?></a> <?php else: ?> <?=$this->escapeHtml($title)?> <?php endif; ?> diff --git a/themes/finc/templates/RecordDriver/SolrAI/data-containerTitle.phtml b/themes/finc/templates/RecordDriver/SolrAI/data-containerTitle.phtml index f271e5a385495cb2d1c8592155256cb7ae5171b2..7e3472c48c497689765fc1fd6aa2d43caca506a7 100644 --- a/themes/finc/templates/RecordDriver/SolrAI/data-containerTitle.phtml +++ b/themes/finc/templates/RecordDriver/SolrAI/data-containerTitle.phtml @@ -10,7 +10,7 @@ // try container id as link - VuFind native behaviour if ($containerID) { - $journalLink = $this->recordLink()->getUrl("$containerSource|$containerID"); + $journalLink = $this->recordLink()->getUrl("$containerSource|$containerID",$data,'JournalTitle'); } // try to link via issn - finc adapted behaviour elseif (!empty($issns)) { $journalLink = $this->record($this->driver)->getLink('isn', $issns);