Merge branch '2858-Mensaje-de-error-poco-descriptivo-en-alertas' into 'develop'

2858 mensaje de error poco descriptivo en alertas

See merge request artica/pandorafms!1825
This commit is contained in:
vgilc 2018-10-25 11:14:31 +02:00
commit e0f7d1310b
5 changed files with 81 additions and 13 deletions

View File

@ -179,9 +179,23 @@ if ($create_action) {
db_pandora_audit("Command management", "Fail try to create alert action", false, false);
}
ui_print_result_message ($result,
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
if ($name == "") {
$messageAction = __('No name specified');
}
if ($id_alert_command == "") {
$messageAction = __('No command specified');
}
$messageAction = ui_print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
$messageAction);
}
if ($update_action) {

View File

@ -307,9 +307,22 @@ if ($create_command) {
db_pandora_audit("Command management", "Fail try to create alert command", false, false);
}
ui_print_result_message ($result,
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
if ($name == "") {
$messageAction = __('No name specified');
}
if ($command == "") {
$messageAction = __('No command specified');
}
$messageAction = ui_print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
$messageAction);
}

View File

@ -126,9 +126,24 @@ if ($create_alert) {
"Fail Added alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'");
}
$messageAction = ui_print_result_message ($id,
__('Successfully created'), __('Could not be created'), '', true);
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
if ($id_alert_template == "") {
$messageAction = __('No template specified');
}
if ($id_agent_module == "") {
$messageAction = __('No module specified');
}
$messageAction = ui_print_result_message ($id,
__('Successfully created'), $messageAction, '', true);
if ($id !== false) {
$action_select = get_parameter('action_select');

View File

@ -130,6 +130,7 @@ if ($create_special_day) {
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
if ($date_check == $date) {
$result = '';
$messageAction = __('Could not be created, it already exists');
}
else {
$result = alerts_create_alert_special_day ($date, $same_day, $values);
@ -143,10 +144,16 @@ if ($create_special_day) {
else {
db_pandora_audit("Command management", "Fail try to create special day", false, false);
}
ui_print_result_message ($result,
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
$messageAction = ui_print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
$messageAction);
}
if ($update_special_day) {
@ -183,6 +190,7 @@ if ($update_special_day) {
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
if ($date_check == $date) {
$result = '';
$messageAction = __('Could not be updated, it already exists');
}
else {
$result = alerts_update_alert_special_day ($id, $values);
@ -202,9 +210,15 @@ if ($update_special_day) {
db_pandora_audit("Command management", "Fail to update special day " . $id, false, false);
}
ui_print_result_message ($result,
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be updated');
}
$messageAction = ui_print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
$messageAction);
}
if ($delete_special_day) {

View File

@ -428,9 +428,21 @@ if ($create_template) {
json_encode($values));
}
ui_print_result_message ($result,
/* Show errors */
if (!isset($messageAction)) {
$messageAction = __('Could not be created');
}
if ($name == "") {
$messageAction = __('No template name specified');
}
$messageAction = ui_print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
$messageAction);
/* Go to previous step in case of error */
if ($result === false)
$step = $step - 1;