diff --git a/module/finc/src/finc/ILS/Driver/PAIA.php b/module/finc/src/finc/ILS/Driver/PAIA.php index 6eb349d54e3b6137e2f748bb063a95cb8fe64c1f..29cb6e4ea71530d04fafcabd2b859f38d7882418 100644 --- a/module/finc/src/finc/ILS/Driver/PAIA.php +++ b/module/finc/src/finc/ILS/Driver/PAIA.php @@ -763,7 +763,7 @@ class PAIA extends \VuFind\ILS\Driver\PAIA * @param string $messageId * @return string */ - private function getPaiaNotificationsId($messageId) + protected function getPaiaNotificationsId($messageId) { if (isset($this->notificationsPrefix) && diff --git a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php index 84838f47913e106156487e6a4de4131fe8c965f8..19df2de211da423022bdb340ef487c1d33e42002 100644 --- a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php +++ b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php @@ -1520,6 +1520,7 @@ trait SolrMarcFincTrait // at least we found some identifier and text so increment $i++; } + unset($text, $label, $suffix); } } } @@ -1549,6 +1550,37 @@ trait SolrMarcFincTrait return $retval; } + /** + * Returns former title stored in Marc 247$a. + * Refs. #17129 + * + * @return array|null + */ + public function getFormerTitle() + { + $retval = []; + + $fields = $this->getMarcRecord()->getFields('247'); + + if (!$fields) { + return null; + } + foreach ($fields as $field) { + $subfieldA = $field->getSubfield('a'); + if ($subfieldA + && ($field->getIndicator('2') == 0) + ) { + $value = $subfieldA->getData(); + if ($subfieldF = $field->getSubfield('f')) { + $value = $value . ' (' . $subfieldF->getData() . ')'; + } + $retval[] = $value; + } + + } + return $retval; + } + /** * Returns all notes. * @@ -1558,6 +1590,7 @@ trait SolrMarcFincTrait { $notes = array_merge( (array)$this->getGeneralNotes(), + (array)$this->getFormerTitle(), (array)$this->getAdditionalNotes() ); foreach ($notes as &$note) { diff --git a/module/finc/src/finc/View/Helper/Root/Citation.php b/module/finc/src/finc/View/Helper/Root/Citation.php index b855634ccfec24a1afdc7291338b1d4c725fc251..9d98f00cb57b05e9fe3888a1508023a8c8a7d3b6 100644 --- a/module/finc/src/finc/View/Helper/Root/Citation.php +++ b/module/finc/src/finc/View/Helper/Root/Citation.php @@ -502,7 +502,9 @@ class Citation extends \VuFind\View\Helper\Root\Citation protected function getYear() { if (isset($this->details['pubDate'])) { - if (strlen($this->details['pubDate']) > 4) { + if ((strlen($this->details['pubDate']) > 4) + && !preg_match("/^\[\d+\]/", $this->details['pubDate']) + ) { try { return $this->dateConverter->convertFromDisplayDate( 'Y', diff --git a/module/finc/src/finc/View/Helper/Root/Record.php b/module/finc/src/finc/View/Helper/Root/Record.php index 847bec98d2cfc4e5aa69fc6e1ff5c5f5ae2c254a..63545be5c92d7a5ea7cad1748e9a83bc48de1760 100644 --- a/module/finc/src/finc/View/Helper/Root/Record.php +++ b/module/finc/src/finc/View/Helper/Root/Record.php @@ -2,7 +2,7 @@ /** * Record driver view helper * - * PHP version 5 + * PHP version 7 * * Copyright (C) Villanova University 2010. * @@ -103,27 +103,34 @@ class Record extends \VuFind\View\Helper\Root\Record /** * Render a (list of) record icons. * - * @param string $tpl Define alternative template for record icon. Default: - * record-icon.phtml + * @param string $tpl Define alternative template for record icon. Default: record-icon.phtml + * @param bool $addText Return additional access / format. Default: true * * @return string */ - public function getRecordIcon($tpl = 'record-icon') + public function getRecordIcon(string $tpl = 'record-icon', bool $addText = true): string { - return $this->renderTemplate($tpl . '.phtml'); + $iconType = $this->getRecordIconType(); + $iconClass = $this->getRecordIconClass($iconType); + return $this->renderTemplate($tpl . '.phtml', ['iconClass' => $iconClass]) + . ($addText ? $this->getRecordIconText($iconType,$iconClass) : ''); } /** * Get the CSS class used to properly render an icon for given value * - * @param string $value (identifier) Value to convert into CSS class + * @param string $value (identifier) Value to convert into CSS class. Default: null * @param string $classfile Define alternative file for icon class without * suffix. Default: record-icon-class.phtml * * @return string */ - public function getRecordIconClass($value, $classfile = 'record-icon-class') + public function getRecordIconClass(string $value = null, string $classfile = 'record-icon-class'): string { + if ($value === null) { + $value = $this->getRecordIconType(); + } + return $this->renderTemplate( $classfile . '.phtml', ['value' => $value] @@ -137,13 +144,34 @@ class Record extends \VuFind\View\Helper\Root\Record * * @return string */ - public function getRecordIconText($classfile = 'record-icon-text') + public function getRecordIconText(string $iconType = null, string $iconClass = null, $classfile = 'record-icon-text'): string { + if (null === $iconType) { + $iconType = $this->getRecordIconType(); + } + if (null === $iconClass) { + $iconClass = $this->getRecordIconClass($iconType); + } return $this->renderTemplate( - $classfile . '.phtml' + $classfile . '.phtml', compact('iconType','iconClass') ); } + function getRecordIconType() { + + /* block copied from record-icon - RL */ + $recordType = $this->driver->getRecordType(); + switch ($recordType) { + case 'lido': + return "object"; + case 'missing': + case 'marcfincpda': + return $recordType; + default: + return implode('', $this->driver->getFacetAvail()); + } + } + /** * Returns if style based icons should be shown (if covers are disabled!) * diff --git a/themes/finc/templates/Citation/apa.phtml b/themes/finc/templates/Citation/apa.phtml index 1b40871412d5660f64424006e504abf2eee26a38..cdda373c4b6f00455968615b047c68860f893fc7 100644 --- a/themes/finc/templates/Citation/apa.phtml +++ b/themes/finc/templates/Citation/apa.phtml @@ -1,5 +1,11 @@ <?php if (!empty($this->authors)): ?><?=$this->escapeHtml($this->authors)?> - <?php if (!empty($this->year)): ?><?php if (!empty($this->authors)): ?><?php endif; ?>(<?=$this->escapeHtml($this->year)?>). <?php endif; ?> + <?php if (!empty($this->year)): ?> + <?php if (!preg_match("/^\[\d+\]/", $this->year)): ?> + (<?=$this->escapeHtml($this->year)?>). + <?php else: ?> + <?=$this->escapeHtml($this->year)?>. + <?php endif; ?> + <?php endif; ?> <?php endif; ?> <i><?=$this->escapeHtml($this->title)?></i><?php if ($this->periodAfterTitle): ?>. <?php endif ?> <?php if (empty($this->authors)): ?> diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/record-icon-text.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/record-icon-text.phtml index 50bd4d1b6e9856521d913ae9a4f4fbf9a5504ad1..997f06c9234e5b470499e6b3e5a94b43f87a4786 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/record-icon-text.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/record-icon-text.phtml @@ -1,20 +1,9 @@ <!-- finc: recordDriver - DefaultRecord - record-icon-text --> -<?php - /* block copied from record-icon - RL */ - $recordType = $this->driver->getRecordType(); - if ($recordType == "marcfincpda") { - $type = $recordType; - } elseif ($recordType == "lido") { - $type = "object"; - } else { - $type = implode('', $this->driver->getFacetAvail()); - } -?> -<?php if ($iconClass = $this->record($this->driver)->getRecordIconClass($type)): ?> - <span class="access-icon hidden-print"> +<?php if ($iconClass): ?> + <div class="access-icon hidden-print"> <span> <?=$this->translate("($iconClass)")?> </span> - </span> + </div> <?php endif; ?> <!-- finc: recordDriver - DefaultRecord - record-icon-text - END --> \ No newline at end of file diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/record-icon.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/record-icon.phtml index b36f126e35c921bc00d91b93aa7b303a19c08382..bfa3afa3183bac4a2625e33bd2e732da77b67a9c 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/record-icon.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/record-icon.phtml @@ -1,18 +1,8 @@ <!-- finc: recordDriver - DefaultRecord - record-icon --> -<?php - /* finc: template is NOT identical with de_15 - RL */ - $recordType = $this->driver->getRecordType(); - if ($recordType == "marcfincpda") { - $type = $recordType; - } elseif ($recordType == "lido") { - $type = "object"; - } else { - $type = implode('', $this->driver->getFacetAvail()); - } - $iconClass = $this->record($this->driver)->getRecordIconClass($type); -?> -<span class="access-icon hidden-print"> - <i aria-hidden="true" class="fa <?=$iconClass?>"></i> - <?php /* separate access text from icon - moved to cover.phtml */ ?> -</span> +<?php if (!empty($iconClass)): ?> + <span class="access-icon hidden-print"> + <i aria-hidden="true" class="fa <?=$iconClass?>"></i> + <?php /* separate access text from icon - moved to cover.phtml */ ?> + </span> +<?php endif; ?> <!-- finc: recordDriver - DefaultRecord - record-icon - END --> \ No newline at end of file diff --git a/themes/finc/templates/RecordDriver/DefaultRecord/result-list.phtml b/themes/finc/templates/RecordDriver/DefaultRecord/result-list.phtml index 767f185304e75b2ec54d4dad17025a4275a791ac..878760060d4bcac2728a7ac5cf914eb170648406 100644 --- a/themes/finc/templates/RecordDriver/DefaultRecord/result-list.phtml +++ b/themes/finc/templates/RecordDriver/DefaultRecord/result-list.phtml @@ -18,7 +18,6 @@ if ($cover): <?php ob_start(); ?> <div class="media-<?=$thumbnailAlignment?> record-icon"> <?=$this->record($this->driver)->getRecordIcon()?> - <?=$this->record($this->driver)->getRecordIconText()?> </div> <?php $thumbnail = ob_get_contents(); ?> <?php ob_end_clean(); ?> diff --git a/themes/finc/templates/RecordDriver/SolrAI/result-list.phtml b/themes/finc/templates/RecordDriver/SolrAI/result-list.phtml index 16be9bd855b86b1155ba70f51928ecab646d9b4d..0b8dc222334495369c4a119078df6840174a8a3f 100644 --- a/themes/finc/templates/RecordDriver/SolrAI/result-list.phtml +++ b/themes/finc/templates/RecordDriver/SolrAI/result-list.phtml @@ -16,7 +16,6 @@ if ($cover): <?php ob_start(); ?> <div class="media-<?=$thumbnailAlignment?> record-icon"> <?=$this->record($this->driver)->getRecordIcon()?> - <?=$this->record($this->driver)->getRecordIconText()?> </div> <?php $thumbnail = ob_get_contents(); ?> <?php ob_end_clean(); ?> diff --git a/themes/finc/templates/record/cover.phtml b/themes/finc/templates/record/cover.phtml index ccc96247aef93c12b7ba2671726b0028e306ff52..e557d2210f79a7de886fcd9fde892f794e09b6af 100644 --- a/themes/finc/templates/record/cover.phtml +++ b/themes/finc/templates/record/cover.phtml @@ -10,7 +10,7 @@ <?php if ($this->link): ?> </a> <script> - registerCoverForModal($('#<?=$coverId?>'), '<?=$this->link?>'); + registerCoverForModal($('#<?=$coverId?>'), '<?=$cover?>'); </script> <?php endif; ?> <?php elseif ($cover === false): ?> diff --git a/themes/finc/templates/record/coverReplacement.phtml b/themes/finc/templates/record/coverReplacement.phtml index d74b4f1f8f5847b60f8da4fbe046abfddfab6438..d26b8d7bcb980e7a9d10d36e7f64b1cf126c1a32 100644 --- a/themes/finc/templates/record/coverReplacement.phtml +++ b/themes/finc/templates/record/coverReplacement.phtml @@ -1 +1 @@ -<?= $this->record($this->driver)->getRecordIcon() ?> \ No newline at end of file +<?= $this->record($this->driver)->getRecordIcon('record-icon', false) ?> \ No newline at end of file