/**
  * Custom model validation
  */
 function validate()
 {
     # execute the column validation
     parent::validate();
     if ($this->valueExists()) {
         $this->getErrorStack()->add("lookupvaluedescription.unique", "The value <b>" . $this->getlookupvaluedescription() . "</b> already exists. <br />Please specify another.");
     }
 }
示例#2
0
 /**
  * Custom model validation
  */
 function validate()
 {
     # execute the column validation
     parent::validate();
     // debugMessage($this->toArray(true));
     # validate that username is unique
     if ($this->nameExists()) {
         $this->getErrorStack()->add("name.unique", "The name <b>" . $this->getName() . "</b> already exists. Please specify another.");
     }
 }
示例#3
0
 /**
  * Custom model validation
  */
 function validate()
 {
     # execute the column validation
     parent::validate();
     // debugMessage($this->toArray(true));
     # validate that username is unique
     /* if($this->payrollCompleted()){
     			$this->getErrorStack()->add("payroll.unique", "Transaction date has been rejected! <br >Approved Payroll already exists for this period. Please cancel the payroll to proceed");
     		} */
 }
示例#4
0
 /**
  * Custom model validation
  */
 function validate()
 {
     # execute the column validation
     parent::validate();
     // debugMessage($this->toArray(true));
     # validate that username is unique
     if ($this->usernameExists()) {
         $this->getErrorStack()->add("username.unique", sprintf($this->translate->_("profile_username_unique_error"), $this->getUsername()));
     }
     # validate that email is unique
     if ($this->emailExists()) {
         $this->getErrorStack()->add("email.unique", sprintf($this->translate->_("profile_email_unique_error"), $this->getEmail()));
     }
     # check that at least one group has been specified
     if ($this->getUserGroups()->count() == 0) {
         // $this->getErrorStack()->add("groups", $this->translate->_("profile_group_error"));
     }
     # validate attempt to change password with an invalid current password
     if (!isEmptyString($this->getNewPassword())) {
         if (!isEmptyString($this->getOldPassword()) && sha1($this->getOldPassword()) != $this->getTrx()) {
             $this->getErrorStack()->add("oldpassword", $this->translate->_("profile_oldpassword_invalid_error"));
         } else {
             $this->setPassword(sha1($this->getNewPassword()));
         }
     }
 }