From 4e1289a55d7eee0987216a306278cba8c2d66036 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Mon, 7 Mar 2016 21:34:45 -0500 Subject: [PATCH] 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 Works as advertised. NO koha-qa errors Signed-off-by: Tomas Cohen Arazi Signed-off-by: Brendan A Gallagher --- Koha/Filter/MARC/ViewPolicy.pm | 12 ++---------- Koha/RecordProcessor.pm | 6 ++---- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Koha/Filter/MARC/ViewPolicy.pm b/Koha/Filter/MARC/ViewPolicy.pm index 14df2017e7..98df72d740 100644 --- a/Koha/Filter/MARC/ViewPolicy.pm +++ b/Koha/Filter/MARC/ViewPolicy.pm @@ -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 { diff --git a/Koha/RecordProcessor.pm b/Koha/RecordProcessor.pm index b9d2918021..1f93571d7b 100644 --- a/Koha/RecordProcessor.pm +++ b/Koha/RecordProcessor.pm @@ -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 { -- 2.39.5