Kaynağa Gözat

smaller fixes

andre 5 yıl önce
ebeveyn
işleme
0109c3560a
2 değiştirilmiş dosya ile 3 ekleme ve 22 silme
  1. 1 2
      api/Zm/Account.php
  2. 2 20
      zimbraSingle.php

+ 1 - 2
api/Zm/Account.php

@@ -259,8 +259,7 @@ class Zm_Account
 			$result = $exception;
 			$result = $exception;
 		}
 		}
 
 
-		//return (!is_a($result, "Exception"));
-		return $result;
+		return (!is_a($result, "Exception"));
 	}
 	}
 
 
 	/**
 	/**

+ 2 - 20
zimbraSingle.php

@@ -505,26 +505,8 @@ function zimbraSingle_CreateAccount($params)
         return $login->getMessage();
         return $login->getMessage();
     }
     }
     $apiAccountManager = new Zm_Account($api);
     $apiAccountManager = new Zm_Account($api);
-    $accountExists = $apiAccountManager->accountExists($account_name);
-    if(is_a($accountExists, "Exception")) {
-        logModuleCall(
-            'zimbrasingle',
-            __FUNCTION__,
-            $params,
-            "Error: could not check account availibility",
-            $accountExists
-        );
-        return false;
-    }
-    logModuleCall(
-        'zimbrasingle',
-        __FUNCTION__,
-        $account_name,
-        "Debug",
-        $accountExists
-    );
-    if($accountExists) {
-        return 'Account already exist';
+    if($apiAccountManager->accountExists($account_name)) {
+        return "Error: account $account_name already exists";
     }
     }
     $attrs = array();
     $attrs = array();
     $attrs["gn"] = $params['customfields']["givenname"];
     $attrs["gn"] = $params['customfields']["givenname"];