Code

Updated error handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 28 Sep 2009 13:09:55 +0000 (13:09 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 28 Sep 2009 13:09:55 +0000 (13:09 +0000)
-Display whats going wrong.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14373 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/opsi/admin/opsiLicenses/class_licenseByProduct.inc
gosa-plugins/opsi/admin/opsiLicenses/class_licensePoolGeneric.inc
gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsage.inc
gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc

index c159e32e5d583bd3e62bd39aaf3794241c3c67da..40c640affa734816b3d0316c195373ff19f7d15c 100644 (file)
@@ -58,6 +58,7 @@ class licenseByProduct extends plugin
       $res = $this->si->getLicensesForProduct($this->cn);
       if($this->si->is_error() || !$res){
         $this->init_successfull = FALSE;
+        msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
         return;
       }
 
index e830ef3d0407094de0f22a4ec362c75ffb722905..7b70dd492b9e7dd4b327e3c5189608a1d5ecbc57 100644 (file)
@@ -86,6 +86,7 @@ class licensePoolGeneric extends plugin
     $res = $this->si->get_local_products();
     $this->availableProductIds=array();
     if($this->si->is_error()){
+      msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
       $this->init_successfull = FALSE;
       return(FALSE);
     }
@@ -95,6 +96,7 @@ class licensePoolGeneric extends plugin
     $res = $this->si->list_clients();
     $this->opsiHosts=array();
     if($this->si->is_error()){
+      msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
       $this->init_successfull = FALSE;
       return(FALSE);
     }
@@ -109,6 +111,7 @@ class licensePoolGeneric extends plugin
 
       if($this->si->is_error()){    
         $this->init_successfull = FALSE;
+        msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
         return(FALSE);
       }else{
         $this->data = $this->orig_data = $res;
index 01e2af03193c1f9bbc709c8f1c07e61fb04de8af..57cbff3d687412b958be7655b90b7b7d8d8fd675 100644 (file)
@@ -58,6 +58,7 @@ class licenseUsage extends plugin
       $res = $this->si->getLicenseUsage("", $this->cn);
       if($this->si->is_error()){
         $this->init_successfull = FALSE;
+        msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
         return;
       }
 
index e029e9641bd61679645485e08c3854dbe7735922..8c1c09c658fd13428e025f77e521d50fb5fcc1bf 100644 (file)
@@ -291,15 +291,21 @@ class opsiLicenses extends plugin
     $Regex    = $this->DivListLicenses->Regex;
 
     $si = new opsiLicenceHandler($this->config);
-    $res = $si->listPools();
-
-    // Reset the list of licenses 
     $this->licenses = array();
-    foreach($res as $item){
-
-      // Fake an ldap entry, this enables ACL checks.
-      $item['dn'] = "opsi:cn=".$item['cn'][0].",".$this->config->current['BASE'];
-      $this->licenses[] = $item;
+    $res = $si->listPools();
+    if($this->si->is_error() || !$res){
+      $this->init_successfull = FALSE;
+      msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
+      return;
+    }else{
+
+      // Reset the list of licenses 
+      foreach($res as $item){
+
+        // Fake an ldap entry, this enables ACL checks.
+        $item['dn'] = "opsi:cn=".$item['cn'][0].",".$this->config->current['BASE'];
+        $this->licenses[] = $item;
+      }
     }
   }