mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
fixed group by extra_id pandora_enterprise#9425
This commit is contained in:
parent
38dea9e01b
commit
d068a9e9cc
@ -387,8 +387,6 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
|
|||||||
$filter = ['group_rep' => EVENT_GROUP_REP_ALL];
|
$filter = ['group_rep' => EVENT_GROUP_REP_ALL];
|
||||||
}
|
}
|
||||||
|
|
||||||
hd($filter['group_rep'], true);
|
|
||||||
|
|
||||||
switch ($filter['group_rep']) {
|
switch ($filter['group_rep']) {
|
||||||
case EVENT_GROUP_REP_ALL:
|
case EVENT_GROUP_REP_ALL:
|
||||||
case EVENT_GROUP_REP_AGENTS:
|
case EVENT_GROUP_REP_AGENTS:
|
||||||
@ -1543,8 +1541,8 @@ function events_get_all(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($filter['group_rep'] === EVENT_GROUP_REP_EVENTS
|
if (((int) $filter['group_rep'] === EVENT_GROUP_REP_EVENTS
|
||||||
|| $filter['group_rep'] === EVENT_GROUP_REP_EXTRAIDS) && $count === false
|
|| (int) $filter['group_rep'] === EVENT_GROUP_REP_EXTRAIDS) && $count === false
|
||||||
) {
|
) {
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT %s
|
'SELECT %s
|
||||||
@ -1576,7 +1574,9 @@ function events_get_all(
|
|||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
%s JOIN tgrupo tg
|
%s JOIN tgrupo tg
|
||||||
ON %s',
|
ON %s
|
||||||
|
%s
|
||||||
|
%s',
|
||||||
join(',', $fields),
|
join(',', $fields),
|
||||||
$group_selects_trans,
|
$group_selects_trans,
|
||||||
$tevento,
|
$tevento,
|
||||||
@ -1605,7 +1605,8 @@ function events_get_all(
|
|||||||
join(' ', $agent_join_filters),
|
join(' ', $agent_join_filters),
|
||||||
$tgrupo_join,
|
$tgrupo_join,
|
||||||
join(' ', $tgrupo_join_filters),
|
join(' ', $tgrupo_join_filters),
|
||||||
join(' ', $sql_filters)
|
join(' ', $sql_filters),
|
||||||
|
$order_by
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
|
@ -6510,7 +6510,7 @@ function ui_print_breadcrums($tab_name)
|
|||||||
/**
|
/**
|
||||||
* Show last comment
|
* Show last comment
|
||||||
*
|
*
|
||||||
* @param array $comments array with comments
|
* @param string $comments String with comments.
|
||||||
*
|
*
|
||||||
* @return string HTML string with the last comment of the events.
|
* @return string HTML string with the last comment of the events.
|
||||||
*/
|
*/
|
||||||
@ -6534,31 +6534,45 @@ function ui_print_comments($comments)
|
|||||||
foreach ($comments_array as $comm) {
|
foreach ($comments_array as $comm) {
|
||||||
// Show the comments more recent first.
|
// Show the comments more recent first.
|
||||||
if (is_array($comm)) {
|
if (is_array($comm)) {
|
||||||
$last_comment[] = array_reverse($comm);
|
$order_utimestamp = array_reduce(
|
||||||
|
$comm,
|
||||||
|
function ($carry, $item) {
|
||||||
|
$carry[$item['utimestamp']] = $item;
|
||||||
|
return $carry;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$key_max_utimestamp = max(array_keys($order_utimestamp));
|
||||||
|
|
||||||
|
$last_comment = $order_utimestamp[$key_max_utimestamp];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($last_comment) === true) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
// Only show the last comment. If commment its too long,the comment will short with ...
|
// Only show the last comment. If commment its too long,the comment will short with ...
|
||||||
// If $config['prominent_time'] is timestamp the date show Month, day, hour and minutes.
|
// If $config['prominent_time'] is timestamp the date show Month, day, hour and minutes.
|
||||||
// Else show comments hours ago
|
// Else show comments hours ago
|
||||||
if ($last_comment[0][0]['action'] != 'Added comment') {
|
if ($last_comment['action'] != 'Added comment') {
|
||||||
$last_comment[0][0]['comment'] = $last_comment[0][0]['action'];
|
$last_comment['comment'] = $last_comment['action'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$short_comment = substr($last_comment[0][0]['comment'], 0, 20);
|
$short_comment = substr($last_comment['comment'], 0, 20);
|
||||||
if ($config['prominent_time'] == 'timestamp') {
|
if ($config['prominent_time'] == 'timestamp') {
|
||||||
$comentario = '<i>'.date($config['date_format'], $last_comment[0][0]['utimestamp']).' ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].'';
|
$comentario = '<i>'.date($config['date_format'], $last_comment['utimestamp']).' ('.$last_comment['id_user'].'): '.$last_comment['comment'].'';
|
||||||
|
|
||||||
if (strlen($comentario) > '200px') {
|
if (strlen($comentario) > '200px') {
|
||||||
$comentario = '<i>'.date($config['date_format'], $last_comment[0][0]['utimestamp']).' ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...';
|
$comentario = '<i>'.date($config['date_format'], $last_comment['utimestamp']).' ('.$last_comment['id_user'].'): '.$short_comment.'...';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$rest_time = (time() - $last_comment[0][0]['utimestamp']);
|
$rest_time = (time() - $last_comment['utimestamp']);
|
||||||
$time_last = (($rest_time / 60) / 60);
|
$time_last = (($rest_time / 60) / 60);
|
||||||
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].'';
|
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment['id_user'].'): '.$last_comment['comment'].'';
|
||||||
|
|
||||||
if (strlen($comentario) > '200px') {
|
if (strlen($comentario) > '200px') {
|
||||||
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...';
|
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment['id_user'].'): '.$short_comment.'...';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user