public function db_array() { $db_array = parent::db_array(); $date = new DateTime(); $db_array['client_note_date'] = $date->format('Y-m-d'); return $db_array; }
public function db_array() { $db_array = parent::db_array(); $db_array['product_price'] = empty($db_array['product_price']) ? null : standardize_amount($db_array['product_price']); $db_array['purchase_price'] = empty($db_array['purchase_price']) ? null : standardize_amount($db_array['purchase_price']); $db_array['family_id'] = empty($db_array['family_id']) ? null : $db_array['family_id']; $db_array['tax_rate_id'] = empty($db_array['tax_rate_id']) ? null : $db_array['tax_rate_id']; return $db_array; }
public function save($id = null, $db_array = null) { parent::save($id, $db_array); $this->load->model('quotes/mdl_quote_amounts'); $quote_id = $this->input->post('quote_id'); if ($quote_id) { $this->mdl_quote_amounts->calculate($quote_id); } }
public function save($id = NULL, $db_array = NULL) { parent::save($id, $db_array); $this->load->model('invoices/mdl_invoice_amounts'); $invoice_id = $this->input->post('invoice_id'); if ($invoice_id) { $this->mdl_invoice_amounts->calculate($invoice_id); } }
public function prep_form($id = NULL) { if (!parent::prep_form($id)) { return FALSE; } if (!$id) { parent::set_form_value('task_finish_date', date('Y-m-d')); } return TRUE; }
public function prep_form($id = null) { if (!parent::prep_form($id)) { return false; } if (!$id) { parent::set_form_value('task_finish_date', date('Y-m-d')); } return true; }
/** * Returns client_id of existing or new record */ public function client_lookup($client_name) { $client = $this->mdl_clients->where('client_name', $client_name)->where('company_id', $this->session->userdata('deskdoo_company_id'))->get(); if ($client->num_rows()) { $client_id = $client->row()->client_id; } else { $db_array = array('client_name' => $client_name, 'company_id' => $this->session->userdata('deskdoo_company_id')); $client_id = parent::save(NULL, $db_array); } return $client_id; }
/** * Returns client_id of existing or new record */ public function client_lookup($client_name) { $client = $this->mdl_clients->where('client_name', $client_name)->get(); if ($client->num_rows()) { $client_id = $client->row()->client_id; } else { $db_array = array('client_name' => $client_name); $client_id = parent::save(NULL, $db_array); } return $client_id; }
public function db_array() { $db_array = parent::db_array(); $db_array['recur_start_date'] = date_to_mysql($db_array['recur_start_date']); $db_array['recur_next_date'] = $db_array['recur_start_date']; if ($db_array['recur_end_date']) { $db_array['recur_end_date'] = date_to_mysql($db_array['recur_end_date']); } else { $db_array['recur_end_date'] = '0000-00-00'; } return $db_array; }
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 prep_form($id = NULL) { parent::prep_form($id); if (!$id) { parent::set_form_value('payment_date', date('Y-m-d')); } }
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)'); }
public function delete($id) { parent::delete($id); $this->load->helper('orphan'); delete_orphans(); }
public function create($db_array = NULL) { $upload_id = parent::save(NULL, $db_array); return $upload_id; }
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 save($quote_id, $id = NULL, $db_array = NULL) { parent::save($id, $db_array); $this->load->model('quotes/mdl_quote_amounts'); $this->mdl_quote_amounts->calculate($quote_id); }
public function db_array() { $db_array = parent::db_array(); $db_array['note_date'] = date('Y-m-d'); return $db_array; }
public function default_select() { // pZ: parent::default_select(); $this->db->select('SQL_CALC_FOUND_ROWS *', FALSE); }
public function create($db_array = null) { $upload_id = parent::save(null, $db_array); return $upload_id; }