From da91b4d25f4e884250cd7961f6a25f4a07ba4acd Mon Sep 17 00:00:00 2001 From: Kike Date: Mon, 29 Oct 2018 16:16:03 +0100 Subject: [PATCH] Solved errors in mobile events view --- pandora_console/include/functions_events.php | 34 +++++++++++--------- pandora_console/mobile/operation/events.php | 16 +++++---- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index ce5d2f0c42..d88e1716b9 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -95,21 +95,25 @@ function events_get_events ($filter = false, $fields = false) { * * @return mixed False in case of error or invalid values passed. Event row otherwise */ -function events_get_event ($id, $fields = false) { - if (empty ($id)) - return false; - global $config; - - if (is_array ($fields)) { - if (! in_array ('id_grupo', $fields)) - $fields[] = 'id_grupo'; - } - - $event = db_get_row ('tevento', 'id_evento', $id, $fields); - if (! check_acl ($config['id_user'], $event['id_grupo'], 'ER')) - return false; - - return $event; +function events_get_event ($id, $fields = false, $meta = false) { + if (empty ($id)) + return false; + global $config; + + if (is_array ($fields)) { + if (! in_array ('id_grupo', $fields)) + $fields[] = 'id_grupo'; + } + + if ($meta === true){ + $event = db_get_row ('tmetaconsole_event', 'id_evento', $id, $fiel ds); + }else{ + $event = db_get_row ('tevento', 'id_evento', $id, $fields); + } + if (! check_acl ($config['id_user'], $event['id_grupo'], 'ER')) + return false; + + return $event; } function events_get_events_no_grouped($sql_post, $offset = 0, $pagination = 1, $meta = false, $history = false, $total = false, diff --git a/pandora_console/mobile/operation/events.php b/pandora_console/mobile/operation/events.php index d60fc248cc..064ecf65d1 100644 --- a/pandora_console/mobile/operation/events.php +++ b/pandora_console/mobile/operation/events.php @@ -297,7 +297,7 @@ class Events { $id_event = $system->getRequest('id_event', 0); - if (events_change_status($id_event, EVENT_VALIDATE)) { + if (events_change_status($id_event, EVENT_VALIDATE,$system->getConfig('metaconsole'))) { echo json_encode(array('correct' => 1)); } else { @@ -379,11 +379,15 @@ class Events { $this->default_filters['severity'] = false; } - $this->filter = $system->getRequest('filter', __('Preset Filters')); - if (($this->filter === __("Preset Filters")) || ($this->filter == 0)) { - $this->filter = 0; - } - else { + if ($system->getRequest('filter', __('Preset Filters')) === __("Preset Filters")) { + //Set filter as default user event filter (only first time) + $this->filter = db_get_value('default_event_filter', 'tusuario', 'id_user', $system->getConfig('id_user')); + } + else { + $this->filter = $system->getRequest('filter', __('Preset Filters')); + } + + if ($this->filter != 0) { $this->default = false; }