From e9d65ea751cf068b04a2e1f333c74da7462e8e5f Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 14 Jun 2018 11:56:22 +0200 Subject: [PATCH 1/2] FIX : need to filter on aa.entity for same accounting accounts available in several entities --- htdocs/accountancy/customer/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index f675c010b37..d5d828ef626 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -235,6 +235,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; } $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy +$sql .= " AND aa.entity = " . $conf->entity; // Add where from hooks $parameters=array(); @@ -439,4 +440,4 @@ if ($result) { } llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); From fed61930d5e50916eaed657211b2ba943032db3b Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 18 Jun 2018 11:37:15 +0200 Subject: [PATCH 2/2] FIX : clause must not be there --- htdocs/accountancy/customer/list.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index d5d828ef626..850e5cae6a9 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -198,7 +198,7 @@ $sql.=$hookmanager->resPrint; $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON (p.accountancy_code_sell = aa.account_number AND aa.entity = ".$conf->entity.")"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version"; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND product_type <= 2"; @@ -235,7 +235,6 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; } $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy -$sql .= " AND aa.entity = " . $conf->entity; // Add where from hooks $parameters=array();