+ case 'task':
+ $what_to_concat .= ", ' - ', 'Null'";
+ $fields_part .= ', null as task';
+ break;
+
+ case 'cf_1':
+ $what_to_concat .= ", ' - ', 'Null'";
+ $fields_part .= ', null as cf_1';
+ break;
+ }
+ switch ($group_by2) {
+ case 'date':
+ $what_to_concat .= ", ' - ', ei.date";
+ break;
+ case 'user':
+ $what_to_concat .= ", ' - ', u.name";
+ $fields_part .= ', u.name as user';
+ break;
+ case 'client':
+ $what_to_concat .= ", ' - ', coalesce(c.name, 'Null')";
+ $fields_part .= ', c.name as client';
+ break;
+ case 'project':
+ $what_to_concat .= ", ' - ', coalesce(p.name, 'Null')";
+ $fields_part .= ', p.name as project';
+ break;
+
+ case 'task':
+ $what_to_concat .= ", ' - ', 'Null'";
+ $fields_part .= ', null as task';
+ break;
+
+ case 'cf_1':
+ $what_to_concat .= ", ' - ', 'Null'";
+ $fields_part .= ', null as cf_1';
+ break;
+ }
+ switch ($group_by3) {
+ case 'date':
+ $what_to_concat .= ", ' - ', ei.date";
+ break;
+ case 'user':
+ $what_to_concat .= ", ' - ', u.name";
+ $fields_part .= ', u.name as user';
+ break;
+ case 'client':
+ $what_to_concat .= ", ' - ', coalesce(c.name, 'Null')";
+ $fields_part .= ', c.name as client';
+ break;
+ case 'project':
+ $what_to_concat .= ", ' - ', coalesce(p.name, 'Null')";
+ $fields_part .= ', p.name as project';
+ break;
+
+ case 'task':
+ $what_to_concat .= ", ' - ', 'Null'";
+ $fields_part .= ', null as task';
+ break;
+
+ case 'cf_1':
+ $what_to_concat .= ", ' - ', 'Null'";
+ $fields_part .= ', null as cf_1';
+ break;
+ }
+ // Remove garbage from the beginning.
+ if ($what_to_concat)
+ $what_to_concat = substr($what_to_concat, 8);
+ $concat_part = "concat($what_to_concat) as group_field";
+ return "$concat_part $fields_part";