示例#1
0
 public function validate()
 {
     if (empty($this->name)) {
         $this->name = $this->email;
     }
     return parent::validate();
 }
示例#2
0
 public function validate()
 {
     $this->_checkQuota();
     if (!empty($this->domain->max_mailboxes) && $this->isNew && $this->domain->getSumMailboxes() >= $this->domain->max_mailboxes) {
         throw new \Exception('The maximum number of mailboxes for this domain has been reached.');
     }
     return parent::validate();
 }
示例#3
0
文件: Module.php 项目: ajaboa/crmpuan
 public function validate()
 {
     if ($this->id == 'modules' && $this->enabled == 0) {
         $this->setValidationError('enabled', GO::t('cmdModulesCannotBeDeleted', 'modules'));
     }
     return parent::validate();
 }
示例#4
0
文件: Event.php 项目: ajaboa/crmpuan
 public function validate()
 {
     if ($this->rrule != "") {
         $rrule = new \GO\Base\Util\Icalendar\Rrule();
         $rrule->readIcalendarRruleString($this->start_time, $this->rrule);
         $this->repeat_end_time = $rrule->until;
     }
     //ignore reminders longer than 90 days.
     if ($this->reminder > 86400 * 90) {
         \GO::debug("WARNING: Ignoring reminder that is longer than 90 days before event start");
         $this->reminder = 0;
     }
     if ($this->exception_for_event_id != 0 && $this->exception_for_event_id == $this->id) {
         throw new \Exception("Exception event ID can't be set to ID");
     }
     if ($this->exception_for_event_id != 0 && !empty($this->rrule)) {
         throw new \Exception("Can't create exception with RRULE");
     }
     $resourceConflicts = $this->hasResourceConflicts();
     if ($resourceConflicts !== false) {
         $errorMessage = GO::t('moveEventResourceError', 'calendar');
         foreach ($resourceConflicts as $rc) {
             $errorMessage .= '<br />- ' . $rc->calendar->name;
         }
         $this->setValidationError('start_time', $errorMessage);
     }
     return parent::validate();
 }
示例#5
0
文件: Log.php 项目: ajaboa/crmpuan
 public function validate()
 {
     $this->cutAttributeLengths();
     return parent::validate();
 }
示例#6
0
文件: Note.php 项目: ajaboa/crmpuan
 public function validate()
 {
     if (!empty($this->userInputPassword1) || !empty($this->userInputPassword2)) {
         if ($this->userInputPassword1 != $this->userInputPassword2) {
             $this->setValidationError('userInputPassword1', GO::t('passwordMatchError'));
         }
     }
     return parent::validate();
 }
示例#7
0
 public function validate()
 {
     if (!empty($this->vat_no) && \GO\Base\Util\Validate::isEuCountry($this->post_country)) {
         if (substr($this->vat_no, 0, 2) != $this->post_country) {
             $this->vat_no = $this->post_country . ' ' . $this->vat_no;
         }
         if ($this->checkVatNumber && ($this->isModified('vat_no') || $this->isModified('post_country')) && !\GO\Base\Util\Validate::checkVat($this->post_country, $this->vat_no)) {
             $this->setValidationError('vat_no', 'European VAT (Country:' . $this->post_country . ', No.:' . $this->vat_no . ') number is invalid according to VIES. Please click <a target="_blank" href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">here</a> to check it on their website.');
         }
     }
     return parent::validate();
 }
示例#8
0
文件: User.php 项目: ajaboa/crmpuan
 public function validate()
 {
     if ($this->max_rows_list > 250) {
         $this->setValidationError('max_rows_list', GO::t('maxRowslistTooHigh'));
     }
     if ($this->isModified('password') && isset($this->passwordConfirm) && $this->passwordConfirm != $this->password) {
         $this->setValidationError('passwordConfirm', GO::t('passwordMatchError'));
     }
     if ($this->isModified('disk_quota') && !GO::$ignoreAclPermissions && GO::user()->getModulePermissionLevel('users') < Acl::MANAGE_PERMISSION) {
         $this->setValidationError('disk_quota', 'Only managers of the "users"  module may modify disk quota');
     }
     if (GO::config()->password_validate && $this->isModified('password')) {
         if (!\GO\Base\Util\Validate::strongPassword($this->password)) {
             $this->setValidationError('password', \GO\Base\Util\Validate::getPasswordErrorString($this->password));
         }
     }
     if ($this->isNew && $this->_maxUsersReached()) {
         $this->setValidationError('form', GO::t('max_users_reached', 'users'));
     }
     if (!GO::config()->allow_duplicate_email) {
         $existing = $this->findSingleByAttribute('email', $this->email);
         if ($this->isNew && $existing || $existing && $existing->id != $this->id) {
             $this->setValidationError('email', GO::t('error_email_exists', 'users'));
         }
     }
     $existing = $this->findSingleByAttribute('username', $this->username);
     if ($this->isNew && $existing || $existing && $existing->id != $this->id) {
         $this->setValidationError('username', GO::t('error_username_exists', 'users'));
     }
     if (empty($this->password) && $this->isNew) {
         $this->password = \GO\Base\Util\String::randomPassword();
         $this->generatedRandomPassword = true;
     }
     return parent::validate();
 }
 public function validate()
 {
     $fieldsToCheck = $this->isNew ? array_keys($this->columns) : array_keys($this->getModifiedAttributes());
     foreach ($fieldsToCheck as $field) {
         if (!empty($this->columns[$field]['customfield'])) {
             //				var_dump($field);
             //				var_dump($this->columns[$field]['customfield']->datatype);
             //				echo '<br />'.$this->$field.'<br />';
             if (!$this->columns[$field]['customfield']->customfieldType->validate($this->{$field})) {
                 $this->setValidationError($field, $this->columns[$field]['customfield']->customfieldType->getValidationError());
             }
         }
     }
     return parent::validate();
 }
示例#10
0
文件: Folder.php 项目: ajaboa/crmpuan
 public function validate()
 {
     $this->_checkParentId();
     if ($this->parent_id == 0 && $this->acl_id == 0) {
         //top level folders are readonly to everyone.
         $this->readonly = 1;
         $this->acl_id = \GO::modules()->files->acl_id;
     }
     return parent::validate();
 }
示例#11
0
 /**
  * Validate the inputfields
  * 
  * @return boolean
  */
 public function validate()
 {
     if (!$this->_validateExpression('minutes')) {
         $this->setValidationError('minutes', GO::t('minutesNotMatch', 'cron'));
     }
     if (!$this->_validateExpression('hours')) {
         $this->setValidationError('hours', GO::t('hoursNotMatch', 'cron'));
     }
     if (!$this->_validateExpression('monthdays')) {
         $this->setValidationError('monthdays', GO::t('monthdaysNotMatch', 'cron'));
     }
     if (!$this->_validateExpression('months')) {
         $this->setValidationError('months', GO::t('monthsNotMatch', 'cron'));
     }
     if (!$this->_validateExpression('weekdays')) {
         $this->setValidationError('weekdays', GO::t('weekdaysNotMatch', 'cron'));
     }
     if (!$this->_validateExpression('years')) {
         $this->setValidationError('years', GO::t('yearsNotMatch', 'cron'));
     }
     if ($this->hasValidationErrors()) {
         $this->setValidationError('active', '<br /><br />' . $this->_getExampleFormats());
     }
     return parent::validate();
 }
示例#12
0
文件: Field.php 项目: ajaboa/crmpuan
 public function validate()
 {
     if (!empty($this->validation_regex)) {
         $this->_regex_has_errors = false;
         set_error_handler(array($this, "exception_error_handler"));
         preg_match($this->validation_regex, "");
         if ($this->_regex_has_errors) {
             $this->setValidationError("validation_regex", \GO::t("invalidRegex", "customfields"));
         }
         restore_error_handler();
     }
     return parent::validate();
 }