From 4e5bcfbda5ac2e9b3345d37d9658d026a9a3c2b9 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 30 Mar 2020 10:06:43 -0300 Subject: [PATCH] Bug 25008: Overload Koha::RecordProcessor->options to update filters This patch overloads the 'options' accessor generated by Class:Accessor. It does so the passed options are used to refresh the loaded filters. Tests are added for this overloaded method as well. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/RecordProcessor.t => SUCCESS: Tests pass! 3. Sign off :-D --- Koha/RecordProcessor.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Koha/RecordProcessor.pm b/Koha/RecordProcessor.pm index 1f93571d7b..a501c5010a 100644 --- a/Koha/RecordProcessor.pm +++ b/Koha/RecordProcessor.pm @@ -121,6 +121,29 @@ sub new { return $self; } +=head3 options + + $processor->options( $new_options ); + +Overloaded accessor, that spreads the new options to the filter objects when set + +=cut + +sub options { + my ( $self, $options ) = @_; + + if ( $options ) { # Set + foreach my $filter ( @{$self->filters} ) { + $filter->params->{options} = $options; + } + + $self->{options} = $options; + return $self; + } + + return $self->{options}; +} + =head2 bind $normalizer->bind($record) -- 2.26.0