@@ -51,7 +51,11 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi
5151 }
5252 } else {
5353 if (empty ($ timegroup )){
54- $ selectFields []= "DATE_FORMAT(FROM_UNIXTIME(min(start)),'%Y-%m-%d') as time " ;
54+ if (empty ($ groupOn1 ) && empty ($ groupOn2 )) {
55+ $ selectFields []= "DATE_FORMAT(FROM_UNIXTIME(start),'%Y-%m-%d %H:%i') as time " ;
56+ } else {
57+ $ selectFields []= "DATE_FORMAT(FROM_UNIXTIME(min(start)),'%Y-%m-%d') as time " ;
58+ }
5559 } elseif ($ timegroup == 'week ' ) {
5660 $ selectFields []= "STR_TO_DATE(CONCAT(YEARWEEK(FROM_UNIXTIME(start)),' Monday'), '%x%v %W') as time " ;
5761 }elseif ($ timegroup == 'day ' ) {
@@ -63,7 +67,7 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi
6367 }
6468
6569 }
66- if (($ groupOn1 != 'name ' ) && ($ groupOn2 != 'name ' )){
70+ if (($ groupOn1 != 'name ' ) && ($ groupOn2 != 'name ' ) && ! empty ( $ groupOn1 ) && ! empty ( $ groupOn2 ) ){
6771 if ($ this ->dbengine != 'MYSQL ' ) {
6872 $ selectFields [] = '\'* \' as name ' ;
6973 } else {
@@ -73,7 +77,14 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi
7377 } else {
7478 $ selectFields [] = 'wi.name as name ' ;
7579 }
76- if (($ groupOn1 != 'project ' ) && ($ groupOn2 != 'project ' )){
80+
81+ if (($ groupOn1 != 'name ' ) && ($ groupOn2 != 'name ' ) && !empty ($ groupOn1 ) && !empty ($ groupOn2 )){
82+ $ selectFields [] = '\'* \' as details ' ;
83+ } else {
84+ $ selectFields [] = 'wi.details as details ' ;
85+ }
86+
87+ if (($ groupOn1 != 'project ' ) && ($ groupOn2 != 'project ' && !empty ($ groupOn1 ) && !empty ($ groupOn2 ))){
7788 $ selectFields [] = '\'* \' as "projectId" ' ;
7889 if ($ this ->dbengine != 'MYSQL ' ) {
7990 $ selectFields [] = 'string_agg(distinct p.name, \', \') as project ' ;
@@ -198,6 +209,8 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi
198209 }
199210 if (!empty ($ groups )){
200211 $ group = "group by " .implode (", " ,$ groups );
212+ } else {
213+ $ group = "group by wi.id " ;
201214 }
202215 if (empty ($ start )){
203216 $ start = 0 ;
@@ -206,7 +219,7 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi
206219 $ limit = 10000 ;
207220 }
208221 $ sql = 'SELECT ' .$ selectItems .' where ' .implode (" and " ,$ filters ).' ' .$ group . ' order by time desc ' ;
209- // var_dump($sql);
222+ //var_dump($sql);
210223 // var_dump($params);
211224 return $ this ->findEntities ($ sql , $ params , $ limit , $ start );
212225 }
0 commit comments