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 <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomás Cohen Arazi 2020-03-30 10:06:43 -03:00 committed by Martin Renvoize
parent 7bcfa82197
commit 0004816118
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -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)