public function delete($id = NULL) { // Get the invoice id before deleting payment $this->db->select('invoice_id'); $this->db->where('payment_id', $id); $invoice_id = $this->db->get('fi_payments')->row()->invoice_id; // Delete the payment parent::delete($id); // Recalculate invoice amounts $this->load->model('invoices/mdl_invoice_amounts'); $this->mdl_invoice_amounts->calculate($invoice_id); $this->load->helper('orphan'); delete_orphans(); }
public function delete($item_id) { // Get the quote id so we can recalculate quote amounts $this->db->select('quote_id'); $this->db->where('item_id', $item_id); $quote_id = $this->db->get('ip_quote_items')->row()->quote_id; // Delete the item parent::delete($item_id); // Delete the item amounts $this->db->where('item_id', $item_id); $this->db->delete('ip_quote_item_amounts'); // Recalculate quote amounts $this->load->model('quotes/mdl_quote_amounts'); $this->mdl_quote_amounts->calculate($quote_id); }
public function delete($id = NULL) { // Get the invoice id before deleting payment $this->db->select('invoice_id'); $this->db->where('payment_id', $id); $invoice_id = $this->db->get('ip_payments')->row()->invoice_id; // Delete the payment parent::delete($id); // Recalculate invoice amounts $this->load->model('invoices/mdl_invoice_amounts'); $this->mdl_invoice_amounts->calculate($invoice_id); // Change invoice status back to sent $this->db->select('invoice_status_id'); $this->db->where('invoice_id', $invoice_id); $invoice = $this->db->get('ip_invoices')->row(); if ($invoice->invoice_status_id == 4) { $this->db->where('invoice_id', $invoice_id); $this->db->set('invoice_status_id', 2); $this->db->update('ip_invoices'); } $this->load->helper('orphan'); delete_orphans(); }
public function delete($id) { parent::delete($id); $this->load->helper('orphan'); delete_orphans(); }
public function delete($import_id) { // Gather the import details $import_details = $this->db->where('import_id', $import_id)->get('ip_import_details')->result(); // Loop through details and delete each of the imported records foreach ($import_details as $import_detail) { $this->db->query("DELETE FROM " . $import_detail->import_table_name . " WHERE " . $this->primary_keys[$import_detail->import_table_name] . ' = ' . $import_detail->import_record_id); } // Delete the master import record parent::delete($import_id); // Delete the detail records $this->db->where('import_id', $import_id); $this->db->delete('ip_import_details'); // Delete any orphaned records $this->load->helper('orphan'); delete_orphans(); }
public function delete($import_id) { $import_details = $this->db->where('import_id', $import_id)->get('fi_import_details')->result(); foreach ($import_details as $import_detail) { $this->db->query("DELETE FROM " . $import_detail->import_table_name . " WHERE " . $this->primary_keys[$import_detail->import_table_name] . ' = ' . $import_detail->import_record_id); } parent::delete($import_id); $this->db->query('DELETE FROM fi_invoice_amounts WHERE invoice_id NOT IN (SELECT invoice_id FROM fi_invoices)'); }