|
|
@@ -74,7 +74,7 @@ class RessourceDataProvider extends BaseDataProvider
|
|
|
|
|
|
foreach($users as $user) {
|
|
|
if($user['isEnabled']){
|
|
|
- $this->availableValues['manager'][ $user['loginName']] = $user['loginName'] . '@' . $this->getWhmcsParamByKey('domain');
|
|
|
+ $this->availableValues['manager'][ $user['id']] = $user['loginName'] . '@' . $this->getWhmcsParamByKey('domain');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -88,33 +88,14 @@ class RessourceDataProvider extends BaseDataProvider
|
|
|
Kerio::RES_TYPE_LOCATION => $lang->absoluteT('kerio','ressource','type','location'),
|
|
|
Kerio::RES_TYPE_EQUIPMENT => $lang->absoluteT('kerio','ressource','type','equipment')
|
|
|
];
|
|
|
- logModuleCall(
|
|
|
- 'kerioEmail',
|
|
|
- __FUNCTION__,
|
|
|
- $this->availableValues,
|
|
|
- 'Debug Error',
|
|
|
- $this
|
|
|
- );
|
|
|
}
|
|
|
|
|
|
public function create()
|
|
|
{
|
|
|
- /**
|
|
|
- * hosting id
|
|
|
- */
|
|
|
- $hid = $this->request->get('id');
|
|
|
-
|
|
|
- logModuleCall(
|
|
|
- 'kerioEmail',
|
|
|
- __FUNCTION__,
|
|
|
- $this->formData,
|
|
|
- 'Debug Error',
|
|
|
- $this
|
|
|
- );
|
|
|
-
|
|
|
$fieldToProtection = [
|
|
|
'name',
|
|
|
'status',
|
|
|
+ 'manager',
|
|
|
'type',
|
|
|
'description'
|
|
|
];
|
|
|
@@ -124,6 +105,33 @@ class RessourceDataProvider extends BaseDataProvider
|
|
|
$value = in_array($field, $fieldToProtection) ? htmlentities($value) : $value;
|
|
|
}
|
|
|
|
|
|
+ $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()];
|
|
|
+ }
|
|
|
+ $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
+ try {
|
|
|
+ $ressourceID = $api->createR;
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $error,
|
|
|
+ 'Debug Error',
|
|
|
+ $error->getMessage()
|
|
|
+ );
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
+ }
|
|
|
|
|
|
return (new HtmlDataJsonResponse())->setMessageAndTranslate('ressourceHasBeenAdded')->setStatusSuccess();
|
|
|
|