From 3f43a19fe2afcbe36390639780047088e3718ff7 Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Thu, 4 May 2023 11:35:09 +0200 Subject: [PATCH 1/3] Insert order and volume data to the database --- Classes/Command/BaseCommand.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/Command/BaseCommand.php b/Classes/Command/BaseCommand.php index 980b7cf12..29591fc7c 100644 --- a/Classes/Command/BaseCommand.php +++ b/Classes/Command/BaseCommand.php @@ -196,7 +196,7 @@ protected function saveToDatabase(Document $document) $document->setAuthor(implode('; ', $metadata['author'])); $document->setThumbnail($doc->thumbnail ? : ''); $document->setMetsLabel($metadata['mets_label'][0] ? : ''); - $document->setMetsOrderlabel($metadata['mets_orderlabel'][0] ? : ''); + $document->setMetsOrderlabel($metadata['mets_orderlabel'][0] ? : $metadata['mets_order'][0] ? : ''); $structure = $this->structureRepository->findOneByIndexName($metadata['type'][0], 'tx_dlf_structures'); $document->setStructure($structure); @@ -258,9 +258,9 @@ protected function saveToDatabase(Document $document) } } - // to be still (re-) implemented - // 'volume' => $metadata['volume'][0], - // 'volume_sorting' => $metadata['volume_sorting'][0], + // set volume data + $document->setVolume($metadata['volume'][0] ? : ''); + $document->setVolume_Sorting($metadata['volume_sorting'][0] ? : ''); // Get UID of parent document. if ($document->getDocumentFormat() === 'METS') { From b0379256f30017b96dd9ed5b6de76e74c17544e2 Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Thu, 4 May 2023 11:36:23 +0200 Subject: [PATCH 2/3] Remove success variable from saveToDatabase --- Classes/Command/BaseCommand.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Classes/Command/BaseCommand.php b/Classes/Command/BaseCommand.php index 29591fc7c..5b97339f3 100644 --- a/Classes/Command/BaseCommand.php +++ b/Classes/Command/BaseCommand.php @@ -172,11 +172,9 @@ protected function getSolrCores(int $pageId): array */ protected function saveToDatabase(Document $document) { - $success = false; - $doc = $document->getDoc(); if ($doc === null) { - return $success; + return false; } $doc->cPid = $this->storagePid; @@ -260,7 +258,7 @@ protected function saveToDatabase(Document $document) // set volume data $document->setVolume($metadata['volume'][0] ? : ''); - $document->setVolume_Sorting($metadata['volume_sorting'][0] ? : ''); + $document->setVolumeSorting($metadata['volume_sorting'][0] ? : ''); // Get UID of parent document. if ($document->getDocumentFormat() === 'METS') { @@ -278,9 +276,7 @@ protected function saveToDatabase(Document $document) $persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class); $persistenceManager->persistAll(); - $success = true; - - return $success; + return true; } /** From f3e029f56186da0dba5f6e55b45123ee623697c7 Mon Sep 17 00:00:00 2001 From: Beatrycze Volk Date: Thu, 4 May 2023 14:51:19 +0200 Subject: [PATCH 3/3] Display correct title for volumes in ToC Plugin --- Classes/Controller/TableOfContentsController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Classes/Controller/TableOfContentsController.php b/Classes/Controller/TableOfContentsController.php index f0d7e554b..9ad3cf7a4 100644 --- a/Classes/Controller/TableOfContentsController.php +++ b/Classes/Controller/TableOfContentsController.php @@ -141,6 +141,10 @@ protected function getMenuEntry(array $entry, $recursive = false) $entryArray['_OVERRIDE_HREF'] = ''; $entryArray['doNotLinkIt'] = 1; $entryArray['ITEM_STATE'] = 'NO'; + + if ($entry['type'] == 'volume') { + $entryArray['title'] = $this->getTranslatedType($entry['type']) . ' ' . $entry['volume']; + } // Build menu links based on the $entry['points'] array. if ( !empty($entry['points']) @@ -251,7 +255,6 @@ private function getTranslatedType($type) { /** * Sort menu by orderlabel - currently implemented for newspaper. - * //TODO: add for years * * @param array &$menu * @return void