From: hickert Date: Mon, 28 Sep 2009 09:21:57 +0000 (+0000) Subject: Fixed usage hanlder. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=18a8e18e9207fb9f74209d6d2d65ec33321dc45d;p=gosa.git Fixed usage hanlder. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14363 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 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); }