From b04e90c75d0c5c3314c9afba1973006e521bf21b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Salvador?= Date: Tue, 23 Jul 2013 15:05:35 +0200 Subject: [PATCH 1/2] added fields to group-by statements so it stops raising errors in strict mode --- htdocs/margin/agentMargins.php | 2 +- htdocs/margin/customerMargins.php | 4 ++-- htdocs/margin/productMargins.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 9bf75d0a332..bb12125a345 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -158,7 +158,7 @@ $sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; if ($agentid > 0) - $sql.= " GROUP BY s.rowid"; + $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname, f.type"; else $sql.= " GROUP BY u.rowid, s.nom, s.rowid, s.code_client, s.client, u.login, u.lastname, u.firstname, f.type "; $sql.= " ORDER BY $sortfield $sortorder "; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 9ce32a701cb..88622bdf7ad 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -176,9 +176,9 @@ $sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; if ($client) - $sql.= " GROUP BY f.rowid"; + $sql.= " GROUP BY f.rowid, s.rowid, s.nom, s.code_client, s.client, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.type "; else - $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.rowid "; + $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.rowid, f.type "; $sql.= " ORDER BY $sortfield $sortorder "; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 26aaa953d78..e50534d1f7f 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -180,9 +180,9 @@ $sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; if ($id > 0) - $sql.= " GROUP BY f.rowid"; + $sql.= " GROUP BY f.rowid, d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.type"; else - $sql.= " GROUP BY d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.rowid"; + $sql.= " GROUP BY d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.rowid, f.type"; $sql.= " ORDER BY $sortfield $sortorder "; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); @@ -312,4 +312,4 @@ $(document).ready(function() { $("#markRate").html(""); }); - \ No newline at end of file + From 28247f37aea5656d0ee9c23fb2012a73331010dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Salvador?= Date: Tue, 23 Jul 2013 15:15:01 +0200 Subject: [PATCH 2/2] corrected filter in form_thirdparty call --- htdocs/margin/customerMargins.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 88622bdf7ad..67bf8cef506 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -86,7 +86,7 @@ if ($socid > 0) { { print ''.$langs->trans('ThirdPartyName').''; print ''; - $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,$socid,'socid','client=1',1,0,1); + $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,$socid,'socid','client=1 OR client=3',1,0,1); print ''; $client = true; @@ -97,7 +97,7 @@ if ($socid > 0) { else { print ''.$langs->trans('ThirdPartyName').''; print ''; - $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$socid,null,'socid','client=1',1,0,1); + $form->form_thirdparty($_SERVER['PHP_SELF'],null,'socid','client=1 OR client=3',1,0,1); print ''; }