From ee033ddb9eadaae97b929b16d1b631292ca2f10e Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 28 Sep 2009 13:09:55 +0000 Subject: [PATCH] Updated error handling -Display whats going wrong. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14373 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../opsiLicenses/class_licenseByProduct.inc | 1 + .../opsiLicenses/class_licensePoolGeneric.inc | 3 +++ .../admin/opsiLicenses/class_licenseUsage.inc | 1 + .../admin/opsiLicenses/class_opsiLicenses.inc | 22 ++++++++++++------- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_licenseByProduct.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_licenseByProduct.inc index c159e32e5..40c640aff 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_licenseByProduct.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_licenseByProduct.inc @@ -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; } diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_licensePoolGeneric.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_licensePoolGeneric.inc index e830ef3d0..7b70dd492 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_licensePoolGeneric.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_licensePoolGeneric.inc @@ -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; diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsage.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsage.inc index 01e2af031..57cbff3d6 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsage.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsage.inc @@ -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; } diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc index e029e9641..8c1c09c65 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc @@ -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; + } } } -- 2.30.2