فهرست منبع

del domainaliase

andre 2 سال پیش
والد
کامیت
6ee72841f4
1فایلهای تغییر یافته به همراه25 افزوده شده و 1 حذف شده
  1. 25 1
      app/UI/Client/DomainAlias/Providers/DeleteDomainAliasProvider.php

+ 25 - 1
app/UI/Client/DomainAlias/Providers/DeleteDomainAliasProvider.php

@@ -47,12 +47,36 @@ class DeleteDomainAliasProvider extends BaseDataProvider
          */
         $hid = $this->request->get('id');
 
+        $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
+        try {
+            $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
+            $domains = $api->getDomains(['id','name','aliasList']);
+        } catch (KerioApiException $error) {
+            logModuleCall(
+                'kerioEmail',
+                __FUNCTION__,
+                $error,
+                'Debug Error',
+                $error->getMessage()
+            );
+            return ['error' => $error->getMessage()];
+        }
+        foreach($domains as $domain) {
+            if(($domain['name']) === $this->getWhmcsParamByKey('domain')){ 
+                $domainID = $domain['id'];
+                $domainName = $domain['name'];
+                $aliasList = $domain['aliasList'];
+            }
+        }
+
+        $newList = array_diff($aliasList, [ $this->formData['id']]);
+
         logModuleCall(
             'kerioEmail',
             __FUNCTION__,
             $this->formData,
             'Debug Error',
-            $this
+            $newList
         );
 
         return (new HtmlDataJsonResponse())->setMessageAndTranslate('domainAliasHasBeenDeleted')->setStatusSuccess();