X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FCommon.pm;h=b710125126260e9202307b398022ace07a804b73;hb=2868feee8fb33457e7562f02778186b5b5c1a2b6;hp=8bc0d1484d72c45437a53e73c3c40121b87f2f1a;hpb=8c7e44938a661e035f62840e1e177353240ace5d;p=kivitendo-erp.git diff --git a/SL/Common.pm b/SL/Common.pm index 8bc0d1484..b71012512 100644 --- a/SL/Common.pm +++ b/SL/Common.pm @@ -511,9 +511,23 @@ sub check_params { my $params = shift; foreach my $key (@_) { - if (!defined $params->{$key}) { + if ((ref $key eq '') && !defined $params->{$key}) { my $subroutine = (caller(1))[3]; $main::form->error($main::locale->text("Missing parameter #1 in call to sub #2.", $key, $subroutine)); + + } elsif (ref $key eq 'ARRAY') { + my $found = 0; + foreach $subkey (@{ $key }) { + if (defined $params->{$subkey}) { + $found = 1; + last; + } + } + + if (!$found) { + my $subroutine = (caller(1))[3]; + $main::form->error($main::locale->text("Missing parameter (at least one of #1) in call to sub #2.", join(', ', @{ $key }), $subroutine)); + } } } } @@ -522,9 +536,23 @@ sub check_params_x { my $params = shift; foreach my $key (@_) { - if (!exists $params->{$key}) { + if ((ref $key eq '') && !exists $params->{$key}) { my $subroutine = (caller(1))[3]; $main::form->error($main::locale->text("Missing parameter #1 in call to sub #2.", $key, $subroutine)); + + } elsif (ref $key eq 'ARRAY') { + my $found = 0; + foreach $subkey (@{ $key }) { + if (exists $params->{$subkey}) { + $found = 1; + last; + } + } + + if (!$found) { + my $subroutine = (caller(1))[3]; + $main::form->error($main::locale->text("Missing parameter (at least one of #1) in call to sub #2.", join(', ', @{ $key }), $subroutine)); + } } } }