|
@@ -15,6 +15,7 @@ use function ThurData\Servers\KerioEmail\Core\Helper\di;
|
|
|
use ThurData\Servers\KerioEmail\Core\Models\Whmcs\Hosting;
|
|
use ThurData\Servers\KerioEmail\Core\Models\Whmcs\Hosting;
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\ResponseTemplates\HtmlDataJsonResponse;
|
|
use ThurData\Servers\KerioEmail\Core\UI\ResponseTemplates\HtmlDataJsonResponse;
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\DataProviders\BaseDataProvider;
|
|
use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\DataProviders\BaseDataProvider;
|
|
|
|
|
+use ThurData\Servers\KerioEmail\Api\KerioWhmcs;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
*
|
|
*
|
|
@@ -29,11 +30,67 @@ class EditListDataProvider extends AddListDataProvider
|
|
|
|
|
|
|
|
public function read()
|
|
public function read()
|
|
|
{
|
|
{
|
|
|
|
|
+ $fields = array(
|
|
|
|
|
+ "id",
|
|
|
|
|
+ "name",
|
|
|
|
|
+ "description",
|
|
|
|
|
+ "languageId",
|
|
|
|
|
+ "subscription",
|
|
|
|
|
+ "replyTo",
|
|
|
|
|
+ "posting"
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ $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()];
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ $domainID = $api->getDomainId($this->getWhmcsParamByKey('domain'));
|
|
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'kerioEmail',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $error,
|
|
|
|
|
+ 'Debug Error',
|
|
|
|
|
+ $error->getMessage()
|
|
|
|
|
+ );
|
|
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
|
|
+ }
|
|
|
|
|
+ $cond = array(
|
|
|
|
|
+ "fieldName" => "id",
|
|
|
|
|
+ "comparator" => "Eq",
|
|
|
|
|
+ "value" => $this->actionElementId
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ $list = $api->getMailingLists($fields,$domainID,$cond);
|
|
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'kerioEmail',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $error,
|
|
|
|
|
+ 'Debug Error',
|
|
|
|
|
+ $error->getMessage()
|
|
|
|
|
+ );
|
|
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ $api->logout();
|
|
|
|
|
|
|
|
logModuleCall(
|
|
logModuleCall(
|
|
|
'kerioEmail',
|
|
'kerioEmail',
|
|
|
__FUNCTION__,
|
|
__FUNCTION__,
|
|
|
- $this,
|
|
|
|
|
|
|
+ $list,
|
|
|
'Debug Error',
|
|
'Debug Error',
|
|
|
$this->actionElementId
|
|
$this->actionElementId
|
|
|
);
|
|
);
|