2010-09-21 Junichi Satoh <junichi@rworks.jp>
* godmode/massive/massive_add_action_alerts.php, godmode/massive/massive_delete_action_alerts.php: Fixed addition/deletion for compound alerts does not work. * include/functions_alerts.php: To fix above problem, added a function, delete_alert_compound_action(). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3264 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
2a6538106a
commit
933e50b145
|
@ -1,3 +1,12 @@
|
|||
2010-09-21 Junichi Satoh <junichi@rworks.jp>
|
||||
|
||||
* godmode/massive/massive_add_action_alerts.php,
|
||||
godmode/massive/massive_delete_action_alerts.php: Fixed
|
||||
addition/deletion for compound alerts does not work.
|
||||
|
||||
* include/functions_alerts.php: To fix above problem, added a function,
|
||||
delete_alert_compound_action().
|
||||
|
||||
2010-09-20 Raúl Mateos <raulofpandora@gmail.com>
|
||||
|
||||
* operation/agentes/customfields.php: Add code to show text when no
|
||||
|
|
|
@ -48,8 +48,10 @@ if ($add) {
|
|||
$cont = $cont + 1;
|
||||
}
|
||||
|
||||
$cont = 0;
|
||||
$agent_alerts_id_compound = array();
|
||||
foreach($agent_alerts['compounds'] as $agent_alert){
|
||||
$agent_alerts_id[$cont] = $agent_alert['id'];
|
||||
$agent_alerts_id_compound[$cont] = $agent_alert['id'];
|
||||
$cont = $cont + 1;
|
||||
}
|
||||
|
||||
|
@ -67,6 +69,12 @@ if ($add) {
|
|||
$results = false;
|
||||
}
|
||||
|
||||
foreach($agent_alerts_id_compound as $agent_alert_id_compound) {
|
||||
$result = add_alert_compound_action ($agent_alert_id_compound, $action, $options);
|
||||
if($result === false)
|
||||
$results = false;
|
||||
}
|
||||
|
||||
print_result_message ($results, __('Successfully added'), __('Could not be added'));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -45,8 +45,11 @@ if ($delete) {
|
|||
$alerts_agent_modules = array_merge($alerts_agent_modules, get_alerts_agent_module ($agent_alert['id_agent_module'], true, false, 'id'));
|
||||
}
|
||||
|
||||
$cont = 0;
|
||||
$alerts_compound = array();
|
||||
foreach($agent_alerts['compounds'] as $agent_alert){
|
||||
$alerts_agent_modules = array_merge($alerts_agent_modules, get_alerts_agent_module ($agent_alert['id'], false, false, 'id'));
|
||||
$alerts_compound[$cont] = $agent_alert['id'];
|
||||
$cont = $cont + 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,7 +61,6 @@ if ($delete) {
|
|||
|
||||
foreach ($agent_module_actions as $agent_module_action){
|
||||
if($agent_module_action['id_alert_action'] == $action) {
|
||||
echo $agent_module_action['id']." . ". $alert_agent_module['id'] ." ; ";
|
||||
$result = delete_alert_agent_module_action ($agent_module_action['id']);
|
||||
|
||||
if($result === false)
|
||||
|
@ -67,6 +69,17 @@ if ($delete) {
|
|||
}
|
||||
}
|
||||
|
||||
foreach($alerts_compound as $alert_compound) {
|
||||
$compound_actions = get_alert_compound_actions ($alert_compound['id'], array('id','id_alert_action'));
|
||||
foreach ($compound_actions as $compound_action) {
|
||||
if ($compound_action['id_alert_action'] == $action) {
|
||||
$result = delete_alert_compound_action($compound_action['id']);
|
||||
if($result === false)
|
||||
$results = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print_result_message ($results, __('Successfully deleted'), __('Could not be deleted')/*.": ". $agent_alerts['simple'][0]['id']*/);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -827,6 +827,14 @@ function add_alert_compound_action ($id_alert_compound, $id_alert_action, $optio
|
|||
return (@process_sql_insert ('talert_compound_actions', $values)) !== false;
|
||||
}
|
||||
|
||||
function delete_alert_compound_action ($id_alert_compound_action) {
|
||||
if (empty ($id_alert_compound_action))
|
||||
return false;
|
||||
|
||||
return (@process_sql_delete ('talert_compound_actions',
|
||||
array ('id' => $id_alert_compound_action))) !== false;
|
||||
}
|
||||
|
||||
function set_alerts_compound_disable ($id_alert_compound, $disabled) {
|
||||
$id_alert_agent_module = safe_int ($id_alert_compound, 0);
|
||||
return (@process_sql_update ('talert_compound',
|
||||
|
|
Loading…
Reference in New Issue