View | Details | Raw Unified | Return to bug 34989
Collapse All | Expand All

(-)a/Koha/Object/Mixin/AdditionalFields.pm (-4 / +12 lines)
Lines 65-77 sub set_additional_fields { Link Here
65
            my ($tag, $subfield) = split /\$/, $field->marcfield;
65
            my ($tag, $subfield) = split /\$/, $field->marcfield;
66
            my $marc_field = $record->field($tag);
66
            my $marc_field = $record->field($tag);
67
            if ($field->marcfield_mode eq 'get') {
67
            if ($field->marcfield_mode eq 'get') {
68
                $value = $marc_field ? $marc_field->subfield($subfield) : '';
68
                if ($subfield) {
69
                    $value = $marc_field ? $marc_field->subfield($subfield) : '';
70
                }
71
                else {
72
                    $value = $marc_field ? $marc_field->data() : '';
73
                }
69
            } elsif ($field->marcfield_mode eq 'set') {
74
            } elsif ($field->marcfield_mode eq 'set') {
70
                if ($marc_field) {
75
                if ($marc_field and $subfield) {
71
                    $marc_field->update($subfield => $value);
76
                    $marc_field->update($subfield => $value);
72
                } else {
77
                } elsif ($marc_field) {
78
                    $marc_field->update($value);
79
                } elsif ($subfield) {
73
                    $marc_field = MARC::Field->new($tag, '', '', $subfield => $value);
80
                    $marc_field = MARC::Field->new($tag, '', '', $subfield => $value);
74
                    $record->append_fields($marc_field);
81
                    $record->append_fields($marc_field);
82
                } else {
83
                    $marc_field = MARC::Field->new($tag, '', '', $value);
75
                }
84
                }
76
                $record_updated = 1;
85
                $record_updated = 1;
77
            }
86
            }
78
- 

Return to bug 34989