From a63d5e5f665599d14c6b72c701b3c0be89c06416 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 21 Aug 2008 11:12:09 +0000 Subject: [PATCH] Allow opsi host creation. -Fixed several index problems. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12258 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-plugins/opsi/admin/opsi/class_opsi.inc | 2 +- .../opsi/admin/opsi/class_opsi_generic.inc | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gosa-plugins/opsi/admin/opsi/class_opsi.inc b/gosa-plugins/opsi/admin/opsi/class_opsi.inc index 4c055b6cb..e764de240 100644 --- a/gosa-plugins/opsi/admin/opsi/class_opsi.inc +++ b/gosa-plugins/opsi/admin/opsi/class_opsi.inc @@ -133,7 +133,7 @@ class opsi extends gosaSupportDaemon $res = $this->send_data("gosa_opsi_get_local_products",$this->target,$data,TRUE); $items = array(); - if($res['XML']['ITEM']['PRODUCTID']){ + if(isset($res['XML']['ITEM']['PRODUCTID'])){ if(!is_array($res['XML']['ITEM']['PRODUCTID'])){ $items[$res['XML']['ITEM']['PRODUCTID']]['NAME'] = $res['XML']['ITEM']['PRODUCTID']; $items[$res['XML']['ITEM']['PRODUCTID']]['DESC'] = $res['XML']['ITEM']['DESCRIPTION']; diff --git a/gosa-plugins/opsi/admin/opsi/class_opsi_generic.inc b/gosa-plugins/opsi/admin/opsi/class_opsi_generic.inc index 0b2387161..a36c38846 100644 --- a/gosa-plugins/opsi/admin/opsi/class_opsi_generic.inc +++ b/gosa-plugins/opsi/admin/opsi/class_opsi_generic.inc @@ -1,6 +1,6 @@ initially_was_account = TRUE; /* Get hostId */ - $this->hostId = preg_replace("/^opsi:=([^,]*),.*$/","\\1",$hostId); + if($hostId != "new"){ + $this->hostId = preg_replace("/^opsi:=([^,]*),.*$/","\\1",$hostId); + } /* Try to plugin */ $this->init(); @@ -48,19 +50,19 @@ class opsi_generic extends plugin } /* Get selected products */ - if(!$err) { + if(!$err && !empty($this->hostId)) { $tmp = array_keys($this->opsi->get_netboot_products($this->hostId)); $this->s_selectedNetbootProduct = $tmp[0]; $err |= $this->opsi->is_error(); } - if(!$err) { + if(!$err && !empty($this->hostId)) { $tmp = $this->opsi->get_local_products($this->hostId); $err |= $this->opsi->is_error(); $this->a_selectedLocalProducts = $tmp; } /* Load product configuration */ - if(!$err) { + if(!$err && !empty($this->hostId)) { foreach($this->a_selectedLocalProducts as $name => $data){ $CFG = $this->opsi->get_product_properties($name,$this->hostId); $err |= $this->opsi->is_error(); @@ -205,7 +207,7 @@ class opsi_generic extends plugin $this->dialog = NULL; } - if(isset($_POST['opsi_generic'])){ + if(isset($_POST['opsigeneric'])){ if(isset($_POST['opsi_netboot_product'])){ $SNP = trim($_POST['opsi_netboot_product']); -- 2.30.2