Bug 15870: potential follow up to comment #8
This patch: - makes the Koha::RecordProcessor code more clear by removing the unnecessary newrecord variable. - revises the filter to be more clear about the expectation that operations are done directly on the record parameter. TEST PLAN --------- prove t/RecordProcessor.t prove t/db_dependent/Filter_MARC_ViewPolicy.t run koha qa test tools Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> Works as advertised. NO koha-qa errors Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
parent
c9170233c9
commit
4e1289a55d
2 changed files with 4 additions and 14 deletions
|
@ -78,9 +78,8 @@ sub filter {
|
|||
push @records, $precord;
|
||||
}
|
||||
|
||||
my @results;
|
||||
foreach my $current_record (@records) {
|
||||
my $result = $current_record->clone();
|
||||
my $result = $current_record;
|
||||
my $interface = $self->{options}->{interface} // 'opac';
|
||||
my $frameworkcode = $self->{options}->{frameworkcode} // q{};
|
||||
my $hide = _should_hide_on_interface();
|
||||
|
@ -103,15 +102,8 @@ sub filter {
|
|||
}
|
||||
);
|
||||
}
|
||||
push @results, $result;
|
||||
}
|
||||
|
||||
if ( scalar @results == 1 ) {
|
||||
return $results[0];
|
||||
}
|
||||
else {
|
||||
return \@results;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub _filter_field {
|
||||
|
|
|
@ -152,14 +152,12 @@ sub process {
|
|||
|
||||
return unless defined $record;
|
||||
|
||||
my $newrecord = $record;
|
||||
|
||||
foreach my $filterobj (@{$self->filters}) {
|
||||
next unless $filterobj;
|
||||
$newrecord = $filterobj->filter($newrecord);
|
||||
$filterobj->filter($record);
|
||||
}
|
||||
|
||||
return $newrecord;
|
||||
return $record;
|
||||
}
|
||||
|
||||
sub DESTROY {
|
||||
|
|
Loading…
Reference in a new issue