mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 23:29:31 +01:00
* All apps/custom fields: fixed multiple identical rows, if custom fields where set (introduced in last package)
This commit is contained in:
parent
c0d040342b
commit
dbd43126c8
@ -823,6 +823,7 @@ class so_sql
|
||||
*/
|
||||
function &search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter=null,$join='',$need_full_no_count=false)
|
||||
{
|
||||
//error_log(__METHOD__.'('.array2string(array_combine(array_slice(array('criteria','only_keys','order_by','extra_cols','wildcard','empty','op','start','filter','join','need_full_no_count'), 0, count(func_get_args())), func_get_args())).')');
|
||||
if ((int) $this->debug >= 4) echo "<p>so_sql::search(".print_r($criteria,true).",'$only_keys','$order_by',".print_r($extra_cols,true).",'$wildcard','$empty','$op','$start',".print_r($filter,true).",'$join')</p>\n";
|
||||
|
||||
// if extending class or instanciator set columns to search, convert string criteria to array
|
||||
|
@ -414,6 +414,7 @@ class so_sql_cf extends so_sql
|
||||
*/
|
||||
function &search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter=null,$join='',$need_full_no_count=false)
|
||||
{
|
||||
//error_log(__METHOD__.'('.array2string(array_combine(array_slice(array('criteria','only_keys','order_by','extra_cols','wildcard','empty','op','start','filter','join','need_full_no_count'), 0, count(func_get_args())), func_get_args())).')');
|
||||
if ($only_keys === false)
|
||||
{
|
||||
$only_keys = $this->table_name.'.*';
|
||||
@ -500,6 +501,13 @@ class so_sql_cf extends so_sql
|
||||
$col = $this->table_name .'.'.array_search($col, $this->db_cols).' AS '.$col;
|
||||
}
|
||||
}
|
||||
// add DISTINCT as by joining custom fields for search a row can be returned multiple times
|
||||
$only_keys = array_values($only_keys);
|
||||
$only_keys[0] = 'DISTINCT '.$only_keys[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$only_keys = 'DISTINCT '.$only_keys;
|
||||
}
|
||||
// check if we order by a custom field --> join cf table for given cf and order by it's value
|
||||
if (strpos($order_by,self::CF_PREFIX) !== false)
|
||||
|
Loading…
Reference in New Issue
Block a user