Code

Fixed usage hanlder.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 28 Sep 2009 09:21:57 +0000 (09:21 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 28 Sep 2009 09:21:57 +0000 (09:21 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14363 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc

index 077b02e4227f8161b5ff77313e7979135e765528..7efb01c4b29f9ca7ba08149fc492f3c9bcb27bc7 100644 (file)
@@ -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);
     }