Skip to content

FIX: filling of field amount_main_currency for foreign m…#37439

Open
gschratzer wants to merge 5 commits intoDolibarr:developfrom
gschratzer:bugfix/gs260307-001
Open

FIX: filling of field amount_main_currency for foreign m…#37439
gschratzer wants to merge 5 commits intoDolibarr:developfrom
gschratzer:bugfix/gs260307-001

Conversation

@gschratzer
Copy link
Contributor

@gschratzer gschratzer commented Mar 7, 2026

FIX #37428 bank and cash accounts with foreign currency

The parameter amount_main_currency (argument #13 of addline()) was previously filled even when the bank account was already using the company main currency.

This caused the field amount_main_currency to be populated incorrectly for transactions that were not foreign currency operations.

The logic has been updated so that amount_main_currency is only filled when the transaction involves a foreign currency account. For accounts already using the company main currency, the value is now left NULL as expected.

This aligns the behavior with the intended usage of addline() and prevents incorrect data in bank transaction records.

@gschratzer gschratzer changed the title FIX: Issue #37425 filling of field amount_main_currency for foreign m… FIX: Issue #37428 filling of field amount_main_currency for foreign m… Mar 7, 2026
@gschratzer gschratzer changed the title FIX: Issue #37428 filling of field amount_main_currency for foreign m… FIX #37428 filling of field amount_main_currency for foreign m… Mar 7, 2026
@gschratzer gschratzer force-pushed the bugfix/gs260307-001 branch from 7427dd8 to 5634298 Compare March 8, 2026 21:25
…oreign money accounts

The parameter amount_main_currency (argument Dolibarr#13 of addline()) was previously
filled even when the bank account was already using the company main currency.

This caused the field amount_main_currency to be populated incorrectly for
transactions that were not foreign currency operations.

The logic has been updated so that amount_main_currency is only filled when the
transaction involves a foreign currency account. For accounts already using the
company main currency, the value is now left NULL as expected.

This aligns the behavior with the intended usage of addline() and prevents
incorrect data in bank transaction records.
…oreign money accounts

transfer.php: PhanTypeMismatchArgument: Argument 4 ($amount) is price2num((-1 * (float)($amount[$n]))) of type string but \Account::addline() takes float defined at htdocs/compta/bank/class/account.class.php:611
CI-PULL-REQUEST / phan / Run phan
Check warning on line R189
Check warning:
transfer.php: PhanTypeMismatchArgument: Argument 13 ($amount_main_currency) is $amount_main_currency_from of type ?string but \Account::addline() takes ?float defined at htdocs/compta/bank/class/account.class.php:611
CI-PULL-REQUEST / phan / Run phan
@gschratzer gschratzer force-pushed the bugfix/gs260307-001 branch from 5634298 to b8f222c Compare March 8, 2026 21:36
@gschratzer gschratzer requested a review from eldy March 9, 2026 06:33
@gschratzer gschratzer changed the title FIX #37428 filling of field amount_main_currency for foreign m… FIX: filling of field amount_main_currency for foreign m… Mar 9, 2026
@gschratzer
Copy link
Contributor Author

This seems unrelated to my change.
My PR only touches htdocs/compta/bank/transfer.php, while the failing Phan checks point to other files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-currency bank transfer creates mixed currency entries in accounting (EUR debit / MDL credit)

1 participant