diff --git a/module/finc/src/finc/RecordDriver/SolrDefaultFincTrait.php b/module/finc/src/finc/RecordDriver/SolrDefaultFincTrait.php index 572f5e766a1d062fa9a7f9e35caa8a1f1cdb7632..0d660f3828402ac3b1cb9658cb829e38d55c401d 100644 --- a/module/finc/src/finc/RecordDriver/SolrDefaultFincTrait.php +++ b/module/finc/src/finc/RecordDriver/SolrDefaultFincTrait.php @@ -510,6 +510,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. * @@ -1053,13 +1080,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 5e39e43218d15f466f2901929d46748244052333..3c56a463019b83cb95fb323a44ce057e20ea607a 100644 --- a/module/finc/src/finc/RecordDriver/SolrMarc.php +++ b/module/finc/src/finc/RecordDriver/SolrMarc.php @@ -264,17 +264,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. * @@ -289,66 +278,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); - } else if (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 888c7e24e64f1927a41db9bccc6a886b7b0e720c..d5d0936fd951e11041ab9ea603a9237bb70ce549 100644 --- a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php +++ b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php @@ -524,62 +524,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 index 6943a188bdd8d99daa61fd418ac41f499589bfb2..df299e1e5b96aa27cc2651a9838e82a4a2dc5f4d 100644 --- a/themes/finc/templates/RecordDriver/SolrDefault/data-publicationDetails.phtml +++ b/themes/finc/templates/RecordDriver/SolrDefault/data-publicationDetails.phtml @@ -1,27 +1,32 @@ <!-- finc: RecordDriver - solrDefault - data-publicationDetails --> <? if (!empty($data)): ?> -<div itemscope itemtype="http://schema.org/publisher"> - <? 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"> - <? /* do not show solr publish date #13993 - GG */ ?> - <? /*$pubDateSort = $this->driver->tryMethod('getPublishDateSort');*/ ?> - <? $pubDate = $field->getDate(); if (!empty($pubDate)): ?> - <?=$this->escapeHtml($pubDate)?> - <? /*else: ?> - <?=$this->escapeHtml($pubDateSort)*/?></span> - <? endif; ?> - </span><br/> - <? endforeach; ?> -</div> + <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 -->