diff --git a/application/models/Item.php b/application/models/Item.php index 6fe326e99..ae1ce9bbd 100644 --- a/application/models/Item.php +++ b/application/models/Item.php @@ -190,12 +190,12 @@ class Item extends CI_Model $this->db->group_end(); } - if ($attributes_enabled) + if($attributes_enabled) { $format = $this->db->escape(dateformat_mysql()); $this->db->select('GROUP_CONCAT(DISTINCT CONCAT_WS(\'_\', definition_id, attribute_value) ORDER BY definition_id SEPARATOR \'|\') AS attribute_values'); $this->db->select("GROUP_CONCAT(DISTINCT CONCAT_WS('_', definition_id, DATE_FORMAT(attribute_date, $format)) SEPARATOR '|') AS attribute_dtvalues"); - $this->db->select("GROUP_CONCAT(DISTINCT CONCAT_WS('_', definition_id, attribute_decimal) SEPARATOR '|') AS attribute_dvalues"); + $this->db->select('GROUP_CONCAT(DISTINCT CONCAT_WS(\'_\', definition_id, attribute_decimal) SEPARATOR \'|\') AS attribute_dvalues'); $this->db->join('attribute_links', 'attribute_links.item_id = items.item_id AND attribute_links.receiving_id IS NULL AND attribute_links.sale_id IS NULL AND definition_id IN (' . implode(',', $filters['definition_ids']) . ')', 'left'); $this->db->join('attribute_values', 'attribute_values.attribute_id = attribute_links.attribute_id', 'left'); } diff --git a/application/models/reports/Detailed_receivings.php b/application/models/reports/Detailed_receivings.php index d509ebd8f..223cb8585 100644 --- a/application/models/reports/Detailed_receivings.php +++ b/application/models/reports/Detailed_receivings.php @@ -100,12 +100,12 @@ class Detailed_receivings extends Report $this->db->select('name, item_number, category, quantity_purchased, serialnumber, total, discount, discount_type, item_location, receivings_items_temp.receiving_quantity'); $this->db->from('receivings_items_temp'); $this->db->join('items', 'receivings_items_temp.item_id = items.item_id'); - if (count($inputs['definition_ids']) > 0) + if(count($inputs['definition_ids']) > 0) { $format = $this->db->escape(dateformat_mysql()); - $this->db->select("GROUP_CONCAT(DISTINCT CONCAT_WS('_', definition_id, attribute_value) ORDER BY definition_id SEPARATOR '|') AS attribute_values"); + $this->db->select('GROUP_CONCAT(DISTINCT CONCAT_WS(\'_\', definition_id, attribute_value) ORDER BY definition_id SEPARATOR \'|\') AS attribute_values'); $this->db->select("GROUP_CONCAT(DISTINCT CONCAT_WS('_', definition_id, DATE_FORMAT(attribute_date, $format)) SEPARATOR '|') AS attribute_dtvalues"); - $this->db->select("GROUP_CONCAT(DISTINCT CONCAT_WS('_', definition_id, attribute_decimal SEPARATOR '|') AS attribute_dvalues"); + $this->db->select('GROUP_CONCAT(DISTINCT CONCAT_WS(\'_\', definition_id, attribute_decimal) SEPARATOR \'|\') AS attribute_dvalues'); $this->db->join('attribute_links', 'attribute_links.item_id = items.item_id AND attribute_links.receiving_id = receivings_items_temp.receiving_id AND definition_id IN (' . implode(',', $inputs['definition_ids']) . ')', 'left'); $this->db->join('attribute_values', 'attribute_values.attribute_id = attribute_links.attribute_id', 'left'); $this->db->group_by('receivings_items_temp.receiving_id, receivings_items_temp.item_id'); diff --git a/application/models/reports/Detailed_sales.php b/application/models/reports/Detailed_sales.php index 397f5b3e6..c5aa7aef7 100644 --- a/application/models/reports/Detailed_sales.php +++ b/application/models/reports/Detailed_sales.php @@ -146,12 +146,12 @@ class Detailed_sales extends Report { $this->db->select('name, category, quantity_purchased, item_location, serialnumber, description, subtotal, tax, total, cost, profit, discount, discount_type, sale_status'); $this->db->from('sales_items_temp'); - if (count($inputs['definition_ids']) > 0) + if(count($inputs['definition_ids']) > 0) { $format = $this->db->escape(dateformat_mysql()); - $this->db->select("GROUP_CONCAT(DISTINCT CONCAT_WS('_', definition_id, attribute_value) ORDER BY definition_id SEPARATOR '|') AS attribute_values"); + $this->db->select('GROUP_CONCAT(DISTINCT CONCAT_WS(\'_\', definition_id, attribute_value) ORDER BY definition_id SEPARATOR \'|\') AS attribute_values'); $this->db->select("GROUP_CONCAT(DISTINCT CONCAT_WS('_', definition_id, DATE_FORMAT(attribute_date, $format)) SEPARATOR '|') AS attribute_dtvalues"); - $this->db->select("GROUP_CONCAT(DISTINCT CONCAT_WS('_', definition_id, attribute_decimal SEPARATOR '|') AS attribute_dvalues"); + $this->db->select('GROUP_CONCAT(DISTINCT CONCAT_WS(\'_\', definition_id, attribute_decimal) SEPARATOR \'|\') AS attribute_dvalues'); $this->db->join('attribute_links', 'attribute_links.item_id = sales_items_temp.item_id AND attribute_links.sale_id = sales_items_temp.sale_id AND definition_id IN (' . implode(',', $inputs['definition_ids']) . ')', 'left'); $this->db->join('attribute_values', 'attribute_values.attribute_id = attribute_links.attribute_id'); $this->db->group_by('sales_items_temp.sale_id, sales_items_temp.item_id');