From e7a779642ad7a3bda7aa76523361eeb6bbc719e4 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 28 Aug 2008 09:45:24 +0000 Subject: [PATCH] Updated opsi saving. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12293 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../opsi/admin/opsi/class_opsigeneric.inc | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc b/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc index e96339962..e7784775b 100644 --- a/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc +++ b/gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc @@ -43,14 +43,14 @@ class opsigeneric extends plugin /* Get hostId */ if($hostId != "new"){ - if(preg_match("/^opsi=/",$hostId)){ + if(preg_match("/^opsi:/",$hostId)){ $this->hostId = preg_replace("/^opsi:=([^,]*),.*$/","\\1",$hostId); - }else{ - $this->hostId = &$this->parent->cn; -// $this->mac = &$this->parent->netConfigDNS->macAddress; + }elseif($this->parent instanceof wingeneric){ + $this->hostId = $this->parent->cn; + $this->hostId = preg_replace('/\$$/',"",$this->hostId); } } - + /* Try to plugin */ $this->init(); } @@ -65,7 +65,7 @@ class opsigeneric extends plugin $list = $this->opsi->list_clients($this->hostId); $err |= $this->opsi->is_error(); foreach($list as $entry){ - if(preg_match("/^".normalizePreg($this->hostId).".$/i",$entry['NAME'][0]['VALUE'])){ + if(preg_match("/^".normalizePreg($this->hostId)."$/i",$entry['NAME'][0]['VALUE'])){ $this->initially_was_account = TRUE; foreach(array("description" => "DESCRIPTION","mac" => "MAC", "note" => "NOTES") as $des => $src){ $this->$des = $entry[$src][0]['VALUE']; @@ -244,9 +244,6 @@ class opsigeneric extends plugin public function save() { - /* Check if this a new opsi client - -Do we have to create this client first? - */ if(!$this->initially_was_account && $this->is_account){ $res = $this->opsi->add_client($this->hostId,$this->mac,$this->note,$this->description); if($this->opsi->is_error()){ @@ -271,15 +268,18 @@ class opsigeneric extends plugin } } foreach($add as $name => $data){ + echo "Adding '$name' to ".$this->hostId."
"; $this->opsi->add_product_to_client($name,$this->hostId); if($this->opsi->is_error()){ msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG); return; } - $this->opsi->set_product_properties($name,$data['CFG'],$this->hostId); - if($this->opsi->is_error()){ - msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG); - return; + if(!empty($data['CFG'])){ + $this->opsi->set_product_properties($name,$data['CFG'],$this->hostId); + if($this->opsi->is_error()){ + msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG); + return; + } } } -- 2.30.2