Exemple #1
0
 /**
  * @return bool
  */
 public function Validate()
 {
     switch (true) {
         case api_Validate::IsEmpty($this->Name):
             throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CGroup', '{{ClassField}}' => 'Name'));
     }
     return true;
 }
 /**
  * @return bool
  * @throws CApiValidationException
  */
 public function validate()
 {
     switch (true) {
         case api_Validate::IsEmpty($this->AccountId):
             throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'C2fa', '{{ClassField}}' => 'IdAccount'));
     }
     return true;
 }
Exemple #3
0
 /**
  * @return bool
  */
 public function Validate()
 {
     switch (true) {
         case 0 === $this->IdUser:
             throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CIdentity', '{{ClassField}}' => 'IdUser'));
         case 0 === $this->IdAccount:
             throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CIdentity', '{{ClassField}}' => 'IdAccount'));
         case api_Validate::IsEmpty($this->Email):
             throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CIdentity', '{{ClassField}}' => 'Email'));
     }
     return true;
 }
Exemple #4
0
 /**
  * @return bool
  */
 public function Validate()
 {
     if ($this->SocialId) {
         switch (true) {
             case api_Validate::IsEmpty($this->NotificationEmail):
                 throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CHelpdeskUser', '{{NotificationEmail}}' => 'NotificationEmail'));
         }
     } else {
         switch (true) {
             case api_Validate::IsEmpty($this->Email):
                 throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CHelpdeskUser', '{{ClassField}}' => 'Email'));
             case api_Validate::IsEmpty($this->PasswordHash):
                 throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CHelpdeskUser', '{{ClassField}}' => 'PasswordHash'));
         }
     }
     return true;
 }
Exemple #5
0
	/**
	 * @return bool
	 */
	public function Validate()
	{
		if (!$this->__SKIP_VALIDATE__)
		{
			switch (true)
			{
				case
					api_Validate::IsEmpty($this->FullName) &&
					api_Validate::IsEmpty($this->HomeEmail) &&
					api_Validate::IsEmpty($this->BusinessEmail) &&
					api_Validate::IsEmpty($this->OtherEmail):

					throw new CApiValidationException(Errs::Validation_FieldIsEmpty_OutInfo);
			}
		}

		return true;
	}
Exemple #6
0
 /**
  * @return bool
  *
  * @throws CApiValidationException(Errs::Validation_InvalidTenantName) 1109
  * @throws CApiValidationException(Errs::Validation_FieldIsEmpty) 1102
  * @throws CApiValidationException(Errs::Validation_InvalidEmail) 1107
  *
  * @return true
  */
 public function validate()
 {
     if (!$this->IsDefault) {
         switch (true) {
             case !api_Validate::IsValidTenantLogin($this->Login):
                 throw new CApiValidationException(Errs::Validation_InvalidTenantName);
             case api_Validate::IsEmpty($this->Login):
                 throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CTenant', '{{ClassField}}' => 'Login'));
             case !api_Validate::IsEmpty($this->Email) && !preg_match('/^[^@]+@[^@]+$/', $this->Email):
                 throw new CApiValidationException(Errs::Validation_InvalidEmail, null, array('{{ClassName}}' => 'CTenant', '{{ClassField}}' => 'Email'));
         }
     }
     return true;
 }
Exemple #7
0
 /**
  * @return bool
  */
 public function Validate()
 {
     switch (true) {
         case !api_Validate::Port($this->IncomingMailPort):
             throw new CApiValidationException(Errs::Validation_InvalidPort, null, array('{{ClassName}}' => 'CAccount', '{{ClassField}}' => 'IncomingMailPort'));
         case !api_Validate::Port($this->OutgoingMailPort):
             throw new CApiValidationException(Errs::Validation_InvalidPort, null, array('{{ClassName}}' => 'CAccount', '{{ClassField}}' => 'OutgoingMailPort'));
         case !$this->IsDefaultDomain && api_Validate::IsEmpty($this->Name):
             throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CDomain', '{{ClassField}}' => 'Name'));
         case api_Validate::IsEmpty($this->IncomingMailServer):
             throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CDomain', '{{ClassField}}' => 'IncomingMailServer'));
         case api_Validate::IsEmpty($this->OutgoingMailServer):
             throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CDomain', '{{ClassField}}' => 'OutgoingMailServer'));
     }
     return true;
 }
Exemple #8
0
 /**
  * @return bool
  */
 public function Validate()
 {
     switch (true) {
         case !api_Validate::Port($this->IncomingMailPort):
             throw new CApiValidationException(Errs::Validation_InvalidPort, null, array('{{ClassName}}' => 'CAccount', '{{ClassField}}' => 'IncomingMailPort'));
         case !api_Validate::Port($this->OutgoingMailPort):
             throw new CApiValidationException(Errs::Validation_InvalidPort, null, array('{{ClassName}}' => 'CAccount', '{{ClassField}}' => 'OutgoingMailPort'));
         case api_Validate::IsEmpty($this->Email):
             throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CAccount', '{{ClassField}}' => 'Email'));
         case api_Validate::IsEmpty($this->IncomingMailLogin):
             throw new CApiValidationException(Errs::Validation_FieldIsEmpty, null, array('{{ClassName}}' => 'CAccount', '{{ClassField}}' => 'IncomingMailLogin'));
     }
     return true;
 }