FIX also on customer index for automatic binding

This commit is contained in:
Alexandre SPANGARO
2021-10-13 21:36:04 +02:00
parent 5d7587259d
commit 9e3a00521d

View File

@@ -170,6 +170,8 @@ if ($action == 'validatehistory') {
} else {
$num_lines = $db->num_rows($result);
$facture_static = new Facture($db);
$isSellerInEEC = isInEEC($mysoc);
$i = 0;
@@ -213,6 +215,18 @@ if ($action == 'validatehistory') {
}
}
// Manage Deposit
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
$accountdeposittoventilated = new AccountingAccount($db);
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
$objp->code_sell_l = $accountdeposittoventilated->ref;
$objp->code_sell_p = '';
$objp->code_sell_t = '';
$objp->aarowid_suggest = $accountdeposittoventilated->rowid;
}
}
if ($objp->aarowid_suggest > 0) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";
$sqlupdate .= " SET fk_code_ventilation = ".((int) $objp->aarowid_suggest);