mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
fix rerors selectors pandora_enterprise#12665
This commit is contained in:
parent
2fef90895e
commit
ae43f8a948
@ -236,17 +236,39 @@ if ($add_module === true) {
|
|||||||
$id_modules
|
$id_modules
|
||||||
);
|
);
|
||||||
|
|
||||||
$id_agent_modules = db_get_all_rows_sql(
|
$sql = sprintf(
|
||||||
'SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente IN ('.implode(',', $id_agents).") AND nombre IN ('".implode("','", $id_modules)."')"
|
'SELECT id_agente_modulo
|
||||||
|
FROM tagente_modulo
|
||||||
|
WHERE id_agente IN (%s)
|
||||||
|
AND nombre IN ("%s")',
|
||||||
|
implode(',', $id_agents),
|
||||||
|
implode('","', $id_modules)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$id_agent_modules = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
||||||
$order = db_get_row_sql("SELECT `field_order` from tgraph_source WHERE id_graph=$id_graph ORDER BY `field_order` DESC");
|
$sql_order = sprintf(
|
||||||
|
'SELECT `field_order`
|
||||||
|
FROM tgraph_source
|
||||||
|
WHERE id_graph=%d
|
||||||
|
ORDER BY `field_order` DESC',
|
||||||
|
$id_graph
|
||||||
|
);
|
||||||
|
$order = db_get_row_sql($sql_order);
|
||||||
|
|
||||||
$order = $order['field_order'];
|
$order = $order['field_order'];
|
||||||
foreach ($id_agent_modules as $id_agent_module) {
|
foreach ($id_agent_modules as $id_agent_module) {
|
||||||
$order++;
|
$order++;
|
||||||
$result = db_process_sql_insert('tgraph_source', ['id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight, 'field_order' => $order]);
|
$result = db_process_sql_insert(
|
||||||
|
'tgraph_source',
|
||||||
|
[
|
||||||
|
'id_graph' => $id_graph,
|
||||||
|
'id_agent_module' => $id_agent_module['id_agente_modulo'],
|
||||||
|
'weight' => $weight,
|
||||||
|
'field_order' => $order,
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = false;
|
$result = false;
|
||||||
|
@ -3857,11 +3857,11 @@ function get_modules_agents(
|
|||||||
|
|
||||||
$modules = array_reduce(
|
$modules = array_reduce(
|
||||||
$modules,
|
$modules,
|
||||||
function ($carry, $item) use ($id_agents, $selection) {
|
function ($carry, $item) use ($id_agents, $selection, $useName) {
|
||||||
if (count($id_agents) > 1 && (bool) $selection === true) {
|
if (count($id_agents) > 1 && (bool) $selection === true) {
|
||||||
$carry[$item['id_agente_modulo']] = $item['alias'].' » '.$item['nombre'];
|
$carry[($useName === true) ? io_safe_output($item['nombre']) : $item['id_agente_modulo']] = $item['alias'].' » '.$item['nombre'];
|
||||||
} else {
|
} else {
|
||||||
$carry[$item['id_agente_modulo']] = $item['nombre'];
|
$carry[($useName === true) ? io_safe_output($item['nombre']) : $item['id_agente_modulo']] = $item['nombre'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $carry;
|
return $carry;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user