瀏覽代碼

replace raw errors by error codes

andre 2 年之前
父節點
當前提交
439811a24c

+ 0 - 8
app/Libs/Zimbra/Components/Api/Soap/Services/Create/CreateAccount.php

@@ -149,14 +149,6 @@ class CreateAccount extends ApiService
          */
         $result = $this->api->account->create($model);
 
-        logModuleCall(
-            'zimbraEmail',
-            __FUNCTION__,
-            $this->api->account->getLastResult(),
-            'debug',
-            $this->api->account->getLastResult()->getLastErrorCode()
-        );
-
         /**
          * problem with create account
          */

+ 1 - 1
app/Libs/Zimbra/Components/Api/Soap/Services/Create/CreateDistributionList.php

@@ -79,7 +79,7 @@ class CreateDistributionList extends ApiService
 
         if(!$distList)
         {
-            $this->setError($this->api->distributionList->getError());
+            $this->setError($this->api->distributionList->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 1 - 1
app/Libs/Zimbra/Components/Api/Soap/Services/Create/CreateDomain.php

@@ -97,7 +97,7 @@ class CreateDomain extends ApiService
          */
         if(!$result)
         {
-            $this->setError($this->api->domain->getError());
+            $this->setError($this->api->domain->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 1 - 1
app/Libs/Zimbra/Components/Api/Soap/Services/Create/CreateDomainAlias.php

@@ -86,7 +86,7 @@ class CreateDomainAlias extends ApiService
          */
         if(!$result)
         {
-            $this->setError($this->api->domain->getError());
+            $this->setError($this->api->domain->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 1 - 1
app/Libs/Zimbra/Components/Api/Soap/Services/Delete/DeleteAccount.php

@@ -33,7 +33,7 @@ class DeleteAccount extends ApiService
          */
         if(!$result)
         {
-            $this->setError($this->api->account->getError());
+            $this->setError($this->api->account->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 1 - 1
app/Libs/Zimbra/Components/Api/Soap/Services/Delete/DeleteAccountAlias.php

@@ -61,7 +61,7 @@ class DeleteAccountAlias extends ApiService
          */
         if(!$result)
         {
-            $this->setError($this->api->account->getError());
+            $this->setError($this->api->account->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 1 - 1
app/Libs/Zimbra/Components/Api/Soap/Services/Delete/DeleteDistributionList.php

@@ -45,7 +45,7 @@ class DeleteDistributionList extends ApiService
 
         if(!$result)
         {
-            $this->setError($this->api->distributionList->getError());
+            $this->setError($this->api->distributionList->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 1 - 1
app/Libs/Zimbra/Components/Api/Soap/Services/Delete/DeleteDomain.php

@@ -143,7 +143,7 @@ class DeleteDomain extends ApiService
 
         if(!$result && ApiErrorCodes::DOMAIN_DOES_NOT_EXISTS !== $this->api->domain->getLastResult()->getLastErrorCode())
         {
-            $this->setError($this->api->domain->getError());
+            $this->setError($this->api->domain->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 1 - 1
app/Libs/Zimbra/Components/Api/Soap/Services/Delete/DeleteDomainAlias.php

@@ -27,7 +27,7 @@ class DeleteDomainAlias extends ApiService
 
         if(!$result)
         {
-            $this->setError($this->api->domain->getError());
+            $this->setError($this->api->domain->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 2 - 2
app/Libs/Zimbra/Components/Api/Soap/Services/Update/SuspendDomain.php

@@ -29,7 +29,7 @@ class SuspendDomain extends ApiService
         $domain = $this->api->repository()->domains->getByName($this->formData['domain']);
         if(!$domain)
         {
-            $this->setError($this->api->domain->getError());
+            $this->setError($this->api->account->getLastResult()->getLastErrorCode());
             return false;
         }
 
@@ -42,7 +42,7 @@ class SuspendDomain extends ApiService
         $response = $this->api->domain->update($domain);
         if(!$response)
         {
-            $this->setError($this->api->domain->getError());
+            $this->setError($this->api->domain->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 2 - 2
app/Libs/Zimbra/Components/Api/Soap/Services/Update/UnsuspendDomain.php

@@ -23,7 +23,7 @@ class UnsuspendDomain extends ApiService
         $domain = $this->api->repository()->domains->getByName($this->formData['domain']);
         if(!$domain)
         {
-            $this->setError($this->api->domain->getError());
+            $this->setError($this->api->account->getLastResult()->getLastErrorCode());
             return false;
         }
 
@@ -35,7 +35,7 @@ class UnsuspendDomain extends ApiService
         $response = $this->api->domain->update($domain);
         if(!$response)
         {
-            $this->setError($this->api->domain->getError());
+            $this->setError($this->api->domain->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 1 - 1
app/Libs/Zimbra/Components/Api/Soap/Services/Update/UpdateAccount.php

@@ -36,7 +36,7 @@ class UpdateAccount extends CreateAccount
          */
         if(!$result)
         {
-            $this->setError($this->api->account->getError());
+            $this->setError($this->api->account->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 1 - 1
app/Libs/Zimbra/Components/Api/Soap/Services/Update/UpdateAccountCosQuota.php

@@ -40,7 +40,7 @@ class UpdateAccountCosQuota extends CreateAccountCosQuota
          */
         if(!$result)
         {
-            $this->setError($this->api->account->getError());
+            $this->setError($this->api->account->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 1 - 1
app/Libs/Zimbra/Components/Api/Soap/Services/Update/UpdateAccountPassword.php

@@ -47,7 +47,7 @@ class UpdateAccountPassword extends ApiService
 
         if(!$result)
         {
-            $this->setError($this->api->account->getError());
+            $this->setError($this->api->account->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 1 - 1
app/Libs/Zimbra/Components/Api/Soap/Services/Update/UpdateAccountStatus.php

@@ -29,7 +29,7 @@ class UpdateAccountStatus extends ApiService
 
         if(!$result)
         {
-            $this->setError($this->api->account->getError());
+            $this->setError($this->api->account->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 14 - 3
app/Libs/Zimbra/Components/Api/Soap/Services/Update/UpdateDistributionList.php

@@ -31,7 +31,7 @@ class UpdateDistributionList extends CreateDistributionList
             $result = $this->api->account->getAccountId($owner);
             if($result->getLastError())
             {
-                $this->setError($result->getLastError());
+                $this->setError($this->api->account->getLastResult()->getLastErrorCode());
                 return false;
             }
         }
@@ -48,7 +48,7 @@ class UpdateDistributionList extends CreateDistributionList
             $result = $this->api->domain->getDomain($domain);
             if($result->getLastError())
             {
-                $this->setError($result->getLastError());
+                $this->setError($this->api->domain->getLastResult()->getLastErrorCode());
                 return false;
             }
         }
@@ -78,7 +78,8 @@ class UpdateDistributionList extends CreateDistributionList
 
         if (!$result)
         {
-            //todo save error
+            $this->setError($this->api->distributionList->getLastResult()->getLastErrorCode());
+            return false;
         }
 
         /**
@@ -205,6 +206,11 @@ class UpdateDistributionList extends CreateDistributionList
          * remove old members
          */
         $result = $this->api->distributionList->deleteMembers($list);
+        if (!$result)
+        {
+            $this->setError($this->api->distributionList->getLastResult()->getLastErrorCode());
+            return false;
+        }
 
         /**
          * return success
@@ -279,6 +285,11 @@ class UpdateDistributionList extends CreateDistributionList
          * delete owners from list
          */
         $result = $this->api->distributionList->deleteOwners($list);
+        if (!$result)
+        {
+            $this->setError($this->api->distributionList->getLastResult()->getLastErrorCode());
+            return false;
+        }
 
         return true;
     }