Example #1
0
 public function validate($attributes = null, $clear = TRUE)
 {
     parent::validate($attributes, false);
     if ($this->planCoupon != '') {
         $model = craft()->charge_coupon->handleCoupon($this);
     }
     return !$this->hasErrors();
 }
 /**
  * Validates all of the attributes for the current Model. Any attributes that fail validation will additionally get
  * logged to the `craft/storage/runtime/logs` folder with a level of LogLevel::Warning.
  *
  * In addition, we check that the username does not have any whitespace in it.
  *
  * @param null $attributes
  * @param bool $clearErrors
  *
  * @return bool|null
  */
 public function validate($attributes = null, $clearErrors = true)
 {
     // Don't allow whitespace in the username.
     if (preg_match('/\\s+/', $this->username)) {
         $this->addError('username', Craft::t('Spaces are not allowed in the username.'));
     }
     return parent::validate($attributes, false);
 }