|
|
@@ -59,6 +59,7 @@ class DeleteRessourceDataProvider extends BaseDataProvider
|
|
|
);
|
|
|
return ['error' => $error->getMessage()];
|
|
|
}
|
|
|
+ $api->logout();
|
|
|
|
|
|
return (new HtmlDataJsonResponse())->setMessageAndTranslate('ressourceHasBeenDeleted')->setStatusSuccess();
|
|
|
|
|
|
@@ -66,35 +67,36 @@ class DeleteRessourceDataProvider extends BaseDataProvider
|
|
|
|
|
|
public function massDelete()
|
|
|
{
|
|
|
- /**
|
|
|
- * hosting id
|
|
|
- */
|
|
|
- $hid = $this->request->get('id');
|
|
|
-
|
|
|
- /**
|
|
|
- * product manager allow to check product settings
|
|
|
- */
|
|
|
- $productManager = new ProductManager();
|
|
|
- $productManager->loadByHostingId($hid);
|
|
|
-
|
|
|
- /**
|
|
|
- *
|
|
|
- * get soap create domain service
|
|
|
- */
|
|
|
- $service =(new KerioManager())
|
|
|
- ->getApiByHosting($hid)
|
|
|
- ->soap
|
|
|
- ->service()
|
|
|
- ->deleteRessource();
|
|
|
+ $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
+ try {
|
|
|
+ $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $error,
|
|
|
+ 'Debug Error',
|
|
|
+ $error->getMessage()
|
|
|
+ );
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- */
|
|
|
foreach($this->request->get('massActions') as $id)
|
|
|
{
|
|
|
- $service->setFormData(['id' => $id]);
|
|
|
- $result = $service->run();
|
|
|
+ try {
|
|
|
+ $api->delResouce($id);
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $error,
|
|
|
+ 'Debug Error',
|
|
|
+ $error->getMessage()
|
|
|
+ );
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
+ }
|
|
|
}
|
|
|
+ $api->logout();
|
|
|
|
|
|
return (new HtmlDataJsonResponse())->setMessageAndTranslate('massRessourceHasBeenDeleted')->setStatusSuccess();
|
|
|
}
|