fixed group by order event_get_all pandora_enterprise#9420
This commit is contained in:
parent
e76e9e94de
commit
7771a96466
pandora_console/include
|
@ -1489,6 +1489,15 @@ function events_get_all(
|
||||||
MAX(id_evento) as max_id_evento',
|
MAX(id_evento) as max_id_evento',
|
||||||
($idx !== false) ? 'GROUP_CONCAT(DISTINCT user_comment SEPARATOR "<br>") AS comments,' : ''
|
($idx !== false) ? 'GROUP_CONCAT(DISTINCT user_comment SEPARATOR "<br>") AS comments,' : ''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$group_selects_trans = sprintf(
|
||||||
|
',tmax_event.event_rep,
|
||||||
|
%s
|
||||||
|
tmax_event.timestamp_last,
|
||||||
|
tmax_event.timestamp_first,
|
||||||
|
tmax_event.max_id_evento',
|
||||||
|
($idx !== false) ? 'tmax_event.comments,' : ''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$idx = array_search('te.user_comment', $fields);
|
$idx = array_search('te.user_comment', $fields);
|
||||||
|
@ -1497,6 +1506,69 @@ function events_get_all(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((int) $filter['group_rep'] === 1 && $count === false) {
|
||||||
|
$sql = sprintf(
|
||||||
|
'SELECT %s
|
||||||
|
%s
|
||||||
|
FROM %s
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT te.id_evento %s
|
||||||
|
FROM %s
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s JOIN %s ta
|
||||||
|
ON ta.%s = te.id_agente
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s JOIN tgrupo tg
|
||||||
|
ON %s
|
||||||
|
WHERE 1=1
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
) tmax_event
|
||||||
|
ON te.id_evento = tmax_event.max_id_evento
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s JOIN %s ta
|
||||||
|
ON ta.%s = te.id_agente
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
%s JOIN tgrupo tg
|
||||||
|
ON %s',
|
||||||
|
join(',', $fields),
|
||||||
|
$group_selects_trans,
|
||||||
|
$tevento,
|
||||||
|
$group_selects,
|
||||||
|
$tevento,
|
||||||
|
$event_lj,
|
||||||
|
$agentmodule_join,
|
||||||
|
$tagente_join,
|
||||||
|
$tagente_table,
|
||||||
|
$tagente_field,
|
||||||
|
$conditionMetaconsole,
|
||||||
|
join(' ', $agent_join_filters),
|
||||||
|
$tgrupo_join,
|
||||||
|
join(' ', $tgrupo_join_filters),
|
||||||
|
join(' ', $sql_filters),
|
||||||
|
$group_by,
|
||||||
|
$order_by,
|
||||||
|
$pagination,
|
||||||
|
$having,
|
||||||
|
$event_lj,
|
||||||
|
$agentmodule_join,
|
||||||
|
$tagente_join,
|
||||||
|
$tagente_table,
|
||||||
|
$tagente_field,
|
||||||
|
$conditionMetaconsole,
|
||||||
|
join(' ', $agent_join_filters),
|
||||||
|
$tgrupo_join,
|
||||||
|
join(' ', $tgrupo_join_filters),
|
||||||
|
join(' ', $sql_filters)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT %s
|
'SELECT %s
|
||||||
%s
|
%s
|
||||||
|
@ -1534,6 +1606,7 @@ function events_get_all(
|
||||||
$pagination,
|
$pagination,
|
||||||
$having
|
$having
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if ($return_sql === true) {
|
if ($return_sql === true) {
|
||||||
return $sql;
|
return $sql;
|
||||||
|
|
Loading…
Reference in New Issue