Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numberwords Currency #67

Open
KreativeKrise opened this issue Sep 11, 2024 · 2 comments
Open

Numberwords Currency #67

KreativeKrise opened this issue Sep 11, 2024 · 2 comments
Labels
Bug Something isn't working

Comments

@KreativeKrise
Copy link
Contributor

The module only ever returns the default currency from Dolibarr. It does not matter which currency I select in an invoice, for example.

I'm using dol_convertToWord($amount, $outputlangs, $object->multicurrency_code, true);.
But this method just calls $langs->getLabelFromNumber($num, $type); in the background.
This method does not recognize any currency, which is why the default currency is used.

So if the default Dolibarr method is not working, which method shall I use?

@KreativeKrise KreativeKrise added the Bug Something isn't working label Sep 11, 2024
@KreativeKrise
Copy link
Contributor Author

My workaround for now:

if (isModEnabled('numberwords')) {
    dol_include_once('/numberwords/core/substitutions/functions_numberwords.lib.php');
    $textAmount = numberwords_getLabelFromNumber($outputlangs, $amount, $object->multicurrency_code);
} else {
    $textAmount = dol_convertToWord($amount, $outputlangs, $object->multicurrency_code, true);
}

@eldy
Copy link
Member

eldy commented Oct 14, 2024

Can you try this fix: Replace the line:
$langs->getLabelFromNumber($num, $type);
with
$langs->getLabelFromNumber($num, $currency);

is it ok with this change ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants