Merge remote-tracking branch 'origin/new/bug_6132'
[koha_gimpoz] / C4 / SQLHelper.pm
index 720dc99..cf425fd 100644 (file)
@@ -43,9 +43,6 @@ BEGIN {
                                );
 }
 
-my $tablename;
-my $hash;
-
 =head1 NAME
 
 C4::SQLHelper - Perl Module containing convenience functions for SQL Handling
@@ -363,7 +360,7 @@ sub _filter_hash{
                ## supposed to be a hash of simple values, hashes of arrays could be implemented
                $filter_input->{$field}=format_date_in_iso($filter_input->{$field})
           if $columns->{$field}{Type}=~/date/ &&
-             $filter_input->{$field} && $filter_input->{$field} !~C4::Dates->regexp("iso");
+             $filter_input->{$field} !~C4::Dates->regexp("iso");
                my ($tmpkeys, $localvalues)=_Process_Operands($filter_input->{$field},"$tablename.$field",$searchtype,$columns);
                if (@$tmpkeys){
                        push @values, @$localvalues;
@@ -415,7 +412,7 @@ sub _Process_Operands{
        my @tmpkeys;
        my @localkeys;
 
-    $operand = [$operand] unless ref $operand;
+    $operand = [$operand] unless ref $operand eq 'ARRAY';
     foreach (@$operand) {
            push @tmpkeys, " $field = ? ";
            push @values, $_;