public function save($runValidation = TRUE, $attributes = null) { $this->lb_account_id = Yii::app()->user->id; $this->lb_document_uploaded_datetime = date('Y-m-d H:i:s'); return parent::save($runValidation, $attributes); }
/** * Save an unconfirmed copy. This record has almost nothing * * @param string $runValidation * @param string $attributes * @return boolean */ public function saveUnconfirmed($runValidation = true, $attributes = NULL) { //$this->lb_invoice_no = '0'; //$this->lb_invoice_date = date('Y-m-d'); //$this->lb_invoice_due_date = date('Y-m-d'); return parent::save($runValidation, $attributes); }
public function save($runValidation = true, $attributes = false) { if ($this->lb_invoice_item_type == $this::LB_INVOICE_ITEM_TYPE_LINE) { $this->calculateItemTotal(); } else { if ($this->lb_invoice_item_type == $this::LB_INVOICE_ITEM_TYPE_DISCOUNT) { // same as line item $this->calculateItemTotal(); } else { if ($this->lb_invoice_item_type == $this::LB_INVOICE_ITEM_TYPE_TAX) { // tax total is calculated differently $this->calculateTaxTotal(); } } } $result = parent::save($runValidation, $attributes); return $result; }
/** * Override save function to check for item template with same description * * @param bool $runValidation * @param null $attributes * @return bool */ public function save($runValidation = true, $attributes = null) { if ($this->itemExists()) { return false; } return parent::save($runValidation, $attributes); }