|
|
@@ -37,23 +37,18 @@ class AccountDataProvider extends BaseDataProvider
|
|
|
|
|
|
$hosting = Hosting::where('id', $hid)->first();
|
|
|
//todo refactor
|
|
|
- $this->data['domain'] = $hosting->domain;
|
|
|
+ $this->data['domain'] = $this->getWhmcsParamByKey('customfields')['maildomain'];
|
|
|
|
|
|
$lang = di('lang');
|
|
|
$this->availableValues['status'] = [
|
|
|
Kerio::ACC_STATUS_ACTIVE => $lang->absoluteT('kerio','account','status','active'),
|
|
|
- Kerio::ACC_STATUS_LOCKED => $lang->absoluteT('kerio','account','status','locked'),
|
|
|
- Kerio::ACC_STATUS_MAINTENANCE => $lang->absoluteT('kerio','account','status','maintenance'),
|
|
|
Kerio::ACC_STATUS_CLOSED => $lang->absoluteT('kerio','account','status','closed'),
|
|
|
- Kerio::ACC_STATUS_LOCKOUT => $lang->absoluteT('kerio','account','status','lockout'),
|
|
|
- Kerio::ACC_STATUS_PENDING => $lang->absoluteT('kerio','account','status','pending')
|
|
|
+ ];
|
|
|
+ $this->availableValues['unit'] = [
|
|
|
+ 'MB',
|
|
|
+ 'GB',
|
|
|
];
|
|
|
|
|
|
- /**
|
|
|
- * product manager allow to check product settings
|
|
|
- */
|
|
|
-
|
|
|
- $this->readCosParams();
|
|
|
}
|
|
|
|
|
|
public function create()
|
|
|
@@ -63,8 +58,7 @@ class AccountDataProvider extends BaseDataProvider
|
|
|
*/
|
|
|
$hid = $this->request->get('id');
|
|
|
|
|
|
-
|
|
|
- $fieldToProtection = ['firstname', 'lastname', 'display_name', 'company', 'title', 'country', 'state', 'city', 'street', 'post_code' ];
|
|
|
+ $fieldToProtection = ['firstname', 'lastname', 'display_name', 'office', 'title', 'department', 'profession'];
|
|
|
|
|
|
foreach ($this->formData as $field => &$value)
|
|
|
{
|
|
|
@@ -77,37 +71,7 @@ class AccountDataProvider extends BaseDataProvider
|
|
|
$productManager = new ProductManager();
|
|
|
$productManager->loadByHostingId($hid);
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- * get soap create domain service
|
|
|
- */
|
|
|
- $service =(new KerioManager())
|
|
|
- ->getApiByHosting($hid)
|
|
|
- ->soap
|
|
|
- ->service()
|
|
|
- ->createAccount($productManager->get('cos_name'));
|
|
|
- /**
|
|
|
- *
|
|
|
- * set product manager & form data to service
|
|
|
- */
|
|
|
- $service
|
|
|
- ->setProductManager($productManager)
|
|
|
- ->setFormData($this->formData);
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- * run service
|
|
|
- */
|
|
|
- $result = $service->run();
|
|
|
-
|
|
|
- /**
|
|
|
- *
|
|
|
- * return success or error response
|
|
|
- */
|
|
|
- if(!$result)
|
|
|
- {
|
|
|
- return (new HtmlDataJsonResponse())->setMessageAndTranslate($service->getError())->setStatusError();
|
|
|
- }
|
|
|
|
|
|
return (new HtmlDataJsonResponse())->setMessageAndTranslate('emailAccountHasBeenAdded')->setStatusSuccess();
|
|
|
|
|
|
@@ -132,29 +96,15 @@ class AccountDataProvider extends BaseDataProvider
|
|
|
$productManager = new ProductManager();
|
|
|
$productManager->loadByHostingId($hid);
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- * get soap create domain service
|
|
|
- */
|
|
|
- $service =(new KerioManager())
|
|
|
- ->getApiByHosting($hid)
|
|
|
- ->soap
|
|
|
- ->service()
|
|
|
- ->updateAccountStatus()
|
|
|
- ->setProductManager($productManager)
|
|
|
- ;
|
|
|
- /**
|
|
|
- *
|
|
|
- * set product manager & form data to service
|
|
|
- */
|
|
|
-
|
|
|
/**
|
|
|
* run service for each id
|
|
|
*/
|
|
|
foreach($this->request->get('massActions') as $id)
|
|
|
{
|
|
|
$service->setFormData(['status' => $this->formData['status'], 'id' => $id]);
|
|
|
- $result = $service->run();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|