diff --git a/config/vufind/config.ini b/config/vufind/config.ini index 9779d2d51306182fbcfe7e34f013361660b4253d..57e421ad64bb4c1f990d96bd760a42c0796c338d 100644 --- a/config/vufind/config.ini +++ b/config/vufind/config.ini @@ -1719,6 +1719,15 @@ jump_to_single_search_result = false ; punctuation, but this can be used when ISBD punctuation is absent (e.g. ", "). ;marcPublicationInfoSeparator = " " +; If you have a custom index, you might want to change the field where the full +; MARC record is supposed to be. The field will be checked and ignored, if it is +; not a valid index field or does not exist in the record or index schema. +; If you have multiple fields with MARC content, you may add all of them +; by using a comma sepated list. The first field is the preferred one, if it does not +; exist, the next ones are taken. +; (Default = "fullrecord") +preferredMarcFields = "fullrecord" + ; When displaying publication information from 260/264, this can be set to true ; to make 264 information completely replace 260 information. Default is false, ; which will display information from 260 AND 264 when both fields are populated. diff --git a/module/VuFind/src/VuFind/RecordDriver/MarcReaderTrait.php b/module/VuFind/src/VuFind/RecordDriver/MarcReaderTrait.php index dc6949998e886735ca469126e744c4054c5d940f..e6df13517f5caa548318bb6e659ff679752f359f 100644 --- a/module/VuFind/src/VuFind/RecordDriver/MarcReaderTrait.php +++ b/module/VuFind/src/VuFind/RecordDriver/MarcReaderTrait.php @@ -58,7 +58,19 @@ trait MarcReaderTrait public function getMarcRecord() { if (null === $this->lazyMarcRecord) { - $marc = trim($this->fields['fullrecord']); + // Get preferred MARC field from config, if it is set and is existing + $preferredMarcFields = $this->mainConfig->Record->preferredMarcFields + ?? 'fullrecord'; + $preferredMarcFieldArray = explode(',', $preferredMarcFields); + $preferredMarcField = 'fullrecord'; + foreach ($preferredMarcFieldArray as $testField) { + if (array_key_exists($testField, $this->fields)) { + $preferredMarcField = $testField; + break; + } + } + + $marc = trim($this->fields[$preferredMarcField]); // check if we are dealing with MARCXML if (substr($marc, 0, 1) == '<') {