Merge pull request #20151 from aspangaro/14p34

FIX Invoice - When you create an invoice and defined a thirdparty, fk_account is not retrieved from company card
This commit is contained in:
Laurent Destailleur 2022-02-28 21:38:07 +01:00 committed by GitHub
commit c1268a3e39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2898,6 +2898,9 @@ if ($action == 'create') {
if (empty($mode_reglement_id)) {
$mode_reglement_id = $soc->mode_reglement_id;
}
if (empty($fk_account)) {
$fk_account = $soc->fk_account;
}
if (!$remise_percent) {
$remise_percent = $soc->remise_percent;
}
@ -3005,6 +3008,9 @@ if ($action == 'create') {
$mode_reglement_id = GETPOST("mode_reglement_id", 'int');
}
// when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value
$fk_account = GETPOSTISSET("fk_account") ? GETPOST("fk_account", 'int') : $fk_account;
if (!empty($soc->id)) {
$absolute_discount = $soc->getAvailableDiscounts();
}
@ -3607,8 +3613,8 @@ if ($action == 'create') {
// Bank Account
if (!empty($conf->banque->enabled)) {
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
$fk_account = GETPOST('fk_account', 'int');
print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
print $form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
print '</td></tr>';
}