andre 2 лет назад
Родитель
Сommit
e2b128a38b

+ 9 - 59
app/UI/Client/EmailAccount/Providers/AccountDataProvider.php

@@ -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();
+
+
+
         }
 
         /**

+ 2 - 42
app/UI/Client/EmailAccount/Providers/DeleteAccountDataProvider.php

@@ -44,37 +44,6 @@ class DeleteAccountDataProvider extends BaseDataProvider
         $productManager = new ProductManager();
         $productManager->loadByHostingId($hid);
 
-        /**
-         *
-         * get soap create domain  service
-         */
-        $service =(new KerioManager())
-            ->getApiByHosting($hid)
-            ->soap
-            ->service()
-            ->deleteAccount();
-        /**
-         *
-         * set product manager & form data to service
-         */
-        $service
-            ->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('emailAccountHasBeenDeleted')->setStatusSuccess();
 
     }
@@ -92,23 +61,14 @@ class DeleteAccountDataProvider extends BaseDataProvider
         $productManager = new ProductManager();
         $productManager->loadByHostingId($hid);
 
-        /**
-         *
-         * get soap create domain  service
-         */
-        $service =(new KerioManager())
-            ->getApiByHosting($hid)
-            ->soap
-            ->service()
-            ->deleteAccount();
-
         /**
          *
          */
         foreach($this->request->get('massActions') as $id)
         {
             $service->setFormData(['id' => $id]);
-            $result = $service->run();
+
+
         }
 
         return (new HtmlDataJsonResponse())->setMessageAndTranslate('massEmailAccountHasBeenDeleted')->setStatusSuccess();

+ 3 - 13
app/UI/Client/EmailAccount/Sections/AdditionalSection.php

@@ -25,21 +25,11 @@ class AdditionalSection extends FreeFieldsSection
 
     public function initContent()
     {
-        $this->generateDoubleSection([new Text('company'), new Text('title')]);
+        $this->generateDoubleSection([new Text('title'), new Text('profession')]);
 
-        $field = new Text('phone');
-        $field->setPlaceholder(di('lang')->absoluteT('phoneNumberPlaceholder'));
-        $this->addField($field);
+        $this->generateDoubleSection([new Text('department'), new Text('office')]);
 
-        $this->generateDoubleSection([new Text('home_phone'), new Text('mobile_phone')]);
+        $this->generateDoubleSection([new Text('work_phone'), new Text('mobile_phone')]);
 
-        $this->generateDoubleSection([new Text('fax'), new Text('pager')]);
-
-        $this->generateDoubleSection([new Text('country'), new Text('state')]);
-
-        $this->generateDoubleSection([new Text('city'), new Text('street')]);
-
-        $field = new Text('post_code');
-        $this->addField($field);
     }
 }

+ 2 - 17
app/UI/Client/EmailAccount/Sections/GeneralSection.php

@@ -51,23 +51,8 @@ class GeneralSection extends FreeFieldsSection
         $this->addSection($email);
 
         $this->generateDoubleSection([new Text('display_name'), new Select('status')]);
-        /***
-         *
-         * set cosId dependent od cos_name
-         */
-        if($productManager->get('cos_name') === ClassOfServices::CLASS_OF_SERVICE_QUOTA)
-        {
-            $field = new Select('cosId');
-            $this->addField($field);
-        }elseif($productManager->get('cos_name') === ClassOfServices::KERIO_CONFIG_OPTIONS)
-        {
-            $field = new Hidden('cosId');
-            $this->addField($field);
-        }elseif($productManager->get('cos_name') !== ClassOfServices::CUSTOM_KERIO)
-        {
-            $field = new Hidden('cosId');
-            $this->addField($field);
-        }
+
+        $this->generateDoubleSection([new Text('quota'), new Select('unit')]);
 
         $passwd = new Password('password');
         $passwd->setDescription('description');