[Koha-bugs] [Bug 15870] Add Filter for MARC to respect visibility settings

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Mar 4 21:00:57 CET 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15870

--- Comment #8 from M. Tompsett <mtompset at hotmail.com> ---
(In reply to Tomás Cohen Arazi from comment #6)
> Mark: you need to get rid of the clone. The RecordProcessor pipeline is
> designed so it works on the original object.

I'm torn on that.

%%%% SNIP %%%%
sub process {
    my $self = shift;
    my $record = shift || $self->record;

    return unless defined $record;

    my $newrecord = $record;

    foreach my $filterobj (@{$self->filters}) {
        next unless $filterobj;
        $newrecord = $filterobj->filter($newrecord);
    }

    return $newrecord;
}
%%%% SNIP %%%%

The clincher for me is that the $filterobj->filter call returns something. What
is the point of returning something if we are modifying the original object?
The return $newrecord is still necessary because of pre-call binding or passing
the record(s) directly. However, the "$newrecord =" makes no sense if the
original was not intended to stay intact, because it would have already been
modified!

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list