コード例 #1
0
ファイル: Info.php プロジェクト: mjrao/BugFree
 protected function afterValidate()
 {
     //check product permission
     if (!self::isProductAccessable($this->product_id)) {
         $this->addError('product_id', $this->getAttributeLabel('product_id') . ' ' . Yii::t('Product', 'No access right to this product'));
     }
     //set modified_by
     if ($this->isNewRecord) {
         $this->modified_by = $this->updated_by;
     } else {
         $dbBugInfo = $this->model()->findByPk($this->id);
         $oldModifiedBy = $dbBugInfo->modified_by;
         if (!in_array($this->updated_by, CommonService::splitStringToArray(',', $oldModifiedBy))) {
             if (empty($this->modified_by)) {
                 $this->modified_by = $this->updated_by;
             } else {
                 $this->modified_by .= ',' . $this->updated_by;
             }
         }
     }
     //set productmodule_id to be null if productmodule_id = 0
     if (0 == $this->productmodule_id) {
         $this->productmodule_id = null;
     }
     //filter duplicated mail_to
     if (!empty($this->mail_to)) {
         $this->mail_to = join(',', CommonService::splitStringToArray(',', $this->mail_to));
     }
     //set assign_to
     if (!empty($this->assign_to_name)) {
         if (TestUser::ACTIVE_USER_NAME == $this->assign_to_name) {
             $this->assign_to = TestUser::ACTIVE_USER_ID;
         } else {
             if (TestUser::CLOSE_USER_NAME == $this->assign_to_name) {
                 $this->assign_to = TestUser::CLOSE_USER_ID;
             } else {
                 $assigntoInfo = TestUser::model()->findByAttributes(array('realname' => $this->assign_to_name));
                 if ($assigntoInfo !== null) {
                     $this->assign_to = $assigntoInfo->id;
                 } else {
                     $assigntoNameError = $this->getError('assign_to_name');
                     if (empty($assigntoNameError)) {
                         $this->addError('assign_to_name', $this->getAttributeLabel('assign_to_name') . ' ' . Yii::t('TestUser', 'user not found'));
                     }
                 }
             }
         }
     } else {
         $this->assign_to = null;
     }
     return parent::afterValidate();
 }
コード例 #2
0
ファイル: FieldConfig.php プロジェクト: mjrao/BugFree
 protected function afterValidate()
 {
     if (!empty($this->editable_action_name)) {
         $this->editable_action = join(',', $this->editable_action_name);
     }
     return parent::afterValidate();
 }
コード例 #3
0
ファイル: TestOption.php プロジェクト: mjrao/BugFree
 /**
  * Returns the static model of the specified AR class.
  * @return TestOption the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
コード例 #4
0
ファイル: TestUser.php プロジェクト: mjrao/BugFree
 protected function beforeValidate()
 {
     $this->email = trim($this->email);
     $this->wangwang = trim($this->wangwang);
     return parent::beforeValidate();
 }