From 765a1d5c09b590b6c901c35856ed3ada8716badf Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 20 Apr 2010 07:39:23 +0000 Subject: [PATCH] "fixed not returned (explicitly given) columns: you need to use $table.'.'.$col.' AS '.$col, without AS column get NOT returned as name is different" --- etemplate/inc/class.so_sql_cf.inc.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/etemplate/inc/class.so_sql_cf.inc.php b/etemplate/inc/class.so_sql_cf.inc.php index 8946b297c8..04f44d6251 100644 --- a/etemplate/inc/class.so_sql_cf.inc.php +++ b/etemplate/inc/class.so_sql_cf.inc.php @@ -449,7 +449,8 @@ class so_sql_cf extends so_sql foreach($criteria as $name => $val) { $extra_columns = $this->db->get_table_definitions($app, $this->extra_table); - if(is_string($name) && $extra_columns['fd'][array_search($name, $this->db_cols)]) { + if(is_string($name) && $extra_columns['fd'][array_search($name, $this->db_cols)]) + { $criteria[] = $this->db->expression($this->table_name,$this->table_name.'.',array( array_search($name, $this->db_cols) => $val, )); @@ -458,10 +459,13 @@ class so_sql_cf extends so_sql } } // replace ambiguous column with (an exact match of) table_name.column - if(is_array($only_keys)) { - foreach($only_keys as $key => &$col) { - if(is_numeric($key) && in_array($col, $this->db_cols)) { - $col = $this->table_name .'.'.array_search($col, $this->db_cols); + if(is_array($only_keys)) + { + foreach($only_keys as $key => &$col) + { + if(is_numeric($key) && in_array($col, $this->db_cols)) + { + $col = $this->table_name .'.'.array_search($col, $this->db_cols).' AS '.$col; } } } @@ -511,7 +515,7 @@ class so_sql_cf extends so_sql } else // using egw_db::expression to allow to use array() with possible values or NULL { - if($this->customfields[$this->get_cf_name($name)]['type'] == 'select' && + if($this->customfields[$this->get_cf_name($name)]['type'] == 'select' && $this->customfields[$this->get_cf_name($name)]['rows'] > 1) { // Multi-select - any entry with the filter value selected matches