Merge pull request #18116 from aspangaro/14p3

FIX Accountancy - constant ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY
This commit is contained in:
Laurent Destailleur 2021-07-08 21:57:19 +02:00 committed by GitHub
commit 512f58a34a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 16 deletions

View File

@ -201,11 +201,13 @@ if ($action == 'validatehistory') {
}
}
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_sell)) {
$objp->code_sell_t = $objp->company_code_sell;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_sell)) {
$objp->code_sell_t = $objp->company_code_sell;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
}
if ($objp->aarowid_suggest > 0) {

View File

@ -202,11 +202,13 @@ if ($action == 'validatehistory') {
}
}
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_buy)) {
$objp->code_buy_t = $objp->company_code_buy;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
// Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($objp->company_code_buy)) {
$objp->code_buy_t = $objp->company_code_buy;
$objp->aarowid_suggest = $objp->aarowid_thirdparty;
$suggestedaccountingaccountfor = '';
}
}
if ($objp->aarowid_suggest > 0) {

View File

@ -495,10 +495,22 @@ if (empty($reshook)) {
$object->webservices_key = GETPOST('webservices_key', 'san_alpha');
if (GETPOSTISSET('accountancy_code_sell')) {
$object->accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
$accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
if (empty($accountancy_code_sell) || $accountancy_code_sell == '-1') {
$object->accountancy_code_sell = '';
} else {
$object->accountancy_code_sell = $accountancy_code_sell;
}
}
if (GETPOSTISSET('accountancy_code_buy')) {
$object->accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
if (empty($accountancy_code_buy) || $accountancy_code_buy == '-1') {
$object->accountancy_code_buy = '';
} else {
$object->accountancy_code_buy = $accountancy_code_buy;
}
}
// Incoterms
@ -1058,10 +1070,22 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$object->default_lang = GETPOST('default_lang');
if (GETPOSTISSET('accountancy_code_sell')) {
$object->accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
$accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
if (empty($accountancy_code_sell) || $accountancy_code_sell == '-1') {
$object->accountancy_code_sell = '';
} else {
$object->accountancy_code_sell = $accountancy_code_sell;
}
}
if (GETPOSTISSET('accountancy_code_buy')) {
$object->accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
if (empty($accountancy_code_buy) || $accountancy_code_buy == '-1') {
$object->accountancy_code_buy = '';
} else {
$object->accountancy_code_buy = $accountancy_code_buy;
}
}
$object->logo = (isset($_FILES['photo']) ?dol_sanitizeFileName($_FILES['photo']['name']) : '');
@ -1785,10 +1809,22 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$object->webservices_key = GETPOST('webservices_key', 'san_alpha');
if (GETPOSTISSET('accountancy_code_sell')) {
$object->accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
$accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
if (empty($accountancy_code_sell) || $accountancy_code_sell == '-1') {
$object->accountancy_code_sell = '';
} else {
$object->accountancy_code_sell = $accountancy_code_sell;
}
}
if (GETPOSTISSET('accountancy_code_buy')) {
$object->accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
if (empty($accountancy_code_buy) || $accountancy_code_buy == '-1') {
$object->accountancy_code_buy = '';
} else {
$object->accountancy_code_buy = $accountancy_code_buy;
}
}
//Incoterms