Bug 15339: Improve parameter validation

Only value and source are allowed

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2017-09-06 13:41:47 -03:00
parent d53f7607b5
commit d60cc56613
2 changed files with 2 additions and 2 deletions

View file

@ -397,7 +397,7 @@ subtest '->build parameter' => sub {
warnings_are { warnings_are {
$builder->build({ $builder->build({
source => 'Branch', source => 'Branch',
values => { value => {
branchcode => 'BRANCH_1' branchcode => 'BRANCH_1'
} }
}) })

View file

@ -89,7 +89,7 @@ sub build {
my $source = $params->{source} || return; my $source = $params->{source} || return;
my $value = $params->{value}; my $value = $params->{value};
my @unknowns = grep( !/source|value|only_fk/, keys %{ $params }); my @unknowns = grep( !/^(source|value)$/, keys %{ $params });
carp "Unknown parameter(s): ", join( ', ', @unknowns ) if scalar @unknowns; carp "Unknown parameter(s): ", join( ', ', @unknowns ) if scalar @unknowns;
my $col_values = $self->_buildColumnValues({ my $col_values = $self->_buildColumnValues({