From 5a58af7a0100f0dae96e2fc7e3748205e3fc1793 Mon Sep 17 00:00:00 2001 From: objecttothis <17935339+objecttothis@users.noreply.github.com> Date: Mon, 13 Apr 2020 15:02:07 +0400 Subject: [PATCH] Removing LEFT JOIN of supplier table per #2788 the Supplier table results from Item->get_all() and Item->get_info() are not used anywhere and causing a bug where the duplicate fields between the items table and the suppliers table (deleted and category) are returning just one value to the results. This creates the undesired effect of expecting items.deleted and items.category but getting values from suppliers.deleted and suppliers.category. --- application/models/Item.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/application/models/Item.php b/application/models/Item.php index 7307fba2c..fb7abc70f 100644 --- a/application/models/Item.php +++ b/application/models/Item.php @@ -259,7 +259,6 @@ class Item extends CI_Model public function get_all($stock_location_id = -1, $rows = 0, $limit_from = 0) { $this->db->from('items'); - $this->db->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left'); if($stock_location_id > -1) { @@ -289,9 +288,7 @@ class Item extends CI_Model $this->db->select('GROUP_CONCAT(attribute_value SEPARATOR \'|\') AS attribute_values'); $this->db->select('GROUP_CONCAT(attribute_decimal SEPARATOR \'|\') AS attribute_dvalues'); $this->db->select('GROUP_CONCAT(attribute_date SEPARATOR \'|\') AS attribute_dtvalues'); - $this->db->select("MAX(". $this->db->dbprefix('suppliers') .".company_name) AS company_name"); $this->db->from('items'); - $this->db->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left'); $this->db->join('attribute_links', 'attribute_links.item_id = items.item_id', 'left'); $this->db->join('attribute_values', 'attribute_links.attribute_id = attribute_values.attribute_id', 'left'); $this->db->where('items.item_id', $item_id);