summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2003-11-14 20:09:33 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2003-11-14 20:09:33 +0000
commit7a090a7350c7fc1f21bbde1b74ce2fa0fcb43f22 (patch)
tree2bd0ec6171379dc659de094417b6741554f066b9 /frontends/php/include
parent62ec268eedf7e25115d41f28ed38ac59c7fed2b7 (diff)
downloadzabbix-7a090a7350c7fc1f21bbde1b74ce2fa0fcb43f22.tar.gz
zabbix-7a090a7350c7fc1f21bbde1b74ce2fa0fcb43f22.tar.xz
zabbix-7a090a7350c7fc1f21bbde1b74ce2fa0fcb43f22.zip
- add actions when using templates. (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@1027 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/config.inc.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 9360789c..6122744d 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -485,6 +485,23 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return "$priorities,$md5sum";
}
+ function get_action_by_actionid($actionid)
+ {
+ global $ERROR_MSG;
+
+ $sql="select * from actions where actionid=$actionid";
+ $result=DBselect($sql);
+ if(DBnum_rows($result) == 1)
+ {
+ return DBfetch($result);
+ }
+ else
+ {
+ $ERROR_MSG="No action with actionid=[$actionid]";
+ }
+ return $result;
+ }
+
function get_user_by_userid($userid)
{
global $ERROR_MSG;
@@ -2599,6 +2616,23 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
$sql="update triggers set expression='".$trigger["expression"]."' where triggerid=$triggerid";
DBexecute($sql);
}
+ # Add actions
+ $sql="select actionid from actions where triggerid=".$row2["triggerid"];
+ $result3=DBselect($sql);
+ while($row3=DBfetch($result3))
+ {
+ $action=get_action_by_actionid($row3["actionid"]);
+ $userid=$action["userid"];
+ $scope=$action["scope"];
+ $severity=$action["severity"];
+ $good=$action["good"];
+ $delay=$action["delay"];
+ $subject=$action["subject"];
+ $message=$action["message"];
+ $sql="insert into actions (triggerid, userid, scope, severity, good, delay, subject, message) values ($triggerid,$itemid,$userid,$scope,$severity,$good,'$subject','$message')";
+ $result4=DBexecute($sql);
+ $actionid=DBinsert_id($result4,"actions","actionid");
+ }
}
}