Merge branch 'ent-8454-Error-SQL-en-bulk-operations-en-copia-de-modulos' into 'develop'

fixed bulk copy of modules with percent character

See merge request artica/pandorafms!4639
This commit is contained in:
vgilc 2022-01-25 10:41:43 +00:00
commit a32fe84ca0
2 changed files with 21 additions and 8 deletions

View File

@ -910,7 +910,11 @@ function agents_process_manage_config($source_id_agent, $destiny_id_agents, $cop
[
'nombre' => $module['nombre'],
'disabled' => false,
]
],
true,
true,
false,
false
);
// Keep all modules repeated
@ -1443,7 +1447,8 @@ function agents_get_modules(
$filter=false,
$indexed=true,
$get_not_init_modules=true,
$force_tags=false
$force_tags=false,
$filter_include_sql=true
) {
global $config;
@ -1542,18 +1547,18 @@ function agents_get_modules(
}
}
if ($value[0] == '%') {
if ($value[0] == '%' && $filter_include_sql === true) {
array_push(
$fields,
$field.' LIKE "'.$value.'"'
);
} else if ($operatorDistin) {
} else if ($operatorDistin && $filter_include_sql === true) {
array_push($fields, $field.' <> '.substr($value, 2));
} else if (substr($value, -1) == '%') {
} else if (substr($value, -1) == '%' && $filter_include_sql === true) {
array_push($fields, $field.' LIKE "'.$value.'"');
} else if (strncmp($value, '666=666', 7) == 0) {
array_push($fields, ' '.$value);
} else if (preg_match('/\bin\b/i', $field)) {
} else if (preg_match('/\bin\b/i', $field) && $filter_include_sql === true) {
array_push($fields, $field.' '.$value);
} else {
array_push($fields, 'tagente_modulo.'.$field.' = "'.$value.'"');

View File

@ -189,7 +189,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
[
'nombre' => $module['nombre'],
'disabled' => false,
]
],
true,
true,
false,
false
);
// The module already exist in the target
@ -203,7 +207,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent,
[
'nombre' => $module['nombre'],
'disabled' => true,
]
],
true,
true,
false,
false
);
// If the module exist but disabled, we enable it