Răsfoiți Sursa

Bugfix: use attribute at forms

andre 2 ani în urmă
părinte
comite
611336e15d

+ 2 - 2
app/Libs/Zimbra/Components/Api/Soap/Services/Create/CreateRessource.php

@@ -88,6 +88,7 @@ class CreateRessource extends ApiService
          */
         $ressource->setAttr(Ressource::ATTR_STATUS, $this->formData['status']);
         $ressource->setAttr(Ressource::ATTR_TYPE, $this->formData['type']);
+        $ressource->setAttr(Ressource::ATTR_DISPLAY_NAME, $this->formData['display_name']);
         $ressource->setAttr(Ressource::ATTR_DESC, $this->formData['description']);
         $ressource->setAttr(Ressource::ATTR_NOTE, $this->formData['notes']);
         $ressource->setAttr(Ressource::ATTR_CONT, $this->formData['contact']);
@@ -101,9 +102,8 @@ class CreateRessource extends ApiService
         $ressource->setAttr(Ressource::ATTR_STREET, $this->formData['street']);
         $ressource->setAttr(Ressource::ATTR_TOWN, $this->formData['town']);
         $ressource->setAttr(Ressource::ATTR_POSTAL_CODE, $this->formData['post_code']);
+        $ressource->setAttr(Ressource::ATTR_COUNTY, $this->formData['county']);
         $ressource->setAttr(Ressource::ATTR_STATE, $this->formData['state']);
-        $ressource->setAttr(Ressource::ATTR_COUNTRY, $this->formData['country']);
-        $ressource->setAttr(Ressource::ATTR_DISPLAY_NAME, $this->formData['display_name']);
         $ressource->setAttr(Ressource::ATTR_AUTO, $this->formData['auto']);
         $ressource->setAttr(Ressource::ATTR_BUSY, $this->formData['busy']);
 

+ 2 - 3
app/Libs/Zimbra/Components/Api/Soap/Services/Update/UpdateRessource.php

@@ -56,8 +56,8 @@ class UpdateRessource extends CreateRessource
 
         $ressource->setAttr(Ressource::ATTR_NAME, $this->formData['name']);
         $ressource->setAttr(Ressource::ATTR_STATUS, $this->formData['status']);
-        $ressource->setAttr(Ressource::ATTR_DISPLAY_NAME, $this->formData['name']);
         $ressource->setAttr(Ressource::ATTR_TYPE, $this->formData['type']);
+        $ressource->setAttr(Ressource::ATTR_DISPLAY_NAME, $this->formData['display_name']);
         $ressource->setAttr(Ressource::ATTR_DESC, $this->formData['description']);
         $ressource->setAttr(Ressource::ATTR_NOTE, $this->formData['notes']);
         $ressource->setAttr(Ressource::ATTR_CONT, $this->formData['contact']);
@@ -71,9 +71,8 @@ class UpdateRessource extends CreateRessource
         $ressource->setAttr(Ressource::ATTR_STREET, $this->formData['street']);
         $ressource->setAttr(Ressource::ATTR_TOWN, $this->formData['town']);
         $ressource->setAttr(Ressource::ATTR_POSTAL_CODE, $this->formData['post_code']);
+        $ressource->setAttr(Ressource::ATTR_COUNTY, $this->formData['county']);
         $ressource->setAttr(Ressource::ATTR_STATE, $this->formData['state']);
-        $ressource->setAttr(Ressource::ATTR_COUNTRY, $this->formData['country']);
-        $ressource->setAttr(Ressource::ATTR_DISPLAY_NAME, $this->formData['display_name']);
         $ressource->setAttr(Ressource::ATTR_AUTO, $this->formData['auto']);
         $ressource->setAttr(Ressource::ATTR_BUSY, $this->formData['busy']);
 

+ 5 - 5
app/Libs/Zimbra/Components/Api/Soap/Services/Update/UpdateRessourcePassword.php

@@ -39,15 +39,15 @@ class UpdateRessourcePassword extends ApiService
      */
     public function process()
     {
-        $model = new Ressource();
-        $model->setId($this->formData['id']);
-        $model->setPassword($this->formData['password']);
+        $ressource = new Ressource();
+        $ressource->setId($this->formData['id']);
+        $ressource->setPassword($this->formData['password']);
 
-        $result = $this->api->account->setPassword($model);
+        $result = $this->api->ressource->setPassword($model);
 
         if(!$result)
         {
-            $this->setError($this->api->account->getLastResult()->getLastErrorCode());
+            $this->setError($this->api->ressource->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 3 - 3
app/Libs/Zimbra/Components/Api/Soap/Services/Update/UpdateRessourceStatus.php

@@ -23,13 +23,13 @@ class UpdateRessourceStatus extends ApiService
     {
         $model = new Ressource();
         $model->setId($this->formData['id']);
-        $model->setAttr(Ressource::ATTR_ACCOUNT_STATUS, $this->formData['status']);
+        $model->setAttr(Ressource::ATTR_STATUS, $this->formData['status']);
 
-        $result = $this->api->account->update($model);
+        $result = $this->api->ressource->update($model);
 
         if(!$result)
         {
-            $this->setError($this->api->account->getLastResult()->getLastErrorCode());
+            $this->setError($this->api->ressource->getLastResult()->getLastErrorCode());
             return false;
         }
 

+ 0 - 1
app/UI/Client/Ressource/Providers/EditRessourceDataProvider.php

@@ -71,7 +71,6 @@ class EditRessourceDataProvider extends BaseDataProvider
         $this->data['domain']       = $mailBoxParams[1];
         $this->data['display_name'] = $result->getDataResourceA(Ressource::ATTR_DISPLAY_NAME);
         $this->data['status']       = $result->getDataResourceA(Ressource::ATTR_STATUS);
-        $this->data['company']      = $result->getDataResourceA(Ressource::ATTR_COMPANY);
         $this->data['title']        = $result->getDataResourceA(Ressource::ATTR_PROF_TITLE);
         $this->data['phone']        = $result->getDataResourceA(Ressource::ATTR_PHONE);
         $this->data['home_phone']   = $result->getDataResourceA(Ressource::ATTR_HOME_PHONE);

+ 15 - 9
app/UI/Client/Ressource/Sections/AdditionalSection.php

@@ -7,6 +7,8 @@ use ModulesGarden\Servers\ZimbraEmail\App\Traits\FormExtendedTrait;
 use ModulesGarden\Servers\ZimbraEmail\App\UI\Admin\Custom\Sections\FreeFieldsSection;
 use function ModulesGarden\Servers\ZimbraEmail\Core\Helper\di;
 use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Fields\Text;
+use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Sections\InputGroup;
+use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Fields\InputGroupElements;
 
 /**
  *
@@ -25,21 +27,25 @@ class AdditionalSection extends FreeFieldsSection
 
     public function initContent()
     {
-        $this->generateDoubleSection([new Text('company'), new Text('title')]);
+        $this->generateDoubleSection([new Text('contact'), new Text('site')]);
 
-        $field = new Text('phone');
-        $field->setPlaceholder(di('lang')->absoluteT('phoneNumberPlaceholder'));
-        $this->addField($field);
+        $this->generateDoubleSection([new Text('contact_mail'), new Text('contact_phone')]);
+
+        $this->generateDoubleSection([new Text('street'), new Text('building')]);
 
-        $this->generateDoubleSection([new Text('home_phone'), new Text('mobile_phone')]);
+        $this->generateDoubleSection([new Text('floor'), new Text('room')]);
 
-        $this->generateDoubleSection([new Text('fax'), new Text('pager')]);
+        $this->generateDoubleSection([new Text('post_code'), new Text('town')]);
 
-        $this->generateDoubleSection([new Text('country'), new Text('state')]);
+        $this->generateDoubleSection([new Text('state'), new Text('county')]);
 
-        $this->generateDoubleSection([new Text('city'), new Text('street')]);
+        $this->generateDoubleSection([new Text('description'), new Text('state')]);
 
-        $field = new Text('post_code');
+        $field = new Text('description');
         $this->addField($field);
+
+        $field = new Text('notes');
+        $this->addField($field);
+
     }
 }

+ 5 - 6
app/UI/Client/Ressource/Sections/GeneralSection.php

@@ -10,6 +10,7 @@ use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Fields\Hidden;
 use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Fields\Password;
 use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Fields\Select;
 use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Fields\Text;
+use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Fields\Number;
 use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Sections\InputGroup;
 use ModulesGarden\Servers\ZimbraEmail\Core\UI\Widget\Forms\Fields\InputGroupElements;
 
@@ -49,12 +50,6 @@ class GeneralSection extends FreeFieldsSection
         $this->addSection($email);
 
         $this->generateDoubleSection([new Text('display_name'), new Select('status')]);
-        /***
-         *
-         * set type
-         */
-        $field = new Select('type');
-        $this->addField($field);
 
         $passwd = new Password('password');
         $passwd->setDescription('description');
@@ -66,5 +61,9 @@ class GeneralSection extends FreeFieldsSection
 
         $this->generateDoubleSection([$passwd, $repPasswd]);
 
+        $type = new Select('type');
+        $capacity = new Number('capacity');
+
+        $this->generateDoubleSection([$type, $capacity]);
     }
 }