summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/import.inc.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-02 08:34:41 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-02 08:34:41 +0000
commit82e68eabae069748d6691cab742f5fde436a56cb (patch)
tree17d7ca73441a35f93acd529c47caaf7387973382 /frontends/php/include/import.inc.php
parent83b5e44b019bfa89d96c3e14a903497eb93bcde7 (diff)
downloadzabbix-82e68eabae069748d6691cab742f5fde436a56cb.tar.gz
zabbix-82e68eabae069748d6691cab742f5fde436a56cb.tar.xz
zabbix-82e68eabae069748d6691cab742f5fde436a56cb.zip
- added possibility to add triggers with same description but different expression
- fixes in export (Artem) git-svn-id: svn://svn.zabbix.com/trunk@5575 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/import.inc.php')
-rw-r--r--frontends/php/include/import.inc.php23
1 files changed, 15 insertions, 8 deletions
diff --git a/frontends/php/include/import.inc.php b/frontends/php/include/import.inc.php
index b36bcc46..242f4871 100644
--- a/frontends/php/include/import.inc.php
+++ b/frontends/php/include/import.inc.php
@@ -461,15 +461,22 @@
$data['expression'] = str_replace('{HOSTNAME}',
$this->data[XML_TAG_HOST]['name'],
$data['expression']);
+
+ $result = DBselect('SELECT DISTINCT t.triggerid,t.templateid,t.expression '.
+ ' FROM triggers t,functions f,items i '.
+ ' WHERE t.triggerid=f.triggerid '.
+ ' AND f.itemid=i.itemid'.
+ ' AND i.hostid='.$this->data[XML_TAG_HOST]['hostid'].
+ ' AND t.description='.zbx_dbstr($data['description']));
+
+ while($trigger = DBfetch($result)){
+ if(explode_exp($trigger['expression'],0) == $data['expression']){
+ break; // while
+ }
+ }
- if($trigger = DBfetch(DBselect('select distinct t.triggerid,t.templateid '.
- ' from triggers t,functions f,items i '.
- ' where t.triggerid=f.triggerid and f.itemid=i.itemid'.
- ' and i.hostid='.$this->data[XML_TAG_HOST]['hostid'].
- ' and t.description='.zbx_dbstr($data['description']))))
- { /* exist */
- if($this->trigger['exist']==1) /* skip */
- {
+ if(!empty($trigger)){ /* exist */
+ if($this->trigger['exist']==1){ /* skip */
info('Trigger ['.$data['description'].'] skipped - user rule');
break; // case
}