Merge branch 'master' into allow-multiple-filegrps

This commit is contained in:
Alexander Bigga 2021-03-24 11:19:16 +01:00 committed by GitHub
commit 466dcafc32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View File

@ -1175,16 +1175,21 @@ abstract class Document
$metadata['volume'] = $metadata['year']; $metadata['volume'] = $metadata['year'];
} }
if (empty($metadata['volume_sorting'][0])) { if (empty($metadata['volume_sorting'][0])) {
if (!empty($metadata['year_sorting'][0])) { // If METS @ORDER is given it is preferred over year_sorting and year.
if (!empty($metadata['mets_order'][0])) {
$metadata['volume_sorting'][0] = $metadata['mets_order'][0];
} elseif (!empty($metadata['year_sorting'][0])) {
$metadata['volume_sorting'][0] = $metadata['year_sorting'][0]; $metadata['volume_sorting'][0] = $metadata['year_sorting'][0];
} elseif (!empty($metadata['year'][0])) { } elseif (!empty($metadata['year'][0])) {
$metadata['volume_sorting'][0] = $metadata['year'][0]; $metadata['volume_sorting'][0] = $metadata['year'][0];
} }
} }
// If volume_sorting is still empty, try to use title_sorting finally (workaround for newspapers) // If volume_sorting is still empty, try to use title_sorting or METS @ORDERLABEL finally (workaround for newspapers)
if (empty($metadata['volume_sorting'][0])) { if (empty($metadata['volume_sorting'][0])) {
if (!empty($metadata['title_sorting'][0])) { if (!empty($metadata['title_sorting'][0])) {
$metadata['volume_sorting'][0] = $metadata['title_sorting'][0]; $metadata['volume_sorting'][0] = $metadata['title_sorting'][0];
} elseif (!empty($metadata['mets_orderlabel'][0])) {
$metadata['volume_sorting'][0] = $metadata['mets_orderlabel'][0];
} }
} }
} }
@ -1255,6 +1260,7 @@ abstract class Document
'collections' => $metadata['collection'], 'collections' => $metadata['collection'],
'mets_label' => $metadata['mets_label'][0], 'mets_label' => $metadata['mets_label'][0],
'mets_orderlabel' => $metadata['mets_orderlabel'][0], 'mets_orderlabel' => $metadata['mets_orderlabel'][0],
'mets_order' => $metadata['mets_order'][0],
'owner' => $metadata['owner'][0], 'owner' => $metadata['owner'][0],
'solrcore' => $core, 'solrcore' => $core,
'status' => 0, 'status' => 0,

View File

@ -131,6 +131,7 @@ final class MetsDocument extends Document
{ {
$details = $this->getLogicalStructure($id); $details = $this->getLogicalStructure($id);
if (!empty($details)) { if (!empty($details)) {
$metadata['mets_order'][0] = $details['order'];
$metadata['mets_label'][0] = $details['label']; $metadata['mets_label'][0] = $details['label'];
$metadata['mets_orderlabel'][0] = $details['orderlabel']; $metadata['mets_orderlabel'][0] = $details['orderlabel'];
} }

View File

@ -403,7 +403,8 @@ class Collection extends \Kitodo\Dlf\Common\AbstractPlugin
'p' => [] 'p' => []
]; ];
} else { } else {
$subparts[$resArray['partof']][$resArray['volume_sorting']] = [ // volume_sorting should be always set - but it's not a required field. We append the uid to the array key to make it always unique.
$subparts[$resArray['partof']][$resArray['volume_sorting'] . str_pad($resArray['uid'], 9, '0', STR_PAD_LEFT)] = [
'u' => $resArray['uid'], 'u' => $resArray['uid'],
'h' => '', 'h' => '',
's' => $sorting, 's' => $sorting,