mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
2012-03-08 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* godmode/agentes/module_manager.php godmode/agentes/configurar_agente.php: Modification in order to delete synthetics modules or synth module components when a synth module is deleted. Fixes: #3496210 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5723 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b3335a3240
commit
5eb8b91f2d
@ -1,3 +1,12 @@
|
|||||||
|
2012-03-08 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||||
|
|
||||||
|
* godmode/agentes/module_manager.php
|
||||||
|
godmode/agentes/configurar_agente.php: Modification in order to
|
||||||
|
delete synthetics modules or synth module components when a synth
|
||||||
|
module is deleted.
|
||||||
|
|
||||||
|
Fixes: #3496210
|
||||||
|
|
||||||
2012-03-08 Miguel de Dios <miguel.dedios@artica.es>
|
2012-03-08 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* include/javascript/jquery-1.7.1.js,
|
* include/javascript/jquery-1.7.1.js,
|
||||||
|
@ -979,6 +979,37 @@ if ($delete_module) { // DELETE agent module !
|
|||||||
if ($result === false)
|
if ($result === false)
|
||||||
$error++;
|
$error++;
|
||||||
|
|
||||||
|
// Trick to detect if we are deleting a synthetic module (avg or arithmetic)
|
||||||
|
// If result is empty then module doesn't have this type of submodules
|
||||||
|
$ops_json = enterprise_hook('modules_get_synthetic_operations', array($id_borrar_modulo));
|
||||||
|
$result_ops_synthetic = json_decode($ops_json);
|
||||||
|
if (!empty($result_ops_synthetic)){
|
||||||
|
$result = enterprise_hook('modules_delete_synthetic_operations', array($id_borrar_modulo));
|
||||||
|
if ($result === false)
|
||||||
|
$error++;
|
||||||
|
} // Trick to detect if we are deleting components of synthetics modules (avg or arithmetic)
|
||||||
|
else{
|
||||||
|
$result_components = enterprise_hook('modules_get_synthetic_components', array($id_borrar_modulo));
|
||||||
|
$count_components = 1;
|
||||||
|
if (!empty($result_components)){
|
||||||
|
// Get number of components pending to delete to know when it's needed to update orders
|
||||||
|
$num_components = count($result_components);
|
||||||
|
$last_target_module = 0;
|
||||||
|
foreach ($result_components as $id_target_module){
|
||||||
|
// Detects change of component or last component to update orders
|
||||||
|
if (($count_components == $num_components) or ($last_target_module != $id_target_module))
|
||||||
|
$update_orders = true;
|
||||||
|
else
|
||||||
|
$update_orders = false;
|
||||||
|
$result = enterprise_hook('modules_delete_synthetic_operations', array($id_target_module, $id_borrar_modulo, $update_orders));
|
||||||
|
|
||||||
|
if ($result === false)
|
||||||
|
$error++;
|
||||||
|
$count_components++;
|
||||||
|
$last_target_module = $id_target_module;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Check for errors
|
//Check for errors
|
||||||
if ($error != 0) {
|
if ($error != 0) {
|
||||||
|
@ -142,6 +142,39 @@ if ($multiple_delete) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Trick to detect if we are deleting a synthetic module (avg or arithmetic)
|
||||||
|
// If result is empty then module doesn't have this type of submodules
|
||||||
|
$ops_json = enterprise_hook('modules_get_synthetic_operations', array($id_agent_module_del));
|
||||||
|
$result_ops_synthetic = json_decode($ops_json);
|
||||||
|
if (!empty($result_ops_synthetic)){
|
||||||
|
$result = enterprise_hook('modules_delete_synthetic_operations', array($id_agent_module_del));
|
||||||
|
if ($result === false)
|
||||||
|
$error++;
|
||||||
|
} // Trick to detect if we are deleting components of synthetics modules (avg or arithmetic)
|
||||||
|
else{
|
||||||
|
$result_components = enterprise_hook('modules_get_synthetic_components', array($id_agent_module_del));
|
||||||
|
$count_components = 1;
|
||||||
|
if (!empty($result_components)){
|
||||||
|
// Get number of components pending to delete to know when it's needed to update orders
|
||||||
|
$num_components = count($result_components);
|
||||||
|
$last_target_module = 0;
|
||||||
|
foreach ($result_components as $id_target_module){
|
||||||
|
// Detects change of component or last component to update orders
|
||||||
|
if (($count_components == $num_components) or ($last_target_module != $id_target_module))
|
||||||
|
$update_orders = true;
|
||||||
|
else
|
||||||
|
$update_orders = false;
|
||||||
|
$result = enterprise_hook('modules_delete_synthetic_operations', array($id_target_module, $id_agent_module_del, $update_orders));
|
||||||
|
if ($result === false)
|
||||||
|
$error++;
|
||||||
|
$count_components++;
|
||||||
|
$last_target_module = $id_target_module;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Check for errors
|
//Check for errors
|
||||||
if ($error != 0) {
|
if ($error != 0) {
|
||||||
db_process_sql_rollback ();
|
db_process_sql_rollback ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user