From b91a4dd051db488564e8140f702ee02f36be1fe3 Mon Sep 17 00:00:00 2001 From: Dorian Merz <merz@ub.uni-leipzig.de> Date: Tue, 23 Oct 2018 10:44:10 +0200 Subject: [PATCH] refs #14176 MASTER * reverts some changes from refs #13663 * fixes problem with missing notes data in different RecordDrivers --- .../finc/src/finc/RecordDriver/SolrMarc.php | 10 +-------- .../finc/RecordDriver/SolrMarcFincTrait.php | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/module/finc/src/finc/RecordDriver/SolrMarc.php b/module/finc/src/finc/RecordDriver/SolrMarc.php index 316be68a3e4..5e39e43218d 100644 --- a/module/finc/src/finc/RecordDriver/SolrMarc.php +++ b/module/finc/src/finc/RecordDriver/SolrMarc.php @@ -261,15 +261,7 @@ class SolrMarc extends SolrDefault */ public function getGeneralNotes() { - $retval = []; - foreach ($this->getFieldArray('500') as $value) { - if (preg_match('/(.*)\.\s*$/',$value,$matches)) { - $retval[] = $matches[1]; - } else { - $retval[] = $value; - } - } - return $retval; + return $this->getFieldArray('500'); } /** diff --git a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php index b877bf3b162..3848c9a7768 100644 --- a/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php +++ b/module/finc/src/finc/RecordDriver/SolrMarcFincTrait.php @@ -1649,17 +1649,26 @@ trait SolrMarcFincTrait } foreach ($fields as $field) { if ($subfield = $field->getSubfield('a')) { - $value = $subfield->getData(); - if (preg_match('/(.*)\.\s*$/',$value,$matches)) { - $retval[] = $matches[1]; - } else { - $retval[] = $value; - } + $retval[] = $subfield->getData(); } } return $retval; } + public function getAllNotes() { + + $notes = array_merge( + (array) $this->getGeneralNotes(), + (array)$this->getAdditionalNotes() + ); + foreach ($notes as &$note) { + if (preg_match('/(.*)\.\s*$/',$note,$matches)) { + $note = $matches[1]; + } + } + return $notes; + } + /** * Marc specific implementation for retrieving hierarchy parent id(s). * Refs #8369 -- GitLab