Added warning icon to actions that does not match with their commands

This commit is contained in:
fermin831 2018-10-22 16:48:24 +02:00
parent d8a7ebea08
commit 7e8fbb4568
1 changed files with 17 additions and 5 deletions

View File

@ -236,9 +236,13 @@ $table->align[3] = 'left';
$filter = array(); $filter = array();
if (!is_user_admin($config['id_user'])) if (!is_user_admin($config['id_user']))
$filter['id_group'] = array_keys(users_get_groups(false, "LM")); $filter['talert_actions.id_group'] = array_keys(users_get_groups(false, "LM"));
$actions = db_get_all_rows_filter ('talert_actions', $filter); $actions = db_get_all_rows_filter (
'talert_actions INNER JOIN talert_commands ON talert_actions.id_alert_command = talert_commands.id',
$filter,
'talert_actions.* , talert_commands.id_group AS command_group'
);
if ($actions === false) if ($actions === false)
$actions = array (); $actions = array ();
@ -257,6 +261,14 @@ foreach ($actions as $action) {
$data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'. $data[0] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'&pure='.$pure.'">'.
$action['name'].'</a>'; $action['name'].'</a>';
$data[1] = ui_print_group_icon ($action["id_group"], true) .'&nbsp;'; $data[1] = ui_print_group_icon ($action["id_group"], true) .'&nbsp;';
if (!alerts_validate_command_to_action($action["id_group"], $action["command_group"])) {
$data[1].= html_print_image(
"images/error.png",
true,
// FIXME: Translation.
array("title" => __("The command and the action are not in the same group. Please, contact with an administrator to solve it.")
));
}
if (check_acl($config['id_user'], $action["id_group"], "LM")) { if (check_acl($config['id_user'], $action["id_group"], "LM")) {
$data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&amp;copy_action=1&amp;id='.$action['id'].'&pure='.$pure.'" $data[2] = '<a href="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&amp;copy_action=1&amp;id='.$action['id'].'&pure='.$pure.'"