From ed7c53f7ed0389e3b43f9eb1577139f914197cea Mon Sep 17 00:00:00 2001 From: Maccabee Levine Date: Wed, 29 Jan 2025 15:55:28 +0000 Subject: [PATCH] Define 'book' based on ProQuest data --- .../src/VuFind/RecordDriver/ProQuestFSG.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/module/VuFind/src/VuFind/RecordDriver/ProQuestFSG.php b/module/VuFind/src/VuFind/RecordDriver/ProQuestFSG.php index 4ac49a78a7e..7148a92217c 100644 --- a/module/VuFind/src/VuFind/RecordDriver/ProQuestFSG.php +++ b/module/VuFind/src/VuFind/RecordDriver/ProQuestFSG.php @@ -105,7 +105,7 @@ public function getTitle() public function getContainerTitle() { // For books, don't display any container. - if ('Book' === $this->getOpenUrlFormat()) { + if ($this->isBook()) { return ''; } return $this->getFirstFieldValue('773', ['t']); @@ -120,12 +120,23 @@ public function getContainerTitle() public function getContainerReference() { // For books, don't display any container. - if ('Book' === $this->getOpenUrlFormat()) { + if ($this->isBook()) { return ''; } return $this->getFirstFieldValue('773', ['g']); } + /** + * Try to determine if this is a book, based on ProQuest's use of MARC. + * + * @return bool + */ + protected function isBook() + { + $type = $this->getFirstFieldValue('513', ['a']); + return str_contains($type, 'Book') && !str_contains($type, 'Book Review'); + } + /** * Get the item's source. * @@ -146,7 +157,7 @@ public function getHumanReadablePublicationDates() { $dates = $this->marcGetHumanReadablePublicationDates(); // For books, we should only display the year - if ('Book' === $this->getOpenUrlFormat()) { + if ($this->isBook()) { foreach ($dates as $i => $date) { if (($pos = strpos($date, ',')) !== false) { $dates[$i] = trim(substr($date, $pos + 1));