mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:15 +01:00
* Timesheet/PostgreSQL: fix SQL error when selecting a timerange
This commit is contained in:
parent
f5e00e4bad
commit
a4ec8796af
@ -1156,6 +1156,8 @@ class so_sql
|
|||||||
}
|
}
|
||||||
$alias = $col;
|
$alias = $col;
|
||||||
if (stripos($col, ' AS ')) list($col, $alias) = preg_split('/ +AS +/i', $col);
|
if (stripos($col, ' AS ')) list($col, $alias) = preg_split('/ +AS +/i', $col);
|
||||||
|
// do NOT group by constant expressions
|
||||||
|
if (preg_match('/^ *(-?[0-9]+|".*"|\'.*\'|NULL) *$/i', $col)) continue;
|
||||||
if (!in_array($col, $group_by_cols) && !in_array($alias, $group_by_cols))
|
if (!in_array($col, $group_by_cols) && !in_array($alias, $group_by_cols))
|
||||||
{
|
{
|
||||||
$group_by_cols[] = $alias;
|
$group_by_cols[] = $alias;
|
||||||
|
@ -559,9 +559,11 @@ class timesheet_bo extends so_sql_cf
|
|||||||
$union_order[] = 'is_sum_'.$type;
|
$union_order[] = 'is_sum_'.$type;
|
||||||
$sum_extra_cols[$type]{0} = '1';
|
$sum_extra_cols[$type]{0} = '1';
|
||||||
// the $type sum
|
// the $type sum
|
||||||
parent::search($criteria,$sum_ts_id[$type].",'','','',MIN(ts_start),SUM(ts_duration) AS ts_duration,".
|
parent::search($criteria,array(
|
||||||
($this->quantity_sum ? "SUM(ts_quantity) AS ts_quantity" : '0').",0,NULL,0,0,0,0,0,SUM($total_sql) AS ts_total",
|
$sum_ts_id[$type],"''","''","''",'MIN(ts_start)','SUM(ts_duration) AS ts_duration',
|
||||||
'GROUP BY '.$sum_sql[$type],$sum_extra_cols,$wildcard,$empty,$op,'UNION',$filter,$join,$need_full_no_count);
|
($this->quantity_sum ? "SUM(ts_quantity) AS ts_quantity" : '0'),
|
||||||
|
'0','NULL','0','0','0','0','0',"SUM($total_sql) AS ts_total"
|
||||||
|
),'GROUP BY '.$sum_sql[$type],$sum_extra_cols,$wildcard,$empty,$op,'UNION',$filter,$join,$need_full_no_count);
|
||||||
$sum_extra_cols[$type]{0} = '0';
|
$sum_extra_cols[$type]{0} = '0';
|
||||||
}
|
}
|
||||||
$union_order[] = 'ts_start '.$sort;
|
$union_order[] = 'ts_start '.$sort;
|
||||||
|
Loading…
Reference in New Issue
Block a user