- Timestamp:
- 07/23/08 16:20:57 (4 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/centreon/www/include/configuration/configObject/host/DB-Func.php
r5844 r5850 389 389 function insertHostInDB ($ret = array()) { 390 390 global $oreon; 391 391 392 $host_id = insertHost($ret); 392 393 updateHostHostParent($host_id, $ret); … … 428 429 // For Centreon 2, we no longer need "host_template_model_htm_id" in Nagios 3 429 430 // but we try to keep it compatible with Nagios 2 which needs "host_template_model_htm_id" 430 if (isset($_POST['nbOfSelect']) ) {431 if (isset($_POST['nbOfSelect']) || $oreon->user->get_version() >= 3) { 431 432 $DBRESULT =& $pearDB->query("SELECT host_id FROM `host` WHERE host_register='0' LIMIT 1"); 432 433 if (PEAR::isError($DBRESULT)) … … 490 491 ** Insert multiple templates 491 492 */ 492 if (isset($_POST['nbOfSelect'])) { 493 if (isset($ret["use"]) && $ret["use"]){ 494 $already_stored = array(); 495 $tplTab = split(",", $ret["use"]); 496 $j = 0; 497 foreach ($tplTab as $val) { 498 $tplId = getMyHostID($val); 499 500 if (!isset($already_stored[$tplId]) && $tplId) { 501 $rq = "INSERT INTO host_template_relation (`host_host_id`, `host_tpl_id`, `order`) VALUES (". $host_id['MAX(host_id)'] .", ". $tplId .", ". $j .")"; 502 $DBRESULT =& $pearDB->query($rq); 503 if (PEAR::isError($DBRESULT)) 504 print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 505 $j++; 506 $already_stored[$tplId] = 1; 507 } 508 } 509 } 510 elseif (isset($_POST['nbOfSelect']) || $oreon->user->get_version() >= 3) { 493 511 $already_stored = array(); 494 512 for ($i=0, $j = 1;$i <= $_POST['nbOfSelect']; $i++) … … 509 527 * Insert on demand macros 510 528 */ 511 if (isset($_POST['nbOfMacro']) ) {529 if (isset($_POST['nbOfMacro']) || $oreon->user->get_version() >= 3) { 512 530 $already_stored = array(); 513 531 for ($i=0; $i <= $_POST['nbOfMacro']; $i++)
