From 5c280a2a38a7cadd6a935622be14eeacf6ac448d Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 25 Sep 2009 13:03:49 +0000 Subject: [PATCH] Updated usage dialog git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14352 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../opsiLicenses/class_licenseUsageByHost.inc | 13 ++++++-- .../opsiLicenses/class_opsiLicenseHandler.inc | 32 +++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsageByHost.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsageByHost.inc index 60a94f6db..866d6f28d 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsageByHost.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsageByHost.inc @@ -53,6 +53,7 @@ class licenseUsageByHost extends plugin function init() { $this->licenseUses = array(); + $this->reservedLicenses = array(); if(!$this->initially_was_account){ $this->init_successfull = TRUE; }else{ @@ -62,8 +63,13 @@ class licenseUsageByHost extends plugin $this->init_successfull = FALSE; return; } - $this->licenseUses = $res; + + $res = $this->si->getReservedLicensesForHost($this->cn); + if($this->si->is_error()){ + $this->init_successfull = FALSE; + return; + } $this->reservedLicenses = $res; $this->init_reservedLicenses = $res; $this->init_successfull = TRUE; @@ -100,11 +106,12 @@ class licenseUsageByHost extends plugin $action = ""; $f1 = array("string" => $license['licensePoolId'][0]); - $f2 = array("string" => $license['licenseKey'][0]); +# $f2 = array("string" => $license['licenseKey'][0]); $f3 = array("string" => $license['softwareLicenseId'][0]); $f4 = array("string" => $action, "attach" => "style='border-right:0px;'"); - $list2->addEntry(array($f1,$f2,$f3, $f4)); +# $list2->addEntry(array($f1,$f2,$f3, $f4)); + $list2->addEntry(array($f1,$f3, $f4)); } $smarty = get_smarty(); diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc index 3b8554232..c90013698 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc @@ -206,6 +206,38 @@ class opsiLicenceHandler extends opsi { } + function getReservedLicensesForHost($hostId) + { + $data= array(); + if(!empty($hostId)){ + $data['hostId'] = htmlentities($hostId); + } + $res = $this->send_data("gosa_opsi_getReservedLicenses",$this->target,$data,TRUE); + if(isset($res['XML'][0]['ANSWER_OPSI_GETRESERVEDLICENSES'])){ + + $items = array(); + foreach($res['XML'][0]['LICENSES'][0]['HIT'] as $entry){ + $item = array(); + foreach(array( + "LICENSEPOOLIDS" => "licensePoolId", + "SOFTWARELICENSEID" => "softwareLicenseId") as $source => $target){ + if(isset($entry[$source])){ + + $item[$target] = array('count' => 0); + foreach($entry[$source] as $data){ + $item[$target][] = $data['VALUE']; + } + $item[$target]['count'] = count($item[$target]) -1 ; + } + } + $items[] = $item; + } + return($items); + } + return(FALSE); + } + + /* * @brief Returns softwareLicenseId, notes, licenseKey, hostId and licensePoolId for optional given licensePoolId and hostId * @param hostid Something like client_1.intranet.mydomain.de (optional). -- 2.30.2