From c87a4cde351157d7f4cc56c73bbb678d01f8ed12 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 29 Sep 2009 11:14:55 +0000 Subject: [PATCH] Updated license handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14387 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../opsiLicenses/class_licenseByProduct.inc | 19 +++++++------------ .../opsiLicenses/class_opsiLicenseHandler.inc | 9 ++++++--- .../admin/opsiLicenses/licenseByProduct.tpl | 8 ++++++++ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_licenseByProduct.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_licenseByProduct.inc index 6d916a503..b9d684d89 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_licenseByProduct.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_licenseByProduct.inc @@ -56,19 +56,13 @@ class licenseByProduct extends plugin }else{ $res = $this->si->getLicensesForProduct($this->cn); - if($this->si->is_error() || !$res){ + if($this->si->is_error()){ $this->init_successfull = FALSE; msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG); return; } - if(isset($res['USEDBY'])){ - foreach($res['USEDBY'] as $host){ - $data = $res; - $data['HOST'][0] = $host; - $this->licenseUses[] = $data; - } - } + $this->licenseUses = $res; $this->init_successfull = TRUE; } } @@ -81,17 +75,18 @@ class licenseByProduct extends plugin if(!$this->init_successfull){ $smarty = get_smarty(); $smarty->assign("init_successfull", $this->init_successfull); - return($smarty->fetch(get_template_path('licenseGeneric.tpl',TRUE,dirname(__FILE__)))); + return($smarty->fetch(get_template_path('licenseByProduct.tpl',TRUE,dirname(__FILE__)))); } // Create usage list $list = new divSelectBox("licenseUsage"); foreach($this->licenseUses as $license){ - $f1 = array("string" => $license['HOST'][0]['VALUE']); + $f1 = array("string" => $license['HOSTID'][0]['VALUE']); + $f2 = array("string" => $license['SOFTWARELICENSEID'][0]['VALUE']); $f3 = array("string" => $license['LICENSEPOOLID'][0]['VALUE'], "attach" => "style='border-right:0px;'"); - $list->addEntry(array($f1,$f3)); + $list->addEntry(array($f1,$f2,$f3)); } $smarty = get_smarty(); @@ -108,7 +103,7 @@ class licenseByProduct extends plugin $smarty->assign("licenseUses", $list->DrawList()); $smarty->assign("init_successfull", $this->init_successfull); $smarty->assign("initially_was_account", $this->initially_was_account); - return($smarty->fetch(get_template_path('licenseUsage.tpl',TRUE,dirname(__FILE__)))); + return($smarty->fetch(get_template_path('licenseByProduct.tpl',TRUE,dirname(__FILE__)))); } diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc index 39eb2ece8..116681ff8 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc @@ -445,9 +445,12 @@ class opsiLicenceHandler extends opsi { { $data= array(); $data['productId'] = htmlentities($productId); - $res = $this->send_data("gosa_opsi_getLicenseInformationForProduct",$this->target,$data,TRUE); - if(isset($res['XML'][0]['ANSWER_OPSI_GETLICENSEINFORMATIONFORPRODUCT'])){ - return($res['XML'][0]); + $res = $this->send_data("gosa_opsi_getSoftwareLicenseUsagesForProductId",$this->target,$data,TRUE); + if(isset($res['XML'][0]['ANSWER_OPSI_GETSOFTWARELICENSEUSAGESFORPRODUCTID'])){ + if(isset($res['XML'][0]['RESULT'][0]['HIT'])){ + return($res['XML'][0]['RESULT'][0]['HIT']); + } + return(array()); } return(FALSE); } diff --git a/gosa-plugins/opsi/admin/opsiLicenses/licenseByProduct.tpl b/gosa-plugins/opsi/admin/opsiLicenses/licenseByProduct.tpl index 443d2f4f4..c9536596e 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/licenseByProduct.tpl +++ b/gosa-plugins/opsi/admin/opsiLicenses/licenseByProduct.tpl @@ -14,3 +14,11 @@ {/if} + +

 

+
+ +   + +
+ -- 2.30.2