Support LEFT JOINs
authorJoey Schulze <joey@infodrom.org>
Wed, 24 Mar 2010 13:13:30 +0000 (14:13 +0100)
committerJoey Schulze <joey@infodrom.org>
Wed, 24 Mar 2010 13:13:30 +0000 (14:13 +0100)
lib/general.php

index 94365d8..2332e59 100644 (file)
@@ -189,10 +189,16 @@ function debug_info()
 
 function grid_sql_join($mask)
 {
+  $ret = '';
   if (array_key_exists('join', $mask)) {
-    return ' JOIN ' . join(' JOIN ', $mask['join']);
+    foreach ($mask['join'] as $line) {
+      if (strtolower(substr($line,0,4)) == 'left')
+       $ret .= ' LEFT JOIN ' . substr($line,5);
+      else
+       $ret .= ' JOIN ' . $line;
+    }
   }
-  return '';
+  return $ret;
 }
 
 function grid_sql($name, $mask)