/** * Generate a IN sql operator * * @param string $field String with the field which you can filter. * @param string $values Array with posible values * * @return string with criteria. */ public static function in($field, $values, $type = 'integer') { // This must be changed by anything if (is_array($values) && count($values) > 1) { if ($type != 'integer' && $type != '') { return str_replace(',\'', '\',\'', $field . ' IN (\'' . implode(",'", $values) . "')"); } else { return $field . ' IN (' . implode(",", $values) . ')'; } } else { $type = $type ? $type : 'integer'; if (is_array($values)) { //this never gets executed! return phpgwapi_sql::equal($field, phpgwapi_sql::$type(current($values))); } else { return phpgwapi_sql::equal($field, phpgwapi_sql::$type($values)); } } }