From: Joey Schulze Date: Wed, 24 Mar 2010 13:02:49 +0000 (+0100) Subject: Move JOIN processor into function X-Git-Tag: 2010-06-02_customer~25 X-Git-Url: https://git.infodrom.org/?p=misc%2Fkostenrechnung;a=commitdiff_plain;h=7b99851243c8f7f4b9d431d19b1374a7b9cac0e8 Move JOIN processor into function --- diff --git a/lib/general.php b/lib/general.php index 837a4b8..94365d8 100644 --- a/lib/general.php +++ b/lib/general.php @@ -187,6 +187,14 @@ function debug_info() return $html; } +function grid_sql_join($mask) +{ + if (array_key_exists('join', $mask)) { + return ' JOIN ' . join(' JOIN ', $mask['join']); + } + return ''; +} + function grid_sql($name, $mask) { $fields = array(); @@ -199,7 +207,7 @@ function grid_sql($name, $mask) $_SESSION['grid_' . $name] = sprintf("SELECT %s FROM %s", implode(',', $fields), $mask['table']); - if (array_key_exists('join', $mask)) $_SESSION['grid_' . $name] .= ' JOIN ' . join(' JOIN ', $mask['join']); + if (array_key_exists('join', $mask)) $_SESSION['grid_' . $name] .= grid_sql_join($mask); if (array_key_exists('where', $mask)) $_SESSION['grid_' . $name] .= ' WHERE ' . $mask['where']; }