Code style adjustments

This commit is contained in:
FrancescoUK
2018-04-14 14:40:02 +01:00
parent 5c1baf20b0
commit 4bab3fc4e3
31 changed files with 66 additions and 55 deletions

View File

@@ -352,7 +352,7 @@ class Customer extends Person
// get_found_rows case
if($count_only == TRUE)
{
return $this->db->get()->row_array()['count'];
return $this->db->get()->row()->count;
}
$this->db->order_by($sort, $order);

View File

@@ -288,7 +288,7 @@ class Employee extends Person
// get_found_rows case
if($count_only == TRUE)
{
return $this->db->get()->row_array()['count'];
return $this->db->get()->row()->count;
}
$this->db->order_by($sort, $order);
@@ -422,7 +422,7 @@ class Employee extends Person
$row = $this->db->get()->row();
// If no grants are assigned yet then set the default to 'home'
if ($row == NULL)
if($row == NULL)
{
return 'home';
}

View File

@@ -139,7 +139,7 @@ class Expense extends CI_Model
// get_found_rows case
if($count_only == TRUE)
{
return $this->db->get()->row_array()['count'];
return $this->db->get()->row()->count;
}
$this->db->group_by('expense_id');

View File

@@ -151,7 +151,7 @@ class Expense_category extends CI_Model
// get_found_rows case
if($count_only == TRUE)
{
return $this->db->get()->row_array()['count'];
return $this->db->get()->row()->count;
}
$this->db->order_by($sort, $order);

View File

@@ -231,7 +231,7 @@ class Giftcard extends CI_Model
// get_found_rows case
if($count_only == TRUE)
{
return $this->db->get()->row_array()['count'];
return $this->db->get()->row()->count;
}
$this->db->order_by($sort, $order);

View File

@@ -29,7 +29,7 @@ class Inventory extends CI_Model
$inventory_sums = $this->Inventory->get_inventory_sum($item_id);
foreach($inventory_sums as $inventory_sum)
{
if ($inventory_sum['sum'] > 0)
if($inventory_sum['sum'] > 0)
{
return $this->Inventory->insert(array(
'trans_inventory' => -1 * $inventory_sum['sum'],

View File

@@ -229,7 +229,7 @@ class Item extends CI_Model
// get_found_rows case
if($count_only == TRUE)
{
return $this->db->get()->row_array()['count'];
return $this->db->get()->row()->count;
}
// avoid duplicated entries with same name because of inventory reporting multiple changes on the same item in the same date range

View File

@@ -231,7 +231,7 @@ class Item_kit extends CI_Model
// get_found_rows case
if($count_only == TRUE)
{
return $this->db->get()->row_array()['count'];
return $this->db->get()->row()->count;
}
$this->db->order_by($sort, $order);

View File

@@ -47,8 +47,10 @@ class Item_kit_items extends CI_Model
$this->delete($item_kit_id);
if ($item_kit_items_data != NULL) {
foreach ($item_kit_items_data as $row) {
if($item_kit_items_data != NULL)
{
foreach($item_kit_items_data as $row)
{
$row['item_kit_id'] = $item_kit_id;
$success &= $this->db->insert('item_kit_items', $row);
}

View File

@@ -279,7 +279,7 @@ class Sale extends CI_Model
// get_found_rows case
if($count_only == TRUE)
{
return $this->db->get()->row_array()['count'];
return $this->db->get()->row()->count;
}
$this->db->group_by('sales.sale_id');
@@ -301,7 +301,7 @@ class Sale extends CI_Model
public function get_payments_summary($search, $filters)
{
// get payment summary
$this->db->select('payment_type, count(payment_amount) AS count, SUM(payment_amount) AS payment_amount');
$this->db->select('payment_type, COUNT(payment_amount) AS count, SUM(payment_amount) AS payment_amount');
$this->db->from('sales AS sales');
$this->db->join('sales_payments', 'sales_payments.sale_id = sales.sale_id');
$this->db->join('people AS customer_p', 'sales.customer_id = customer_p.person_id', 'LEFT');
@@ -874,7 +874,8 @@ class Sale extends CI_Model
{
$cur_item_info = $this->Item->get_info($item['item_id']);
if($cur_item_info->stock_type == HAS_STOCK) {
if($cur_item_info->stock_type == HAS_STOCK)
{
// create query to update inventory tracking
$inv_data = array(
'trans_date' => date('Y-m-d H:i:s'),

View File

@@ -261,7 +261,7 @@ class Supplier extends Person
// get_found_rows case
if($count_only == TRUE)
{
return $this->db->get()->row_array()['count'];
return $this->db->get()->row()->count;
}
$this->db->order_by($sort, $order);

View File

@@ -326,7 +326,7 @@ class Tax extends CI_Model
// get_found_rows case
if($count_only == TRUE)
{
return $this->db->get()->row_array()['count'];
return $this->db->get()->row()->count;
}
$this->db->order_by($sort, $order);
@@ -341,7 +341,7 @@ class Tax extends CI_Model
public function get_tax_code_type_name($tax_code_type)
{
if ($tax_code_type == '0')
if($tax_code_type == '0')
{
return $this->lang->line('taxes_sales_tax');
}
@@ -356,7 +356,7 @@ class Tax extends CI_Model
$suggestions = array();
$this->db->from('tax_codes');
if (!empty($search))
if(!empty($search))
{
$this->db->like('tax_code', $search);
$this->db->or_like('tax_code_name', $search);
@@ -383,7 +383,7 @@ class Tax extends CI_Model
$this->db->from('tax_categories');
$this->db->where('tax_category_id !=', 1);
if (!empty($search))
if(!empty($search))
{
$this->db->like('tax_category', '%'.$search.'%');
}

View File

@@ -16,10 +16,12 @@ class Rounding_mode
$CI->load->helper('language');
$class = new ReflectionClass(__CLASS__);
$result = array();
foreach($class->getConstants() as $key => $value)
{
$result[$value] = lang(strtolower('ENUM_'. $key));
}
return $result;
}
@@ -41,10 +43,12 @@ class Rounding_mode
$CI =& get_instance();
$CI->load->helper('language');
$x = '';
foreach (Rounding_mode::get_rounding_options() as $option => $label)
foreach(Rounding_mode::get_rounding_options() as $option => $label)
{
$x .= "<option value='$option'>".$label."</option>";
}
return $x;
}