From 18a8e18e9207fb9f74209d6d2d65ec33321dc45d Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 28 Sep 2009 09:21:57 +0000 Subject: [PATCH] Fixed usage hanlder. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14363 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../opsiLicenses/class_opsiLicenseHandler.inc | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc index 077b02e42..7efb01c4b 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc @@ -216,21 +216,23 @@ class opsiLicenceHandler extends opsi { 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']; + if(isset($res['XML'][0]['LICENSES'][0]['HIT'])){ + 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 ; } - $item[$target]['count'] = count($item[$target]) -1 ; } + $items[] = $item; } - $items[] = $item; } return($items); } @@ -257,24 +259,26 @@ class opsiLicenceHandler extends opsi { if(isset($res['XML'][0]['ANSWER_OPSI_GETSOFTWARELICENSEUSAGES'])){ $items = array(); - foreach($res['XML'][0]['RESULT'][0]['HIT'] as $entry){ - $item = array(); - foreach(array( - "HOSTID" => "hostId", - "LICENSEKEY" => "licenseKey", - "LICENSEPOOLID" => "licensePoolId", - "NOTES" => "notes", - "SOFTWARELICENSEID" => "softwareLicenseId") as $source => $target){ - if(isset($entry[$source])){ - - $item[$target] = array('count' => 0); - foreach($entry[$source] as $data){ - $item[$target][] = $data['VALUE']; + if(isset($res['XML'][0]['RESULT'][0]['HIT'])){ + foreach($res['XML'][0]['RESULT'][0]['HIT'] as $entry){ + $item = array(); + foreach(array( + "HOSTID" => "hostId", + "LICENSEKEY" => "licenseKey", + "LICENSEPOOLID" => "licensePoolId", + "NOTES" => "notes", + "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 ; } - $item[$target]['count'] = count($item[$target]) -1 ; } + $items[] = $item; } - $items[] = $item; } return($items); } -- 2.30.2