Code

update function get_where_statement after modified GOsa queries
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 10 Jul 2008 10:02:59 +0000 (10:02 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 10 Jul 2008 10:02:59 +0000 (10:02 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11590 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/modules/GosaSupportDaemon.pm

index 21db30a5974acedb2677887fe3bb5df3828f0b34..33c9ec47d741532fc1548a18599757a98c6ee4f4 100644 (file)
@@ -293,6 +293,8 @@ sub get_where_statement {
                 my @xml_tags = keys %{$phrase};
                 my $tag = $xml_tags[0];
                 my $val = $phrase->{$tag}[0];
+                if( ref($val) eq "HASH" ) { next; }  # empty xml-tags should not appear in where statement
+
                                # integer columns do not have to have single quotes besides the value
                                if ($tag eq "id") {
                                                push(@phrase_l, "$tag$operator$val");
@@ -300,8 +302,11 @@ sub get_where_statement {
                                                push(@phrase_l, "$tag$operator'$val'");
                                }
             }
-            my $clause_str .= join(" $connector ", @phrase_l);
-            push(@clause_l, "($clause_str)");
+
+            if (not 0 == @phrase_l) {
+                my $clause_str .= join(" $connector ", @phrase_l);
+                push(@clause_l, "($clause_str)");
+            }
         }
 
         if( not 0 == @clause_l ) {