Added changes to sort json in ajax return
This commit is contained in:
parent
62b4ed9b2d
commit
50e7e5fc17
|
@ -3029,7 +3029,10 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$javascript = $parameters['javascript'];
|
||||
}
|
||||
|
||||
|
||||
$get_order_json = false;
|
||||
if (isset($parameters['get_order_json'])) {
|
||||
$get_order_json = true;
|
||||
}
|
||||
|
||||
$javascript_is_function_select = false; //Default value
|
||||
if (isset($parameters['javascript_is_function_select'])) {
|
||||
|
@ -3116,6 +3119,10 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
if (' . ((int) !$metaconsole_enabled) . ') {
|
||||
inputs.push ("force_local_modules=1");
|
||||
}
|
||||
|
||||
if (' . ((int) $get_order_json) . ') {
|
||||
inputs.push ("get_order_json=1");
|
||||
}
|
||||
|
||||
if (' . ((int)$metaconsole_enabled) . ') {
|
||||
if ((' . ((int)$use_input_server) . ')
|
||||
|
|
|
@ -291,6 +291,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
$params['use_hidden_input_idagent'] = true;
|
||||
$params['print_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_name'] = 'id_agent';
|
||||
$params['get_order_json'] = true;
|
||||
if (defined('METACONSOLE')) {
|
||||
$params['javascript_ajax_page'] = '../../ajax.php';
|
||||
$params['disabled_javascript_on_blur_function'] = true;
|
||||
|
|
|
@ -702,6 +702,18 @@ if (is_ajax ()) {
|
|||
foreach ($agent_modules as $key => $module) {
|
||||
$agent_modules[$key]['nombre'] = io_safe_output($module['nombre']);
|
||||
}
|
||||
|
||||
$get_order_json = (bool)get_parameter('get_order_json', false);
|
||||
if ($get_order_json) {
|
||||
$new_elements = array();
|
||||
$index = 0;
|
||||
foreach ($agent_modules as $key => $module) {
|
||||
$new_elements[$index]['id_agente_modulo'] = $module['id_agente_modulo'];
|
||||
$new_elements[$index]['nombre'] = io_safe_output($module['nombre']);
|
||||
$index++;
|
||||
}
|
||||
$agent_modules = $new_elements;
|
||||
}
|
||||
|
||||
echo json_encode ($agent_modules);
|
||||
|
||||
|
|
Loading…
Reference in New Issue