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); }
/** * Returns the static model of the specified AR class. * Please note that you should have this exact method in all your CActiveRecord descendants! * @param string $className active record class name. * @return LbInvoiceTotal the static model class */ public static function model($className = __CLASS__) { return parent::model($className); }
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; }
/** * 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); }
function delete() { $quotation_id = $this->lb_record_primary_key; $result = parent::delete(); if ($result) { $quotation_item = LbQuotationItem::model()->getquotationItems($quotation_id); foreach ($quotation_item->data as $item) { $item->delete(); } $quotation_discount = LbQuotationDiscount::model()->getQuotationDiscounts($quotation_id); foreach ($quotation_discount->data as $discount) { $discount->delete(); } $quotation_tax = LbQuotationTax::model()->getTaxQuotation($quotation_id); foreach ($quotation_tax->data as $tax) { $tax->delete(); } $quotation_total = LbQuotationTotal::model()->getQuotationTotal($quotation_id); $quotation_total->delete(); } }
public function afterSave() { if ($this->lb_customer_is_own_company == self::LB_CUSTOMER_IS_OWN_COMPANY) { $this->resetOwnCompany($this->lb_record_primary_key); } parent::afterSave(); }
/** * 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); }