public function AjaxHelpdeskRegister() { $sTenantHash = trim($this->getParamValue('TenantHash', '')); if ($this->oApiCapability->isHelpdeskSupported()) { $sEmail = trim($this->getParamValue('Email', '')); $sName = trim($this->getParamValue('Name', '')); $sPassword = trim($this->getParamValue('Password', '')); if (0 === strlen($sEmail) || 0 === strlen($sPassword)) { throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::InvalidInputParameter); } $mIdTenant = $this->oApiIntegrator->getTenantIdByHash($sTenantHash); if (!is_int($mIdTenant)) { throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::InvalidInputParameter); } $bResult = false; try { $bResult = !!$this->oApiIntegrator->registerHelpdeskAccount($mIdTenant, $sEmail, $sName, $sPassword); } catch (\Exception $oException) { $iErrorCode = \ProjectCore\Notifications::UnknownError; if ($oException instanceof \CApiManagerException) { switch ($oException->getCode()) { case \Errs::HelpdeskManager_UserAlreadyExists: $iErrorCode = \ProjectCore\Notifications::HelpdeskUserAlreadyExists; break; case \Errs::HelpdeskManager_UserCreateFailed: $iErrorCode = \ProjectCore\Notifications::CanNotCreateHelpdeskUser; break; case \Errs::Db_ExceptionError: $iErrorCode = \ProjectCore\Notifications::DataBaseError; break; } } throw new \ProjectCore\Exceptions\ClientException($iErrorCode); } return $this->DefaultResponse(null, __FUNCTION__, $bResult); } return $this->FalseResponse(null, __FUNCTION__); }