From 465a2c29d5490baec1fbdac819dc652de5849f63 Mon Sep 17 00:00:00 2001 From: jekkos Date: Sun, 4 Nov 2018 18:53:25 +0100 Subject: [PATCH] Fix temporal dependency in migration --- application/migrations/20170502221506_sales_tax_data.php | 6 +++--- application/models/Appconfig.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/application/migrations/20170502221506_sales_tax_data.php b/application/migrations/20170502221506_sales_tax_data.php index 5b986fae0..f75f09ab3 100644 --- a/application/migrations/20170502221506_sales_tax_data.php +++ b/application/migrations/20170502221506_sales_tax_data.php @@ -36,9 +36,9 @@ class Migration_Sales_Tax_Data extends CI_Migration private function upgrade_tax_history_for_sale($sale_id) { $CI =& get_instance(); - $tax_decimals = $CI->config->config['tax_decimals']; - $tax_included = $CI->config->config['tax_included']; - $customer_sales_tax_support = $CI->config->config['customer_sales_tax_support']; + $tax_decimals = $CI->Appconfig->get('tax_decimals', 2); + $tax_included = $CI->Appconfig->get('tax_included', 0); + $customer_sales_tax_support = $CI->Appconfig->get('customer_sales_tax_support', 0); if($tax_included) { diff --git a/application/models/Appconfig.php b/application/models/Appconfig.php index 09cfef6ef..373c4a842 100644 --- a/application/models/Appconfig.php +++ b/application/models/Appconfig.php @@ -22,7 +22,7 @@ class Appconfig extends CI_Model return $this->db->get(); } - public function get($key) + public function get($key, $default = '') { $query = $this->db->get_where('app_config', array('key' => $key), 1); @@ -31,7 +31,7 @@ class Appconfig extends CI_Model return $query->row()->value; } - return ''; + return $default; } public function save($key, $value)