Merge branch 'ent-10410-Carga-muy-lenta-de-comentarios-de-eventos-en-tyr-saga' into 'develop'

fixed comment loading in event dialog

See merge request artica/pandorafms!5543
This commit is contained in:
Matias Didier 2023-02-16 09:34:35 +00:00
commit c6f6a6b9d3

View File

@ -92,6 +92,9 @@ $node_id = (int) get_parameter('node_id', 0);
if ($get_comments === true) { if ($get_comments === true) {
$event = get_parameter('event', false); $event = get_parameter('event', false);
$event_rep = (int) get_parameter('event_rep', 0); $event_rep = (int) get_parameter('event_rep', 0);
$event_rep = get_parameter_post('event')['event_rep'];
$group_rep = get_parameter_post('event')['group_rep'];
if ($event === false) { if ($event === false) {
return __('Failed to retrieve comments'); return __('Failed to retrieve comments');
} }
@ -99,7 +102,7 @@ if ($get_comments === true) {
$eventsGrouped = []; $eventsGrouped = [];
// Consider if the event is grouped. // Consider if the event is grouped.
$whereGrouped = '1=1'; $whereGrouped = '1=1';
if ($event_rep === EVENT_GROUP_REP_EVENTS) { if ($group_rep === EVENT_GROUP_REP_EVENTS && $event_rep > 1) {
// Default grouped message filtering (evento and estado). // Default grouped message filtering (evento and estado).
$whereGrouped = sprintf( $whereGrouped = sprintf(
'`evento` = "%s"', '`evento` = "%s"',
@ -120,7 +123,7 @@ if ($get_comments === true) {
(int) $event['id_agentmodule'] (int) $event['id_agentmodule']
); );
} }
} else if ($event_rep === EVENT_GROUP_REP_EXTRAIDS) { } else if ($group_rep === EVENT_GROUP_REP_EXTRAIDS) {
$whereGrouped = sprintf( $whereGrouped = sprintf(
'`id_extra` = "%s"', '`id_extra` = "%s"',
$event['id_extra'] $event['id_extra']
@ -1639,6 +1642,7 @@ if ($get_extended_event) {
$comments = $event['comments']; $comments = $event['comments'];
$event['similar_ids'] = $similar_ids; $event['similar_ids'] = $similar_ids;
$event['group_rep'] = $group_rep;
if (isset($comments) === false) { if (isset($comments) === false) {
$comments = $event['user_comment']; $comments = $event['user_comment'];