From 02734c3b1198fcb5879b0b62d586fcd993f64faa Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Fri, 22 Jan 2016 12:25:05 +0100 Subject: [PATCH] Fixed the massive operations in plugins. TICKET: #3221 --- .../godmode/massive/massive_edit_plugins.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/massive/massive_edit_plugins.php b/pandora_console/godmode/massive/massive_edit_plugins.php index 504830ef58..a7d35a3e64 100644 --- a/pandora_console/godmode/massive/massive_edit_plugins.php +++ b/pandora_console/godmode/massive/massive_edit_plugins.php @@ -163,7 +163,8 @@ if ($update) { 'id_agente' => $agent_ids, 'nombre' => $module_names ); - $module_plugin_macros = db_get_all_rows_filter('tagente_modulo', $filter, $fields); + $module_plugin_macros = db_get_all_rows_filter( + 'tagente_modulo', $filter, $fields); if (empty($module_plugin_macros)) $module_plugin_macros = array(); // Error @@ -182,12 +183,16 @@ if ($update) { // Macros retrieved from the agent module $module_macros = json_decode($module_macros_str, true); + // Error if (empty($module_macros)) - throw new Exception(__('Error retrieving the module plugin macros data')); + throw new Exception( + __('Error retrieving the module plugin macros data')); + // Get the new module plugin macros - $result_macros = array_map(function ($item) use ($macros, $module_macros) { + $result_macros = array_map( + function ($item) use ($macros, $module_macros) { $result = array( 'macro' => $item['macro'], @@ -218,7 +223,9 @@ if ($update) { if (empty($result_macros)) throw new Exception(__('Error building the new macros')); - $module_macros = json_encode($result_macros); + + + $module_macros = json_encode($result_macros, JSON_FORCE_OBJECT); if (empty($module_macros)) { $module_macros = $module_macros_str; }