public function delete() { $invoice_id = $this->lb_invoice_id; $item_type = $this->lb_invoice_item_type; $result = parent::delete(); // post delete // have to call it here because we need to make use of the record id if ($item_type == LbInvoiceItem::LB_INVOICE_ITEM_TYPE_LINE) { $this->onLineItemDeleted($invoice_id); } else { if ($item_type == LbInvoiceItem::LB_INVOICE_ITEM_TYPE_DISCOUNT) { $this->onDiscountDeleted($invoice_id); } else { if ($item_type == LbInvoiceItem::LB_INVOICE_ITEM_TYPE_TAX) { $this->onTaxDeleted($invoice_id); } } } return $result; }
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(); } }