@@ -51,7 +51,11 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi
51
51
}
52
52
} else {
53
53
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
+ }
55
59
} elseif ($ timegroup == 'week ' ) {
56
60
$ selectFields []= "STR_TO_DATE(CONCAT(YEARWEEK(FROM_UNIXTIME(start)),' Monday'), '%x%v %W') as time " ;
57
61
}elseif ($ timegroup == 'day ' ) {
@@ -63,7 +67,7 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi
63
67
}
64
68
65
69
}
66
- if (($ groupOn1 != 'name ' ) && ($ groupOn2 != 'name ' )){
70
+ if (($ groupOn1 != 'name ' ) && ($ groupOn2 != 'name ' ) && ! empty ( $ groupOn1 ) && ! empty ( $ groupOn2 ) ){
67
71
if ($ this ->dbengine != 'MYSQL ' ) {
68
72
$ selectFields [] = '\'* \' as name ' ;
69
73
} else {
@@ -73,7 +77,14 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi
73
77
} else {
74
78
$ selectFields [] = 'wi.name as name ' ;
75
79
}
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 ))){
77
88
$ selectFields [] = '\'* \' as "projectId" ' ;
78
89
if ($ this ->dbengine != 'MYSQL ' ) {
79
90
$ selectFields [] = 'string_agg(distinct p.name, \', \') as project ' ;
@@ -198,6 +209,8 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi
198
209
}
199
210
if (!empty ($ groups )){
200
211
$ group = "group by " .implode (", " ,$ groups );
212
+ } else {
213
+ $ group = "group by wi.id " ;
201
214
}
202
215
if (empty ($ start )){
203
216
$ start = 0 ;
@@ -206,7 +219,7 @@ public function report($user, $from, $to, $filterProjectId, $filterClientId, $fi
206
219
$ limit = 10000 ;
207
220
}
208
221
$ sql = 'SELECT ' .$ selectItems .' where ' .implode (" and " ,$ filters ).' ' .$ group . ' order by time desc ' ;
209
- // var_dump($sql);
222
+ //var_dump($sql);
210
223
// var_dump($params);
211
224
return $ this ->findEntities ($ sql , $ params , $ limit , $ start );
212
225
}
0 commit comments