From da91b4d25f4e884250cd7961f6a25f4a07ba4acd Mon Sep 17 00:00:00 2001 From: Kike Date: Mon, 29 Oct 2018 16:16:03 +0100 Subject: [PATCH 1/3] 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; } From 8b53dbc444a38444c398d1071a1585f5320e50cf Mon Sep 17 00:00:00 2001 From: Kike Date: Mon, 29 Oct 2018 17:44:09 +0100 Subject: [PATCH 2/3] Corrected typing error --- pandora_console/include/functions_events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index d88e1716b9..cf9016b749 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -106,7 +106,7 @@ function events_get_event ($id, $fields = false, $meta = false) { } if ($meta === true){ - $event = db_get_row ('tmetaconsole_event', 'id_evento', $id, $fiel ds); + $event = db_get_row ('tmetaconsole_event', 'id_evento', $id, $fields); }else{ $event = db_get_row ('tevento', 'id_evento', $id, $fields); } From 65d4c5aab7d2b25b1a2ab184e5babca91dd58da9 Mon Sep 17 00:00:00 2001 From: Kike Date: Wed, 16 Jan 2019 17:53:32 +0100 Subject: [PATCH 3/3] Included control for user set filter and admin set filter Former-commit-id: fe0ae14537a558e8f3ce423fd761a653ff8168e7 --- pandora_console/mobile/operation/events.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pandora_console/mobile/operation/events.php b/pandora_console/mobile/operation/events.php index 064ecf65d1..ae61e2e9b1 100644 --- a/pandora_console/mobile/operation/events.php +++ b/pandora_console/mobile/operation/events.php @@ -380,9 +380,14 @@ class Events { } 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')); - } + //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')); + + //Use user set default filter if admin set default filter is "none" + if ($this->filter == 0){ + $this->filter = db_get_value('id_filter', 'tusuario', 'id_user', $system->getConfig('id_user')); + } + } else { $this->filter = $system->getRequest('filter', __('Preset Filters')); }