diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-06-20 11:23:38 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-06-20 11:23:38 +0000 |
| commit | fe50fe1231f837e82829c051553aa1be1f3cac3e (patch) | |
| tree | f32af7b1893fa3e73371dadb103646d7d21b73a3 /frontends/php/include/items.inc.php | |
| parent | 3f8cf5f0da75fa8312c173e9e2c1e1e843811091 (diff) | |
| download | zabbix-fe50fe1231f837e82829c051553aa1be1f3cac3e.tar.gz zabbix-fe50fe1231f837e82829c051553aa1be1f3cac3e.tar.xz zabbix-fe50fe1231f837e82829c051553aa1be1f3cac3e.zip | |
- [DEV-137] items copy fix (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5783 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/items.inc.php')
| -rw-r--r-- | frontends/php/include/items.inc.php | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php index 5ebc692a..1e1f363c 100644 --- a/frontends/php/include/items.inc.php +++ b/frontends/php/include/items.inc.php @@ -257,12 +257,12 @@ $db_item = DBfetch(DBselect("select itemid,hostid from items". " where hostid=$hostid and key_=".zbx_dbstr($key))); - if($db_item && $templateid == 0) - { + if($db_item && $templateid == 0){ error("An item with the Key [".$key."] already exists for host [".$host["host"]."].". " The key must be unique."); return FALSE; - } elseif ($db_item && $templateid != 0){ + } + else if ($db_item && $templateid != 0){ $result = update_item( $db_item["itemid"], $description, $key, $db_item["hostid"], @@ -295,8 +295,7 @@ if(!$result) return $result; - foreach($applications as $appid) - { + foreach($applications as $appid){ $itemappid=get_dbid("items_applications","itemappid"); DBexecute("insert into items_applications (itemappid,itemid,applicationid) values($itemappid,".$itemid.",".$appid.")"); } @@ -306,9 +305,8 @@ // add items to child hosts $db_hosts = get_hosts_by_templateid($host["hostid"]); - while($db_host = DBfetch($db_hosts)) - { - // recursion + while($db_host = DBfetch($db_hosts)){ +// recursion $result = add_item($description, $key, $db_host["hostid"], $delay, $history, $status, $type, $snmp_community, $snmp_oid, $value_type, $trapper_hosts, $snmp_port, $units, $multiplier, @@ -327,7 +325,7 @@ delete_item($itemid); } - return $result; + return $result; } # Update Item status @@ -583,11 +581,10 @@ * Comments: * */ - function copy_item_to_host($itemid, $hostid, $copy_mode = false) - { + function copy_item_to_host($itemid, $hostid, $copy_mode = false){ $db_tmp_item = get_item_by_itemid($itemid); - add_item( + $result = add_item( $db_tmp_item["description"], $db_tmp_item["key_"], $hostid, @@ -615,6 +612,8 @@ $db_tmp_item["params"], get_same_applications_for_host(get_applications_by_itemid($db_tmp_item["itemid"]),$hostid), $copy_mode ? 0 : $db_tmp_item["itemid"]); + + return $result; } /* |
