mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Merge branch 'ent-9033-Vista-de-eventos-Validar-eventos-repetidos' into 'develop'
Ent 9033 vista de eventos validar eventos repetidos See merge request artica/pandorafms!4953
This commit is contained in:
commit
b73389fff0
@ -401,8 +401,15 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
|
|||||||
|
|
||||||
case '1':
|
case '1':
|
||||||
// Group by events.
|
// Group by events.
|
||||||
|
$event = events_get_event($id_evento, ['estado', 'event_type', 'id_agente', 'id_agentmodule']);
|
||||||
|
$filter['group_rep'] = 0;
|
||||||
|
$filter['status'] = $event['estado'];
|
||||||
|
$filter['event_type'] = $event['event_type'];
|
||||||
|
$filter['id_agent'] = $event['id_agente'];
|
||||||
|
$filter['id_agentmodule'] = $event['id_agentmodule'];
|
||||||
|
|
||||||
$sql = events_get_all(
|
$sql = events_get_all(
|
||||||
['te.*'],
|
['te.id_evento'],
|
||||||
$filter,
|
$filter,
|
||||||
// Offset.
|
// Offset.
|
||||||
null,
|
null,
|
||||||
@ -418,18 +425,7 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
$target_ids = db_get_all_rows_sql(
|
$target_ids = db_get_all_rows_sql($sql);
|
||||||
sprintf(
|
|
||||||
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
|
|
||||||
ON tu.estado = tf.estado
|
|
||||||
AND tu.evento = tf.evento
|
|
||||||
AND tu.id_agente = tf.id_agente
|
|
||||||
AND tu.id_agentmodule = tf.id_agentmodule
|
|
||||||
AND tf.max_id_evento = %d',
|
|
||||||
$sql,
|
|
||||||
$id_evento
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Try to avoid deadlock while updating full set.
|
// Try to avoid deadlock while updating full set.
|
||||||
if ($target_ids !== false && count($target_ids) > 0) {
|
if ($target_ids !== false && count($target_ids) > 0) {
|
||||||
@ -494,8 +490,15 @@ function events_update_status($id_evento, $status, $filter=null)
|
|||||||
|
|
||||||
case '1':
|
case '1':
|
||||||
// Group by events.
|
// Group by events.
|
||||||
|
$event = events_get_event($id_evento, ['estado', 'event_type', 'id_agente', 'id_agentmodule']);
|
||||||
|
$filter['group_rep'] = 0;
|
||||||
|
$filter['status'] = $event['estado'];
|
||||||
|
$filter['event_type'] = $event['event_type'];
|
||||||
|
$filter['id_agent'] = $event['id_agente'];
|
||||||
|
$filter['id_agentmodule'] = $event['id_agentmodule'];
|
||||||
|
|
||||||
$sql = events_get_all(
|
$sql = events_get_all(
|
||||||
['te.*'],
|
['te.id_evento'],
|
||||||
$filter,
|
$filter,
|
||||||
// Offset.
|
// Offset.
|
||||||
null,
|
null,
|
||||||
@ -511,18 +514,7 @@ function events_update_status($id_evento, $status, $filter=null)
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
$target_ids = db_get_all_rows_sql(
|
$target_ids = db_get_all_rows_sql($sql);
|
||||||
sprintf(
|
|
||||||
'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf
|
|
||||||
ON tu.estado = tf.estado
|
|
||||||
AND tu.evento = tf.evento
|
|
||||||
AND tu.id_agente = tf.id_agente
|
|
||||||
AND tu.id_agentmodule = tf.id_agentmodule
|
|
||||||
AND tf.max_id_evento = %d',
|
|
||||||
$sql,
|
|
||||||
$id_evento
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Try to avoid deadlock while updating full set.
|
// Try to avoid deadlock while updating full set.
|
||||||
if ($target_ids !== false && count($target_ids) > 0) {
|
if ($target_ids !== false && count($target_ids) > 0) {
|
||||||
@ -732,6 +724,13 @@ function events_get_all(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($filter['id_agentmodule']) === true && $filter['id_agentmodule'] > 0) {
|
||||||
|
$sql_filters[] = sprintf(
|
||||||
|
' AND te.id_agentmodule = %d ',
|
||||||
|
$filter['id_agentmodule']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($filter['event_type']) === false && $filter['event_type'] !== 'all') {
|
if (empty($filter['event_type']) === false && $filter['event_type'] !== 'all') {
|
||||||
if (is_array($filter['event_type']) === true) {
|
if (is_array($filter['event_type']) === true) {
|
||||||
$type = [];
|
$type = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user