|
|
@@ -108,14 +108,6 @@ class EditRessourceDataProvider extends BaseDataProvider
|
|
|
$this->data['description'] = $ressource[0]['description'];
|
|
|
$this->data['manager'] = $ressource[0]['manager']['name'] . '@' . $ressource[0]['manager']['domainName'];
|
|
|
|
|
|
- logModuleCall(
|
|
|
- 'kerioEmail',
|
|
|
- __FUNCTION__,
|
|
|
- $this->data,
|
|
|
- 'Debug Error',
|
|
|
- $ressource
|
|
|
- );
|
|
|
-
|
|
|
$this->availableValues['status'] = [
|
|
|
Kerio::ACC_STATUS_ACTIVE => $lang->absoluteT('kerio','account','status','active'),
|
|
|
Kerio::ACC_STATUS_CLOSED => $lang->absoluteT('kerio','account','status','closed'),
|
|
|
@@ -154,7 +146,43 @@ class EditRessourceDataProvider extends BaseDataProvider
|
|
|
$value = in_array($field, $fieldToProtection) ? htmlentities($value) : $value;
|
|
|
}
|
|
|
|
|
|
+ $attr = array(
|
|
|
+ 'description' => $this->formData['description'],
|
|
|
+ 'type' => $this->formData['type'],
|
|
|
+ 'isEnabled' => $this->formData['status'] === 'active' ? true : false,
|
|
|
+ 'manager' => array(
|
|
|
+ 'id' => $this->formData['manager'],
|
|
|
+ 'type' => 'UserPrincipal'
|
|
|
+ )
|
|
|
+ );
|
|
|
|
|
|
+ $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
+ try {
|
|
|
+ $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
|
|
|
+ $domainID = $api->getDomainId($this->getWhmcsParamByKey('domain'));
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $error,
|
|
|
+ 'Debug Error',
|
|
|
+ $error->getMessage()
|
|
|
+ );
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ $result = $api->updateResouce($attr,$this->formData['id']);
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $error,
|
|
|
+ 'Debug Error',
|
|
|
+ $error->getMessage()
|
|
|
+ );
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
+ }
|
|
|
+ $api->logout();
|
|
|
return (new HtmlDataJsonResponse())->setMessageAndTranslate('ressourceHasBeenUpdated')->setStatusSuccess();
|
|
|
}
|
|
|
|