From b4f47c9a06af45a1524c210f073c07523ff94ce9 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 Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson --- 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.39.5