| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Services\Update;
- use ThurData\Servers\KerioEmail\App\Enums\Size;
- use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Interfaces\ApiService;
- use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\Account;
- use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Services\Create\CreateAccount;
- /**
- *
- * Created by PhpStorm.
- * User: Tomasz Bielecki ( tomasz.bi@thurdata.com )
- * Date: 18.09.19
- * Time: 11:09
- * Class UpdateAccount
- */
- class UpdateAccount extends CreateAccount
- {
- /**
- * @return bool|mixed|Account|void
- */
- protected function process()
- {
- /**
- *
- */
- $model = $this->getModel();
- /**
- * update account in ZIMBRA
- */
- $result = $this->api->account->update($model);
- /**
- * problem with create account
- */
- if(!$result)
- {
- $this->setError($this->api->account->getLastResult()->getLastErrorCode());
- return false;
- }
- return $result;
- }
- /**
- * @return Account
- */
- public function getModel()
- {
- $account = new Account();
- /**
- * set account attributes
- */
- $account->setId($this->formData['id']);
- $account->setAttr(Account::ATTR_FIRSTNAME, $this->formData['firstname']);
- $account->setAttr(Account::ATTR_LASTNAME, $this->formData['lastname']);
- $account->setAttr(Account::ATTR_PHONE, $this->formData['phone']);
- $account->setAttr(Account::ATTR_MOBILE_PHONE, $this->formData['mobile_phone']);
- $account->setAttr(Account::ATTR_FAX, $this->formData['fax']);
- $account->setAttr(Account::ATTR_PAGER, $this->formData['pager']);
- $account->setAttr(Account::ATTR_HOME_PHONE, $this->formData['home_phone']);
- $account->setAttr(Account::ATTR_COUNTRY, $this->formData['country']);
- $account->setAttr(Account::ATTR_STATE, $this->formData['state']);
- $account->setAttr(Account::ATTR_PROF_TITLE, $this->formData['title']);
- $account->setAttr(Account::ATTR_POSTAL_CODE, $this->formData['post_code']);
- $account->setAttr(Account::ATTR_CITY, $this->formData['city']);
- $account->setAttr(Account::ATTR_STREET, $this->formData['street']);
- $account->setAttr(Account::ATTR_COMPANY, $this->formData['company']);
- $account->setAttr(Account::ATTR_ACCOUNT_STATUS, $this->formData['status']);
- $account->setAttr(Account::ATTR_DISPLAY_NAME, $this->formData['display_name']);
- return $account;
- }
- }
|