diff --git a/infolog/inc/class.infolog_so.inc.php b/infolog/inc/class.infolog_so.inc.php index f637116524..6291d2017f 100644 --- a/infolog/inc/class.infolog_so.inc.php +++ b/infolog/inc/class.infolog_so.inc.php @@ -902,6 +902,15 @@ class infolog_so // do not return deleted attendees $join .= " LEFT JOIN $this->users_table attendees ON main.info_id=attendees.info_id AND attendees.info_res_deleted IS NULL"; $group_by = ' GROUP BY main.info_id '; + // check if $query['append'] already contains a GROUP BY clause + if (stripos($query['append'], 'group by') !== false) + { + $query['append'] .= ',main.info_id '; + } + else + { + $query['append'] = $group_by; + } $pid = 'AND ' . $this->db->expression($this->info_table,array('info_id_parent' => ($action == 'sp' ?$query['action_id'] : 0))); if ($GLOBALS['egw_info']['user']['preferences']['infolog']['listNoSubs'] != '1' && $action != 'sp' || @@ -952,7 +961,7 @@ class infolog_so if (is_array($cols)) $cols = implode(',',$cols); $cols .= ','.$this->db->group_concat('attendees.account_id').' AS info_responsible'; $rs = $this->db->query($sql='SELECT '.$mysql_calc_rows.' '.$distinct.' '.$cols.' '.$info_customfield.' '.$sql_query. - $query['append'].$group_by.' '.$ordermethod,__LINE__,__FILE__, + $query['append'].$ordermethod,__LINE__,__FILE__, (int) $query['start'],isset($query['start']) ? (int) $query['num_rows'] : -1,false,Api\Db::FETCH_ASSOC); //echo "
db::query('$sql',,,".(int)$query['start'].','.(isset($query['start']) ? (int) $query['num_rows'] : -1).")
\n";