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

FIX round capital societe #29211

Merged
merged 2 commits into from
Apr 12, 2024
Merged

Conversation

atm-jonathan
Copy link
Contributor

@atm-jonathan atm-jonathan commented Apr 3, 2024

Instructions

$societe->capital
Does not respect "Limites et précisions"

FIX|Fix #[rounding capital]

add price() for display capital
before 2000000.00000000 (double24.8)
after fix 2 000 000,00 with price()

@atm-jonathan atm-jonathan changed the title round capital societe FIX round capital societe Apr 3, 2024
Copy link
Member

@eldy eldy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The substitution array must contains brut data, so a number must have a php number format in memory. And price format a data for output so data is no more a number but a string with special chars. A data can't be reused once formated with price.
May be you want to use price2num function ?

@@ -323,7 +323,7 @@ public function get_substitutionarray_thirdparty($object, $outputlangs, $array_k
'company_supplieraccountancycode'=>$object->code_compta_fournisseur,
'company_juridicalstatus'=>$object->forme_juridique,
'company_outstanding_limit'=>$object->outstanding_limit,
'company_capital'=>$object->capital,
'company_capital'=> price($object->capital, 0, '', 1, -1),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The substitution array must contains brut data, so a number must have a php number format in memory. And price format a data for output so data is no more a number but a string with special chars. A data can't be reused once formated with price.
May be you want to use price2num function ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok so can we have a new array key like company_capital_formated ? we have things like that for total fields of customer documents

Copy link
Member

@eldy eldy Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, i think it is a better idea to have company_capital_formatted if you want to use a ready text formatted price.
company_capital = brut data
company_capital_formatted = data formatted according to language, country, currency and rounding setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eldy I've made the change

@eldy eldy added the PR to fix - See feedback in comments PR needs to be fixed to be integrated (some comments should describes the fix to do) label Apr 4, 2024
@eldy eldy merged commit 1adda98 into Dolibarr:18.0 Apr 12, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR to fix - See feedback in comments PR needs to be fixed to be integrated (some comments should describes the fix to do)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants