andre 2 роки тому
батько
коміт
a10b8e6a4d

+ 19 - 0
api/KerioWhmcs.php

@@ -145,6 +145,25 @@ class KerioWhmcs extends KerioConnectApi {
 		return $result['list'];
 	}
 
+	/**
+	 * Get address of a user
+	 *
+	 * @param	string	User Id
+	 *
+	 * @return	array	address of user
+	 */
+	public function getAddress($id) {
+		$method = 'Users.getPersonalContact';
+
+		$params = array(
+			'userIds' => array(
+					$id,
+				)
+			);
+		$result = $this->sendRequest($method, $params);
+		return $result;
+	}
+
 	/**
 	 * Get login name by user's Id
 	 * 

+ 27 - 10
app/UI/Client/EmailAccount/Providers/EditAccountDataProvider.php

@@ -17,6 +17,7 @@ use function ThurData\Servers\KerioEmail\Core\Helper\di;
 use ThurData\Servers\KerioEmail\Core\Models\Whmcs\Hosting;
 use ThurData\Servers\KerioEmail\Core\UI\ResponseTemplates\HtmlDataJsonResponse;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\DataProviders\BaseDataProvider;
+use ThurData\Servers\KerioEmail\Api\KerioWhmcs;
 
 /**
  *
@@ -42,22 +43,29 @@ class EditAccountDataProvider extends BaseDataProvider
          * load hosting
          */
         $hosting = Hosting::where('id', $hid)->first();
-
-        logModuleCall(
-            'kerioEmail',
-            __FUNCTION__,
-            $this->actionElementId,
-            'Debug Error',
-            $hosting
-        );
-
         /**
          * load api
          */
         $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
+        $fields =array(
+            'id',
+            'companyContactId',
+            'loginName',
+            'fullName',
+            'description',
+            'isEnabled',
+            'emailAddresses',
+        );
+        $cond = array(
+            "fieldName" => "id",
+            "comparator" => "Eq",
+            "value" => $this->actionElementId
+        );
+
         try {
             $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
-//            $domains = $api->getDomains(['id','name']);
+            $account = $api->getUsers($fields,'',$cond);
+            $address = $api->getAddress($this->actionElementId);
         } catch (KerioApiException $error) {
             logModuleCall(
                 'kerioEmail',
@@ -69,6 +77,15 @@ class EditAccountDataProvider extends BaseDataProvider
             return ['error' => $error->getMessage()];
         }
         $api->logout();
+
+        logModuleCall(
+            'kerioEmail',
+            __FUNCTION__,
+            $account,
+            'Debug Error',
+            $address
+        );
+
 /*
         $result = $repository->accounts->getAccountOptionsById($this->actionElementId);