/** * @param CTenant $oTenant */ public function UpdateTenant(CTenant $oTenant) { $bResult = false; try { if ($oTenant->Validate()) { if ($oTenant->IsDefault && 0 === $oTenant->IdTenant) { $this->oSettings->SetConf('Helpdesk/AdminEmailAccount', $oTenant->HelpdeskAdminEmailAccount); $this->oSettings->SetConf('Helpdesk/ClientIframeUrl', $oTenant->HelpdeskClientIframeUrl); $this->oSettings->SetConf('Helpdesk/AgentIframeUrl', $oTenant->HelpdeskAgentIframeUrl); $this->oSettings->SetConf('Helpdesk/SiteName', $oTenant->HelpdeskSiteName); $this->oSettings->SetConf('Helpdesk/StyleAllow', $oTenant->HelpdeskStyleAllow); $this->oSettings->SetConf('Helpdesk/StyleImage', $oTenant->HelpdeskStyleImage); $this->oSettings->SetConf('Helpdesk/StyleText', $oTenant->HelpdeskStyleText); $this->oSettings->SetConf('Helpdesk/FetcherType', $oTenant->HelpdeskFetcherType); $this->oSettings->SetConf('Common/LoginStyleImage', $oTenant->LoginStyleImage); $this->oSettings->SetConf('Common/AppStyleImage', $oTenant->AppStyleImage); $this->oSettings->SetConf('Helpdesk/FacebookAllow', $oTenant->HelpdeskFacebookAllow); $this->oSettings->SetConf('Helpdesk/FacebookId', $oTenant->HelpdeskFacebookId); $this->oSettings->SetConf('Helpdesk/FacebookSecret', $oTenant->HelpdeskFacebookSecret); $this->oSettings->SetConf('Helpdesk/GoogleAllow', $oTenant->HelpdeskGoogleAllow); $this->oSettings->SetConf('Helpdesk/GoogleId', $oTenant->HelpdeskGoogleId); $this->oSettings->SetConf('Helpdesk/GoogleSecret', $oTenant->HelpdeskGoogleSecret); $this->oSettings->SetConf('Helpdesk/TwitterAllow', $oTenant->HelpdeskTwitterAllow); $this->oSettings->SetConf('Helpdesk/TwitterId', $oTenant->HelpdeskTwitterId); $this->oSettings->SetConf('Helpdesk/TwitterSecret', $oTenant->HelpdeskTwitterSecret); $this->oSettings->SetConf('Sip/AllowSip', $oTenant->SipAllow); $this->oSettings->SetConf('Sip/Realm', $oTenant->SipRealm); $this->oSettings->SetConf('Sip/WebsocketProxyUrl', $oTenant->SipWebsocketProxyUrl); $this->oSettings->SetConf('Sip/OutboundProxyUrl', $oTenant->SipOutboundProxyUrl); $this->oSettings->SetConf('Sip/CallerID', $oTenant->SipCallerID); $this->oSettings->SetConf('Twilio/AllowTwilio', $oTenant->TwilioAllow); $this->oSettings->SetConf('Twilio/PhoneNumber', $oTenant->TwilioPhoneNumber); $this->oSettings->SetConf('Twilio/AccountSID', $oTenant->TwilioAccountSID); $this->oSettings->SetConf('Twilio/AuthToken', $oTenant->TwilioAuthToken); $this->oSettings->SetConf('Twilio/AppSID', $oTenant->TwilioAppSID); $this->oSettings->SetConf('Socials', $oTenant->Socials); $bResult = $this->oSettings->SaveToXml(); } else { if (null !== $oTenant->GetObsoleteValue('QuotaInMB')) { $iQuota = $oTenant->QuotaInMB; if (0 < $iQuota) { $iSize = $this->GetTenantAllocatedSize($oTenant->IdTenant); if ($iSize > $iQuota) { throw new CApiManagerException(Errs::TenantsManager_QuotaLimitExided); } } } if (!$this->oStorage->UpdateTenant($oTenant)) { throw new CApiManagerException(Errs::TenantsManager_TenantUpdateFailed); } if (null !== $oTenant->GetObsoleteValue('IsDisabled')) { /* @var $oDomainsApi CApiDomainsManager */ $oDomainsApi = CApi::Manager('domains'); if (!$oDomainsApi->EnableOrDisableDomainsByTenantId($oTenant->IdTenant, !$oTenant->IsDisabled)) { $oException = $oDomainsApi->GetLastException(); if ($oException) { throw $oException; } } } } } $bResult = true; // $this->UpdateTenantMainCapa($oTenant->IdTenant); } catch (CApiBaseException $oException) { $bResult = false; $this->setLastException($oException); } return $bResult; }