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

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

Return to bug 34989