FIX The "automatic bind" was linked EEC to export accountancy code

Conflicts:
	htdocs/accountancy/supplier/index.php
This commit is contained in:
Laurent Destailleur 2020-01-28 17:44:05 +01:00
parent 751247d3f3
commit bffdc63ec6
2 changed files with 11 additions and 7 deletions

View File

@ -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)

View File

@ -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();