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

(-)a/Koha/Filter/MARC/TrimFields.pm (-3 / +8 lines)
Lines 60-68 sub filter { Link Here
60
                my $value = $subfield->[1];
60
                my $value = $subfield->[1];
61
                $value =~ s/[\n\r]+/ /g;
61
                $value =~ s/[\n\r]+/ /g;
62
                $value =~ s/^\s+|\s+$//g;
62
                $value =~ s/^\s+|\s+$//g;
63
                $field->add_subfields( $key => $value );    # add subfield to the end of the subfield list
63
                $field->add_subfields( $key => $value )
64
                $field->delete_subfield( pos => 0 );        # delete the subfield at the top of the subfield list
64
                    if $value ne q{}
65
                    ; # add subfield to the end of the subfield list, but only if there is still a non empty value there
66
                $field->delete_subfield( pos => 0 );    # delete the subfield at the top of the subfield list
65
            }
67
            }
68
69
            # if it happed that all existing subfields had whitespaces only,
70
            # the field would be empty now and should be removed from the record
71
            $record->delete_fields($field) unless scalar( $field->subfields );
66
        }
72
        }
67
    }
73
    }
68
    return $record;
74
    return $record;
69
- 

Return to bug 40128