Skip to content

Commit b149bbe

Browse files
authored
Fix Arabic locale currency parsing in accounting reports (OFBIZ-10155) (#1240)
Avoid pre-formatting invoice and payment amounts with NumberFormat before passing them to currency renderers. Keep values as BigDecimal so the existing currency display logic performs the final locale-aware formatting. This prevents Arabic digits from being HTML-escaped into values such as ٢٠ and then failing BigDecimal parsing during report rendering. Thanks Aditya Sharma for reporting the issue.
1 parent ea059ea commit b149bbe

4 files changed

Lines changed: 9 additions & 27 deletions

File tree

applications/accounting/widget/InvoiceForms.xml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -750,12 +750,8 @@ under the License.
750750
<field-map field-name="compareDate" from-field="invoiceDate"/>
751751
<field-map field-name="lastNameFirst" value="Y"/>
752752
</service>
753-
<set field="outstanding" value="${groovy:
754-
import java.text.NumberFormat;
755-
return(NumberFormat.getNumberInstance(context.get(&quot;locale&quot;)).format(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)));}"/>
756-
<set field="total" value="${groovy:
757-
import java.text.NumberFormat;
758-
return(NumberFormat.getNumberInstance(context.get(&quot;locale&quot;)).format(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)));}"/>
753+
<set field="outstanding" value="${groovy:org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)}"/>
754+
<set field="total" value="${groovy:org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)}"/>
759755
</row-actions>
760756
<field name="invoiceId" title="${uiLabelMap.CommonInvoice}" widget-style="buttontext">
761757
<hyperlink description="${invoiceId}" target="viewInvoice">
@@ -783,12 +779,8 @@ under the License.
783779
<field-map field-name="compareDate" from-field="invoiceDate"/>
784780
<field-map field-name="lastNameFirst" value="Y"/>
785781
</service>
786-
<set field="outstanding" value="${groovy:
787-
import java.text.NumberFormat;
788-
return(NumberFormat.getNumberInstance(context.get(&quot;locale&quot;)).format(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)));}"/>
789-
<set field="total" value="${groovy:
790-
import java.text.NumberFormat;
791-
return(NumberFormat.getNumberInstance(context.get(&quot;locale&quot;)).format(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)));}"/>
782+
<set field="amountToApply" value="${groovy:org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)}"/>
783+
<set field="total" value="${groovy:org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)}"/>
792784
</row-actions>
793785
<field name="invoiceId" title="${uiLabelMap.CommonInvoice}" widget-style="buttontext">
794786
<hyperlink description="${invoiceId}" target="viewInvoice">

applications/accounting/widget/PaymentScreens.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ under the License.
169169
<set field="helpAnchor" value="_help_for_payment_applications"/>
170170
<set field="paymentId" from-field="parameters.paymentId"/>
171171
<entity-one entity-name="Payment" value-field="payment"/>
172-
<set field="appliedAmount" type="String" value="${groovy:
173-
import java.text.NumberFormat;
174-
return(NumberFormat.getNumberInstance(context.get(&quot;locale&quot;)).format(org.apache.ofbiz.accounting.payment.PaymentWorker.getPaymentApplied(payment)));}"/>
172+
<set field="appliedAmount" type="BigDecimal" value="${groovy:org.apache.ofbiz.accounting.payment.PaymentWorker.getPaymentApplied(payment)}"/>
175173
<set field="notAppliedAmount" type="BigDecimal" value="${groovy:org.apache.ofbiz.accounting.payment.PaymentWorker.getPaymentNotApplied(payment)}"/>
176174
<set field="notAppliedAmountStr" type="String" value="${groovy:
177175
import java.text.NumberFormat;

applications/accounting/widget/ap/forms/InvoiceForms.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,8 @@ under the License.
3333
<field-map field-name="compareDate" from-field="invoiceDate"/>
3434
<field-map field-name="lastNameFirst" value="Y"/>
3535
</service>
36-
<set field="amountToApply" value="${groovy:
37-
import java.text.NumberFormat;
38-
return(NumberFormat.getNumberInstance(context.get(&quot;locale&quot;)).format(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)));}"/>
39-
<set field="total" value="${groovy:
40-
import java.text.NumberFormat;
41-
return(NumberFormat.getNumberInstance(context.get(&quot;locale&quot;)).format(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)));}"/>
36+
<set field="amountToApply" value="${groovy:org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)}"/>
37+
<set field="total" value="${groovy:org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)}"/>
4238
</row-actions>
4339
<field name="invoiceId" widget-style="buttontext">
4440
<hyperlink description="${invoiceId}" target="viewInvoice">

applications/accounting/widget/ar/forms/InvoiceForms.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ under the License.
3434
<field-map field-name="compareDate" from-field="invoiceDate"/>
3535
<field-map field-name="lastNameFirst" value="Y"/>
3636
</service>
37-
<set field="amountToApply" value="${groovy:
38-
import java.text.NumberFormat;
39-
return(NumberFormat.getNumberInstance(context.get(&quot;locale&quot;)).format(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)));}"/>
40-
<set field="total" value="${groovy:
41-
import java.text.NumberFormat;
42-
return(NumberFormat.getNumberInstance(context.get(&quot;locale&quot;)).format(org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)));}"/>
37+
<set field="outstanding" value="${groovy:org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(delegator,invoiceId)}"/>
38+
<set field="total" value="${groovy:org.apache.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceTotal(delegator,invoiceId)}"/>
4339
</row-actions>
4440
<field name="invoiceId" widget-style="buttontext">
4541
<hyperlink description="${invoiceId}" target="viewInvoice">

0 commit comments

Comments
 (0)