diff --git a/module/VuFind/src/VuFind/Controller/MyResearchController.php b/module/VuFind/src/VuFind/Controller/MyResearchController.php index 497ddda21b9c28fe44824e93f46eae3481268dc2..5bc0556e7b96f7ad96e61ee014479a94c7dd9ebb 100644 --- a/module/VuFind/src/VuFind/Controller/MyResearchController.php +++ b/module/VuFind/src/VuFind/Controller/MyResearchController.php @@ -740,6 +740,7 @@ class MyResearchController extends AbstractBase $record->setRawData( array('id' => isset($current['id']) ? $current['id'] : null) ); + $record->setResourceSource('VuFind'); } $record->setExtraDetail('ils_details', $current); return $record; diff --git a/module/VuFind/src/VuFind/Record/Loader.php b/module/VuFind/src/VuFind/Record/Loader.php index 15ad47620236d9af665b08e88db45472d8173cfe..853eb850161355b847e25419057842abcd1db504 100644 --- a/module/VuFind/src/VuFind/Record/Loader.php +++ b/module/VuFind/src/VuFind/Record/Loader.php @@ -136,6 +136,7 @@ class Loader implements ServiceLocatorAwareInterface ->get('RecordDriverPluginManager'); $retVal[$i] = clone($factory->get('Missing')); $retVal[$i]->setRawData($fields); + $retVal[$i]->setResourceSource($details['source']); } } diff --git a/module/VuFind/src/VuFind/RecordDriver/Missing.php b/module/VuFind/src/VuFind/RecordDriver/Missing.php index 405e59241ccd0c7a810bb634b1003f8857ca9d45..f0d2ed40ef8772342bad47662f8b2ded3a3e1fcf 100644 --- a/module/VuFind/src/VuFind/RecordDriver/Missing.php +++ b/module/VuFind/src/VuFind/RecordDriver/Missing.php @@ -48,4 +48,58 @@ class Missing extends SolrDefault $this->resourceSource = 'missing'; parent::__construct(); } + + /** + * Set the resource source of the missing record. This is a special function + * of the missing record driver and normally should NOT be attempted. + * + * @param string $source Resource source + * + * @return void + */ + public function setResourceSource($source) + { + $this->resourceSource = $source; + } + + /** + * Format the missing title. + * + * @return string + */ + public function determineMissingTitle() + { + // If available, load title from database: + $table = $this->getDbTable('Resource'); + $resource = $table + ->findResource($this->getUniqueId(), $this->getResourceSource(), false); + if (!empty($resource) && !empty($resource->title)) { + return $resource->title; + } + + // Default -- message about missing title: + return $this->translate('Title not available'); + } + + /** + * Get the short title of the record. + * + * @return string + */ + public function getShortTitle() + { + $title = parent::getShortTitle(); + return empty($title) ? $this->determineMissingTitle() : $title; + } + + /** + * Get the full title of the record. + * + * @return string + */ + public function getTitle() + { + $title = parent::getShortTitle(); + return empty($title) ? $this->determineMissingTitle() : $title; + } }