Fix missing ) and minor change

This commit is contained in:
FrancescoUK
2019-06-22 16:39:18 +01:00
parent 8ca5449b79
commit 1f2aa2708d
3 changed files with 8 additions and 8 deletions

View File

@@ -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');
}

View File

@@ -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');

View File

@@ -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');