Example #1
0
 protected function beforeValidate()
 {
     if (!$this->checkIfParentIsNotInChildRoles($this->roles)) {
         $errorMessage = Zurmo::t('ZurmoModule', 'You cannot select a child role for the parent role');
         $this->addError('role', $errorMessage);
         return false;
     }
     return parent::beforeValidate();
 }
Example #2
0
 /**
  * Sets the scenario for currencyvalue elements to positiveValue for the validation of the price
  * using the rule in CurrencyValue
  * @return bool
  */
 protected function beforeValidate()
 {
     $this->sellPrice->setScenario('positiveValue');
     $this->cost->setScenario('positiveValue');
     $this->listPrice->setScenario('positiveValue');
     return parent::beforeValidate();
 }