|
@@ -94,18 +94,43 @@ class DeleteDomainAliasProvider extends BaseDataProvider
|
|
|
/**
|
|
/**
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
- foreach($this->request->get('massActions') as $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(
|
|
logModuleCall(
|
|
|
'kerioEmail',
|
|
'kerioEmail',
|
|
|
__FUNCTION__,
|
|
__FUNCTION__,
|
|
|
- $id,
|
|
|
|
|
|
|
+ $error,
|
|
|
'Debug Error',
|
|
'Debug Error',
|
|
|
- $this
|
|
|
|
|
|
|
+ $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_values(array_diff($aliasList, $this->request->get('massActions')));
|
|
|
|
|
+ $attr = array('aliasList' => $newList);
|
|
|
|
|
+ try {
|
|
|
|
|
+ $result = $api->modifyDomain($domainID,$attr);
|
|
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'kerioEmail',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $error,
|
|
|
|
|
+ 'Debug Error',
|
|
|
|
|
+ $error->getMessage()
|
|
|
|
|
+ );
|
|
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
|
|
+ }
|
|
|
|
|
+ $api->logout();
|
|
|
|
|
|
|
|
return (new HtmlDataJsonResponse())
|
|
return (new HtmlDataJsonResponse())
|
|
|
->setMessageAndTranslate('massDomainAliasHasBeenDeleted')
|
|
->setMessageAndTranslate('massDomainAliasHasBeenDeleted')
|