-
Notifications
You must be signed in to change notification settings - Fork 47
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
[BUG] ZugferdSettings::setUnitAmountDecimals() only works for the first item #73
Comments
Good catch! I suggest to remove all [\d+] from the path using regex. @horstoeko what do you think? |
I think the regex P.S.: But as you can see, new features always bring such crude problems. And now you know why I was actually very reluctant to implement this... :-) |
Fixed :-) PHPUnit tests passed. And example above now works. I am very happy that |
Hi @danielmarschall, Nice! Many thanks....
Sure :-) Best regards |
Fixed problem with ZugferdSettings special decimal places. Fixes #73
Describe the bug
The newly introduced setter to set amount decimals for a specific schema does only work for the first item added to the document. The next item will have a different node path, e.g.:
First item
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:ChargeAmount
Second item
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem[2]/ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:ChargeAmount
Mind the [2] within IncludedSupplyChainTradeLineItem. This way calling ZugferdSettings::setUnitAmountDecimals() will only affect the first item as the schema within the setter is explicitly set to /rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeAgreement/ram:GrossPriceProductTradePrice/ram:ChargeAmount
To Reproduce
Use:
See how prices starting with the second item will be rounded to 2 decimals in the output xml file.
Expected behavior
Should work for all the items added.
Best,
Dennis
The text was updated successfully, but these errors were encountered: