Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Display volumes correctly in ToC plugin #957

Merged
merged 4 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions Classes/Command/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -196,7 +194,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] ? : '');
sebastian-meyer marked this conversation as resolved.
Show resolved Hide resolved

$structure = $this->structureRepository->findOneByIndexName($metadata['type'][0], 'tx_dlf_structures');
$document->setStructure($structure);
Expand Down Expand Up @@ -258,9 +256,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->setVolumeSorting($metadata['volume_sorting'][0] ? : '');

// Get UID of parent document.
if ($document->getDocumentFormat() === 'METS') {
Expand All @@ -278,9 +276,7 @@ protected function saveToDatabase(Document $document)
$persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class);
$persistenceManager->persistAll();

$success = true;

return $success;
return true;
}

/**
Expand Down
5 changes: 4 additions & 1 deletion Classes/Controller/TableOfContentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down Expand Up @@ -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
Expand Down