예제 #1
0
 public function beforeSave()
 {
     if (!$this->isNewRecord && !FinvInvoice::model()->findByPk($this->primaryKey)) {
         return false;
     }
     return parent::beforeSave();
 }
예제 #2
0
 public function getSearchCriteria($criteria = null)
 {
     $criteria = parent::getSearchCriteria($criteria);
     /**
      * filter date to from
      */
     if (!empty($this->finv_date_range)) {
         $criteria->AddCondition("t.finv_date >= '" . substr($this->finv_date_range, 0, 10) . "'");
         $criteria->AddCondition("t.finv_date <= '" . substr($this->finv_date_range, -10) . "'");
     }
     if (!empty($this->finv_due_range)) {
         $criteria->AddCondition("t.finv_due_date >= '" . substr($this->finv_due_range, 0, 10) . "'");
         $criteria->AddCondition("t.finv_due_date <= '" . substr($this->finv_due_range, -10) . "'");
     }
     return $criteria;
 }