From bd1d0f7c18b1a8ee88c3a431efad8d10867a016f Mon Sep 17 00:00:00 2001
From: Ralf Becker <ralfbecker@outdoor-training.de>
Date: Fri, 31 May 2013 08:29:34 +0000
Subject: [PATCH] fixed not working quoting of multiple values specified as
 array, can not use array walk, as 2. parameter is the key not passed data

---
 etemplate/inc/class.so_sql.inc.php | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/etemplate/inc/class.so_sql.inc.php b/etemplate/inc/class.so_sql.inc.php
index 7a09d8927d..a7e1408e0f 100644
--- a/etemplate/inc/class.so_sql.inc.php
+++ b/etemplate/inc/class.so_sql.inc.php
@@ -6,7 +6,7 @@
  * @package etemplate
  * @link http://www.egroupware.org
  * @author Ralf Becker <RalfBecker@outdoor-training.de>
- * @copyright 2002-9 by RalfBecker@outdoor-training.de
+ * @copyright 2002-13 by RalfBecker@outdoor-training.de
  * @version $Id$
  */
 
@@ -890,15 +890,19 @@ class so_sql
 					elseif (strpos($db_col,'.') !== false)	// we have a table-name specified
 					{
 						list($table,$only_col) = explode('.',$db_col);
-
+						$type = $this->db->get_column_attribute($only_col, $table, true, 'type');
+						if (empty($type))
+						{
+							throw new egw_exception_db("Can not determine type of column '$only_col' in table '$table'!");
+						}
 						if (is_array($val) && count($val) > 1)
 						{
-							array_walk($val,array($this->db,'quote'),$this->table_def['fd'][$only_col]['type']);
+							foreach($val as &$v) $v = $this->db->quote($v, $type);
 							$query[] = $sql = $db_col.' IN (' .implode(',',$val).')';
 						}
 						else
 						{
-							$query[] = $db_col.'='.$this->db->quote(is_array($val)?array_shift($val):$val,$this->table_def['fd'][$only_col]['type']);
+							$query[] = $db_col.'='.$this->db->quote(is_array($val)?array_shift($val):$val,$type);
 						}
 					}
 					else