diff --git a/module/finc/src/finc/RecordDriver/SolrDefaultFincTrait.php b/module/finc/src/finc/RecordDriver/SolrDefaultFincTrait.php index 1b092ad429daaf73f63aba4566aa16935cb0b617..bb2686bef5888d19edcdd39f6c271401af633c6e 100644 --- a/module/finc/src/finc/RecordDriver/SolrDefaultFincTrait.php +++ b/module/finc/src/finc/RecordDriver/SolrDefaultFincTrait.php @@ -530,6 +530,33 @@ trait SolrDefaultFincTrait return 'noOrigName'; } + /** + * Get an array of publication details + * + * @return array of multi-value strings or as fallback array of publication detail objects + * @link https://projekte.ub.uni-leipzig.de/issues/15070 refs #15070 + */ + public function getPublicationDetails() + { + // use latest multi-value field + $imprint = $this->getImprint(); + + if (!empty($imprint)) { + return $imprint; + } + + // use fallback + $imprint = parent::getPublicationDetails(); + + // sort publication object to prevent irritation by multiple locations + usort($imprint, function ($a, $b) { + return $a->getDate() > $b->getDate(); + }); + + return $imprint; + } + + /** * Get the main author of the record. * @@ -1075,13 +1102,20 @@ trait SolrDefaultFincTrait } /** - * Get a precompiled string of publication details stored in the Solr field - * imprint. + * Get publication details stored in the Solr field imprint_str_mv as an array of strings + * Or if empty use value of Solr field 'imprint' from method 'getImprint' as string * - * @return string + * @return string|array */ public function getImprint() { + if (isset($this->fields['imprint_str_mv']) && is_array($this->fields['imprint_str_mv'])) { + $imprints = array_filter($this->fields['imprint_str_mv']); + if (!empty($imprints)) { + return $imprints; + } + } + return isset($this->fields['imprint']) ? $this->fields['imprint'] : ''; } diff --git a/module/finc/src/finc/RecordDriver/SolrMarc.php b/module/finc/src/finc/RecordDriver/SolrMarc.php index 356ffc8eb9cccd4697352e2d005fe5ab20f4ba7d..6ad89476d78005fc05211295cad168aeda724bd6 100644 --- a/module/finc/src/finc/RecordDriver/SolrMarc.php +++ b/module/finc/src/finc/RecordDriver/SolrMarc.php @@ -269,17 +269,6 @@ class SolrMarc extends SolrDefault return $this->getFieldArray('500'); } - /** - * Get human readable publication dates for display purposes (may not be suitable - * for computer processing -- use getPublicationDates() for that). - * - * @return array - */ - public function getHumanReadablePublicationDates() - { - return $this->getPublicationInfo('c'); - } - /** * Get an array of newer titles for the record. * @@ -294,66 +283,6 @@ class SolrMarc extends SolrDefault return in_array('785', $fieldsNames) ? [] : parent::getNewerTitles(); } - /** - * Get the item's publication information - * - * @param string $subfield The subfield to retrieve ('a' = location, 'c' = date) - * - * @return array - */ - protected function getPublicationInfo($subfield = 'a') - { - // Get string separator for publication information: - $separator = isset($this->mainConfig->Record->marcPublicationInfoSeparator) - ? $this->mainConfig->Record->marcPublicationInfoSeparator : ' '; - - // First check old-style 260 field: - $results = $this->getFieldArray('260', [$subfield], true, $separator); - - // Now track down relevant RDA-style 264 fields; we only care about - // copyright and publication places (and ignore copyright places if - // publication places are present). This behavior is designed to be - // consistent with default SolrMarc handling of names/dates. - $pubResults = $copyResults = []; - - $fields = $this->getMarcRecord()->getFields('264'); - if (is_array($fields)) { - foreach ($fields as $currentField) { - $currentVal = $this - ->getSubfieldArray($currentField, [$subfield], true, $separator); - if (!empty($currentVal)) { - switch ($currentField->getIndicator('2')) { - case '1': - $pubResults = array_merge($pubResults, $currentVal); - break; - case '4': - $copyResults = array_merge($copyResults, $currentVal); - break; - } - } - } - } - $replace260 = isset($this->mainConfig->Record->replaceMarc260) - ? $this->mainConfig->Record->replaceMarc260 : false; - if (count($pubResults) > 0) { - return $replace260 ? $pubResults : array_merge($results, $pubResults); - } elseif (count($copyResults) > 0) { - return $replace260 ? $copyResults : array_merge($results, $copyResults); - } - - return $results; - } - - /** - * Get the item's places of publication. - * - * @return array - */ - public function getPlacesOfPublication() - { - return $this->getPublicationInfo(); - } - /** * Get an array of playing times for the record (if applicable). * diff --git a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php index 4dded0399fe42891211d19a271fdb023377ec96d..5b7e80215aed2d73f0a7282890b545b79e9eeaaa 100644 --- a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php +++ b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php @@ -529,64 +529,6 @@ trait SolrMarcFincTrait return count($array) ? array_pop($array) : ''; } - /** - * Get an array of publication detail lines with original notations combining - * information from MARC field 260 and linked content in 880. - * - * @return array - */ - public function getPublicationDetails() - { - $retval = []; - - $marcFields = ['260', '264']; - - // loop through all defined marcFields - foreach ($marcFields as $marcField) { - // now select all fields for the current marcField - if ($fields = $this->getMarcRecord()->getFields($marcField)) { - // loop through all fields of the current marcField - foreach ($fields as $i => $current) { - // Marc 264abc should only be displayed if Ind.2==1 - // Display any other Marc field if defined above - if ($marcField != '264' - || ($marcField == '264' && $current->getIndicator(2) == 1) - ) { - $place = $current->getSubfield('a') - ? $current->getSubfield('a')->getData() : null; - $name = $current->getSubfield('b') - ? $current->getSubfield('b')->getData() : null; - $date = $current->getSubfield('c') - ? $current->getSubfield('c')->getData() : null; - - // Build objects to represent each set of data; these will - // transform seamlessly into strings in the view layer. - $retval[] = new \VuFind\RecordDriver\Response\PublicationDetails( - $place, - $name, - $date - ); - - // Build the publication details with additional graphical notations - // for the current set of publication details - if ($linkedField = $this->getLinkedField($current, $i)) { - $retval[] = new \VuFind\RecordDriver\Response\PublicationDetails( - $linkedField->getSubfield('a') - ? $linkedField->getSubfield('a')->getData() : null, - $linkedField->getSubfield('b') - ? $linkedField->getSubfield('b')->getData() : null, - $linkedField->getSubfield('c') - ? $linkedField->getSubfield('c')->getData() : null - ); - } - } - } - } - } - - return $retval; - } - /** * Get an array of title detail lines with original notations combining * information from MARC field 245 and linked content in 880. diff --git a/themes/finc/templates/RecordDriver/SolrDefault/data-publicationDetails.phtml b/themes/finc/templates/RecordDriver/SolrDefault/data-publicationDetails.phtml new file mode 100644 index 0000000000000000000000000000000000000000..df299e1e5b96aa27cc2651a9838e82a4a2dc5f4d --- /dev/null +++ b/themes/finc/templates/RecordDriver/SolrDefault/data-publicationDetails.phtml @@ -0,0 +1,32 @@ +<!-- finc: RecordDriver - solrDefault - data-publicationDetails --> +<? if (!empty($data)): ?> + <div itemscope itemtype="http://schema.org/publisher"> + <? if (is_array($data) && !empty($data[0]) && $data[0] instanceof \VuFind\RecordDriver\Response\PublicationDetails): ?> + <? foreach ($data as $field): ?> + <span property="publisher" typeof="Organization"> + <? $pubPlace = $field->getPlace(); if (!empty($pubPlace)): ?> + <span property="location" typeof="Place"> + <span property="name"><?=$this->escapeHtml($pubPlace)?></span> + </span> + <? endif; ?> + <? $pubName = $field->getName(); if (!empty($pubName)): ?> + <span property="name"><?=$this->escapeHtml($pubName)?></span> + <? endif; ?> + </span> + <span property="datePublished"> + + <? $pubDate = $field->getDate(); if (!empty($pubDate)): ?> + <?=$this->escapeHtml($pubDate)?> + <? endif; ?> + </span> + <? endforeach; ?> + <? else: ?> + <? if (is_array($data)): ?> + <?= implode('<br/>', array_map(array($this, 'escapeHtml'), $data)) ?> + <? else: ?> + <?= $this->escapeHtml($data) ?> + <? endif; ?> + <? endif ?> + </div> +<? endif ?> +<!-- finc: RecordDriver - solrDefault - data-publicationDetails - END -->