Ad Widget

Collapse

Add actions from template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Karkinjub Marakint
    Junior Member
    • Jul 2005
    • 5

    #1

    Add actions from template

    When adding items, triggers and actions from template the template actions messages doesn't change and there will have refererences to template hostname.
    So I use this patch to change the actions messages automatically

    Code:
    --- config.inc.php.orig 2005-05-28 19:16:40.000000000 +0400
    +++ config.inc.php      2005-07-12 11:59:01.000000000 +0400
    @@ -1573,6 +1573,7 @@
                    }
    
                    $host=get_host_by_hostid($hostid);
    +               $host_template=get_host_by_hostid($host_templateid);
                    $sql="select itemid from items where hostid=$host_templateid";
                    $result=DBselect($sql);
                    while($row=DBfetch($result))
    @@ -1619,6 +1620,7 @@
                                            $delay=$action["delay"];
                                            $subject=addslashes($action["subject"]);
                                            $message=addslashes($action["message"]);
    +                                       $message=str_replace("{".$host_template["host"].":", "{".$host["host"].":", $message);
                                            $recipient=$action["recipient"];
                                            $sql="insert into actions (triggerid, userid, scope, severity, good, delay, subject, message,recipient) values ($triggerid,$userid,$scope,$severity,$good,$delay,'$subject','$message',$recipient)";
     //                                     echo "$sql<br>";
    Last edited by Karkinjub Marakint; 12-07-2005, 10:15.
Working...