From 440df980ea930a22a1927bd025b895603c528278 Mon Sep 17 00:00:00 2001
From: fmarcet <fmarcet@2byte.es>
Date: Thu, 29 Oct 2015 13:43:07 +0100
Subject: [PATCH] Fix SQL Query

---
 htdocs/margin/productMargins.php | 2 +-
 htdocs/societe/consumption.php   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php
index 990acd801c7..3f2893ffcfb 100644
--- a/htdocs/margin/productMargins.php
+++ b/htdocs/margin/productMargins.php
@@ -162,7 +162,7 @@ if (! empty($conf->global->DISPLAY_MARK_RATES)) {
 print "</table>";
 print '</form>';
 
-$sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity";
+$sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,";
 if ($id > 0) $sql.= " d.fk_product,";
 if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
 $sql.= " sum(d.total_ht) as selling_price,";
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index 7697c203048..2282b42cf0f 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -285,7 +285,7 @@ $sql = $sql_select;
 $sql.= ' d.description as description,';
 if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,';
 if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,';
-if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity';
+if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,';
 $sql.= " s.rowid as socid ";
 if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label";
 $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from;
-- 
GitLab