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

refs #18280 [finc] avoid exceptions when trying to load Record with not ID

parent 656511f0
No related merge requests found
...@@ -72,17 +72,21 @@ class FincMissing extends \VuFind\RecordDriver\Missing ...@@ -72,17 +72,21 @@ class FincMissing extends \VuFind\RecordDriver\Missing
*/ */
public function setRawData($data) public function setRawData($data)
{ {
$table = $this->getDbTable('resource'); if (isset($data['id']) && !empty($data['id'])) {
// sets create to FALSE so Resource does not try to generate a DB row on fail $table = $this->getDbTable('resource');
$resource = $table->findResource($data['id'], 'solr', FALSE); // sets create to FALSE so Resource does not try to generate a DB row on fail
if ($resource instanceof Resource) { $resource = $table->findResource($data['id'], 'solr', FALSE);
if (empty($resource->extra_metadata ?? '')) { if ($resource instanceof Resource) {
parent::setRawData($data); if (empty($resource->extra_metadata ?? '')) {
parent::setRawData($data);
} else {
$this->deserializeFromResourceTable($resource);
}
} else { } else {
$this->deserializeFromResourceTable($resource); $this->fields['id'] = $data['id'];
} }
} elseif (isset($data['id'])) { } else {
$this->fields['id'] = $data['id']; $this->fields['id'] = '';
} }
} }
......
...@@ -152,11 +152,14 @@ class RecordLink extends \VuFind\View\Helper\Root\RecordLink ...@@ -152,11 +152,14 @@ class RecordLink extends \VuFind\View\Helper\Root\RecordLink
*/ */
public function getUrl($driver) public function getUrl($driver)
{ {
try { if ($driver->getUniqueID()) {
return $this->getTabUrl($driver); try {
} return $this->getTabUrl($driver);
catch (RecordMissingException $exception) { } catch (RecordMissingException $exception) {
return ""; // return default result on Missing Record
// throw all other Exceptions
}
} }
return "";
} }
} }
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