From bffdc63ec65065f24bd0914f5de8084ed15a37e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jan 2020 17:44:05 +0100 Subject: [PATCH] FIX The "automatic bind" was linked EEC to export accountancy code Conflicts: htdocs/accountancy/supplier/index.php --- htdocs/accountancy/customer/index.php | 2 ++ htdocs/accountancy/supplier/index.php | 16 +++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index aa3a8d691dd..ab2c00d13b0 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -153,6 +153,8 @@ if ($action == 'validatehistory') { while ($i < min($num_lines, 10000)) { // No more than 10000 at once $objp = $db->fetch_object($result); + $isBuyerInEEC = isInEEC($objp); + // Search suggested account for product/service $suggestedaccountingaccountfor = ''; if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index f1bf4377f42..8cb752aef4c 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -141,13 +141,15 @@ if ($action == 'validatehistory') { setEventMessages($db->lasterror(), null, 'errors'); } else { $num_lines = $db->num_rows($result); - + $isSellerInEEC = isInEEC($mysoc); - + $i = 0; while ($i < min($num_lines, 10000)) { // No more than 10000 at once $objp = $db->fetch_object($result); - + + $isBuyerInEEC = isInEEC($objp); + // Search suggested account for product/service $suggestedaccountingaccountfor = ''; if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) @@ -169,13 +171,13 @@ if ($action == 'validatehistory') { $suggestedaccountingaccountfor = 'export'; } } - + if ($objp->aarowid_suggest > 0) { $sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest; $sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid; - + $resqlupdate = $db->query($sqlupdate); if (! $resqlupdate) { @@ -184,11 +186,11 @@ if ($action == 'validatehistory') { break; } } - + $i++; } } - + if ($error) { $db->rollback();