From: hickert Date: Fri, 30 Oct 2009 13:27:37 +0000 (+0000) Subject: Updated opsiLicense Mangement X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=52623839aeefa75100c380533d55a98cb895a8f7;p=gosa.git Updated opsiLicense Mangement -Fixed problem with pool listing. Don't display error messages if we do not have any pools.. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14718 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc index 116681ff8..fd8b01f47 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc @@ -19,29 +19,34 @@ class opsiLicenceHandler extends opsi { $data= array(); $res = $this->send_data("gosa_opsi_getLicensePools_listOfHashes",$this->target,$data,TRUE); $items = array(); - if(isset($res['XML'][0]['RESULT'][0]['HIT'])){ - $items = $res['XML'][0]['RESULT'][0]['HIT']; - $data =array(); - foreach($items as $item){ - $entry = array(); - foreach( - array( - "DESCRIPTION" => "description", - "LICENSEPOOLID" => "cn", - "PRODUCTIDS" => "productId", - "WINDOWSSOFTWAREIDS"=> "softwareId") as $source => $dest){ - - if(isset($item[$source])){ - $entry[$dest] = array('count' => 0); - foreach($item[$source] as $obj){ - $entry[$dest][] = $obj['VALUE']; - } - $entry[$dest]['count'] = (count($entry[$dest]) -1 ); - } + if(isset($res['XML'][0]['ANSWER_OPSI_GETLICENSEPOOLS_LISTOFHASHES'])){ + if(isset($res['XML'][0]['RESULT'][0]['HIT'])){ + $items = $res['XML'][0]['RESULT'][0]['HIT']; + $data =array(); + foreach($items as $item){ + $entry = array(); + foreach( + array( + "DESCRIPTION" => "description", + "LICENSEPOOLID" => "cn", + "PRODUCTIDS" => "productId", + "WINDOWSSOFTWAREIDS"=> "softwareId") as $source => $dest){ + + if(isset($item[$source])){ + $entry[$dest] = array('count' => 0); + foreach($item[$source] as $obj){ + $entry[$dest][] = $obj['VALUE']; + } + $entry[$dest]['count'] = (count($entry[$dest]) -1 ); + } + } + $data[] =$entry; } - $data[] =$entry; + return($data); + }else{ + // No entries, but got an answer. We probably do not have any pools yet. + return(array()); } - return($data); } return(FALSE); } @@ -145,6 +150,7 @@ class opsiLicenceHandler extends opsi { { $data= array(); $res = $this->send_data("gosa_opsi_getAllSoftwareLicenses",$this->target,$data,TRUE); + if(isset($res['XML'][0]['ANSWER_OPSI_GETALLSOFTWARELICENSES'])){ $licenses = array(); diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc index 06f3534f8..27466eb68 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc @@ -294,7 +294,7 @@ class opsiLicenses extends plugin $si = new opsiLicenceHandler($this->config); $this->licenses = array(); $res = $si->listPools(); - if($si->is_error() || !$res){ + if($si->is_error() || !is_array($res)){ $this->init_successfull = FALSE; msg_dialog::display(_("Error"),msgPool::siError($si->get_error()),ERROR_DIALOG); return;