From abc7198db4e1a66849d4e34046d5c9096e3393ca Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Mon, 28 Oct 2019 12:51:12 +0100 Subject: [PATCH 1/2] Fix Multicompany Filter Select only invoice in current company. --- htdocs/margin/customerMargins.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index b3a2c59e63f..32ef5030cb8 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -220,6 +220,7 @@ if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= ' AND s.entity IN ('.getEntity('societe').')'; +$sql.= ' AND f.entity IN ('.getEntity('').')'; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; if(! empty($TSelectedProducts)) { From d2b7961e873073d52623bad2834066cdae8da88d Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Sun, 3 Nov 2019 22:45:50 +0100 Subject: [PATCH 2/2] Update customerMargins.php --- htdocs/margin/customerMargins.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 32ef5030cb8..78d105ad5cb 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -220,7 +220,7 @@ if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= ' AND s.entity IN ('.getEntity('societe').')'; -$sql.= ' AND f.entity IN ('.getEntity('').')'; +$sql.= ' AND f.entity IN ('.getEntity('invoice').')'; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; if(! empty($TSelectedProducts)) {