Merge branch 'ent-12909-guardia17097-campos-pluginserver-no-se-guardan-en-politicas-772-3' into 'develop'

Ent 12909 [GUARDIA][#17097] Campos pluginserver no se guardan en políticas 772.3.

See merge request artica/pandorafms!6954
This commit is contained in:
Matias Didier 2024-02-21 12:36:42 +00:00
commit 2f6a95dea5
3 changed files with 40 additions and 18 deletions

View File

@ -164,12 +164,13 @@ foreach ($password_fields as $k => $p) {
return;
}
const moduleId = <?php echo $id_agent_module; ?>;
const moduleId = <?php echo ($module['id_policy'] > 0) ? $module['id'] : $id_agent_module; ?>;
const isPolicy = <?php echo ($module['id_policy'] > 0) ? '1' : '0'; ?>;
load_plugin_description($("#id_plugin").val());
load_plugin_macros_fields('simple-macro', moduleId);
load_plugin_macros_fields('simple-macro', moduleId, isPolicy);
forced_title_callback();
$('select#id_plugin').select2('close');

View File

@ -41,6 +41,7 @@ if (check_login()) {
$get_plugin_macros = get_parameter('get_plugin_macros');
$get_module_macros = get_parameter('get_module_macros');
$is_policy = (bool) get_parameter('is_policy', 0);
$search_modules = get_parameter('search_modules');
$get_module_detail = get_parameter('get_module_detail', 0);
$get_module_autocomplete_input = (bool) get_parameter(
@ -104,12 +105,22 @@ if (check_login()) {
$id_plugin = get_parameter('id_plugin', 0);
if ($id_plugin !== 0) {
$id_module_plugin = db_get_value(
'id_plugin',
'tagente_modulo',
'id_agente_modulo',
$get_module_macros
);
if ($is_policy === true) {
$id_module_plugin = db_get_value(
'id_plugin',
'tpolicy_modules',
'id',
$get_module_macros
);
} else {
$id_module_plugin = db_get_value(
'id_plugin',
'tagente_modulo',
'id_agente_modulo',
$get_module_macros
);
}
if ($id_plugin !== $id_module_plugin) {
$get_plugin_macros = true;
$get_module_macros = 0;
@ -145,12 +156,21 @@ if (check_login()) {
$module_id = $get_module_macros;
$module_macros = db_get_value(
'macros',
'tagente_modulo',
'id_agente_modulo',
$module_id
);
if ($is_policy === true) {
$module_macros = db_get_value(
'macros',
'tpolicy_modules',
'id',
$module_id
);
} else {
$module_macros = db_get_value(
'macros',
'tagente_modulo',
'id_agente_modulo',
$module_id
);
}
$macros = [];
$macros['base64'] = base64_encode($module_macros);

View File

@ -1011,7 +1011,7 @@ function add_macro_field(macro, row_model_id, type_copy, k) {
$("#" + row_id).show();
}
function load_plugin_macros_fields(row_model_id, moduleId = 0) {
function load_plugin_macros_fields(row_model_id, moduleId = 0, is_policy = 0) {
// Get plugin macros when selected and load macros fields
var id_plugin = $("#id_plugin").val();
@ -1024,6 +1024,7 @@ function load_plugin_macros_fields(row_model_id, moduleId = 0) {
params.push("get_plugin_macros=1");
}
params.push("id_plugin=" + id_plugin);
params.push("is_policy=" + is_policy);
jQuery.ajax({
data: params.join("&"),