FIX Debug level 3 of accounting account was using wront field
This commit is contained in:
parent
240958ace6
commit
3aea037889
@ -157,7 +157,7 @@ $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||
$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
|
||||
$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)."' )";
|
||||
$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)."' )";
|
||||
|
||||
/*
|
||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
||||
|
||||
@ -851,8 +851,8 @@ class AccountingAccount extends CommonObject
|
||||
|
||||
// Level 3 (define $code_t): Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
if (!empty($buyer->code_compta)) {
|
||||
$code_t = $buyer->code_compta;
|
||||
if (!empty($buyer->code_compta_product)) {
|
||||
$code_t = $buyer->code_compta_product;
|
||||
$suggestedid = $accountingAccount['thirdparty'];
|
||||
$suggestedaccountingaccountfor = 'thridparty';
|
||||
}
|
||||
|
||||
@ -153,9 +153,9 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.tva_intra,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " spe.accountancy_code_sell as company_code_sell";
|
||||
$sql .= " spe.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty
|
||||
} else {
|
||||
$sql .= " s.accountancy_code_sell as company_code_sell";
|
||||
$sql .= " s.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
@ -215,7 +215,7 @@ if ($action == 'validatehistory') {
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
$thirdpartystatic->tva_intra = $objp->tva_intra;
|
||||
$thirdpartystatic->code_compta = $objp->company_code_sell;
|
||||
$thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion)
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
|
||||
@ -539,13 +539,14 @@ if ($result) {
|
||||
$thirdpartystatic->client = $objp->client;
|
||||
$thirdpartystatic->fournisseur = $objp->fournisseur;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
$thirdpartystatic->code_compta = $objp->code_compta_client; // For backward compatibility
|
||||
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
|
||||
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
$thirdpartystatic->tva_intra = $objp->tva_intra;
|
||||
$thirdpartystatic->code_compta_company = $objp->company_code_sell;
|
||||
$thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion)
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
|
||||
@ -554,13 +554,14 @@ class Societe extends CommonObject
|
||||
* Accounting code for client
|
||||
* @var string
|
||||
*/
|
||||
public $code_compta;
|
||||
public $code_compta_client;
|
||||
|
||||
/**
|
||||
* Accounting code for client
|
||||
* Duplicate of code_compta_client (for backward compatibility)
|
||||
* @var string
|
||||
*/
|
||||
public $code_compta_client;
|
||||
public $code_compta;
|
||||
|
||||
|
||||
/**
|
||||
* Accounting code for customer
|
||||
@ -580,6 +581,14 @@ class Societe extends CommonObject
|
||||
*/
|
||||
public $accountancy_code_supplier;
|
||||
|
||||
|
||||
/**
|
||||
* Accounting code for product (for level 3 of suggestion of prouct accounting account)
|
||||
* @var string
|
||||
*/
|
||||
public $code_compta_product;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @deprecated Note is split in public and private notes
|
||||
@ -1822,7 +1831,8 @@ class Societe extends CommonObject
|
||||
$this->code_client = $obj->code_client;
|
||||
$this->code_fournisseur = $obj->code_fournisseur;
|
||||
|
||||
$this->code_compta = $obj->code_compta;
|
||||
$this->code_compta = $obj->code_compta; // For backward compatibility
|
||||
$this->code_compta_client = $obj->code_compta;
|
||||
$this->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
$this->barcode = $obj->barcode;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user