Skip to content
Snippets Groups Projects
Commit 11a263e7 authored by Oliver Goldschmidt's avatar Oliver Goldschmidt Committed by Robert Lange
Browse files

makes MARC record field configurable (#1813)

parent a36b34e3
No related merge requests found
......@@ -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.
......
......@@ -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) == '<') {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment