2012-06-12 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_modules.php
	 include/functions_agents.php: Fixed problem when modules are 
	 repeated in source and target agents. 
	 
	* operation/events/events_list.php: Delete double confirmation when
	an event is deleted.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6518 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2012-06-12 15:45:37 +00:00
parent 6027e18192
commit 7c208fe177
4 changed files with 42 additions and 7 deletions

View File

@ -1,3 +1,12 @@
2012-06-12 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_modules.php
include/functions_agents.php: Fixed problem when modules are
repeated in source and target agents.
* operation/events/events_list.php: Delete double confirmation when
an event is deleted.
2012-06-12 Miguel de Dios <miguel.dedios@artica.es> 2012-06-12 Miguel de Dios <miguel.dedios@artica.es>
* images/console/icons/light_ok.png, images/console/icons/light.png: * images/console/icons/light_ok.png, images/console/icons/light.png:

View File

@ -618,13 +618,38 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co
break; break;
} }
$error = false; $error = false;
$repeated_modules = array();
foreach ($destiny_id_agents as $id_destiny_agent) { foreach ($destiny_id_agents as $id_destiny_agent) {
foreach ($target_modules as $id_agent_module) { foreach ($target_modules as $id_agent_module) {
$result = modules_copy_agent_module_to_agent ($id_agent_module,
$id_destiny_agent); // Check the module name exists in target
$module = modules_get_agentmodule ($id_agent_module);
if ($result === false) { if ($module === false)
return false;
$modules = agents_get_modules ($id_destiny_agent, false,
array ('nombre' => $module['nombre'], 'disabled' => false));
// Keep all modules repeated
if (! empty ($modules)) {
$modules_repeated = array_pop (array_keys ($modules));
$result = $modules_repeated;
$repeated_modules[] = $modules_repeated;
}
else {
$result = modules_copy_agent_module_to_agent ($id_agent_module,
$id_destiny_agent);
if ($result === false) {
$error = true;
break;
}
}
// Check if all modules are repeated and no alerts are copied, if YES then error
if (empty($target_alerts) and count($repeated_modules) == count($target_modules)) {
$error = true; $error = true;
break; break;
} }

View File

@ -47,7 +47,8 @@ function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent
$modules = agents_get_modules ($id_destiny_agent, false, $modules = agents_get_modules ($id_destiny_agent, false,
array ('nombre' => $module['nombre'], 'disabled' => false)); array ('nombre' => $module['nombre'], 'disabled' => false));
// These are the modules that exists in the target
if (! empty ($modules)) if (! empty ($modules))
return array_pop (array_keys ($modules)); return array_pop (array_keys ($modules));

View File

@ -829,7 +829,7 @@ foreach ($result as $event) {
// Delete event // Delete event
if (check_acl ($config["id_user"], $event["id_grupo"], "IM") == 1) { if (check_acl ($config["id_user"], $event["id_grupo"], "IM") == 1) {
if($event['estado'] != 2) { if($event['estado'] != 2) {
$data[$i] .= '<a class="delete_event" href="#" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;" id="delete-'.$event['id_evento'].'">'; $data[$i] .= '<a class="delete_event" href="#" id="delete-'.$event['id_evento'].'">';
$data[$i] .= html_print_image ("images/cross.png", true, $data[$i] .= html_print_image ("images/cross.png", true,
array ("title" => __('Delete event'), "id" => 'delete_cross_' . $event['id_evento'])); array ("title" => __('Delete event'), "id" => 'delete_cross_' . $event['id_evento']));
$data[$i] .= '</a>&nbsp;'; $data[$i] .= '</a>&nbsp;';