Code

Updated license handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Sep 2009 11:14:55 +0000 (11:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Sep 2009 11:14:55 +0000 (11:14 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14387 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/opsi/admin/opsiLicenses/class_licenseByProduct.inc
gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc
gosa-plugins/opsi/admin/opsiLicenses/licenseByProduct.tpl

index 6d916a5033a593b4a3d3a37977fa0bc3401da883..b9d684d896e7d9a0f8b557c840a94e3d6634f3a5 100644 (file)
@@ -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__))));
   }
 
  
index 39eb2ece8b65907f8f4decccf1d5061802af8f64..116681ff8791cc43dad4dcb31155c1e389d3b585 100644 (file)
@@ -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);
   }
index 443d2f4f4f55fb328a5d82c6cef095528bbfe7fa..c9536596ec81eb53550630e399b03ff075a461c4 100644 (file)
 
 <input name='opsiLicenseUsagePosted' value='1' type='hidden'>
 {/if}
+
+<p class="seperator">&nbsp;</p>
+<div style='width:100%; text-align: right; padding:3px;'>
+  <input type='submit' name='save_properties' value='{msgPool type='saveButton'}'>
+  &nbsp;
+  <input type='submit' name='cancel_properties' value='{msgPool type='cancelButton'}'>
+</div>
+