You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2026/09/07 11:18:30 UTC
(ofbiz-framework) branch release24.09 updated: Fixed: createInvoiceItemPayrol crashes on Deduction/Tax amount entry (OFBIZ-13561)
This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release24.09 by this push:
new f22037abb9 Fixed: createInvoiceItemPayrol crashes on Deduction/Tax amount entry (OFBIZ-13561)
f22037abb9 is described below
commit f22037abb968c100e508769001ffaa0dfe530152
Author: Mridul Pathak <mr...@gmail.com>
AuthorDate: Mon Sep 7 15:56:30 2026 +0530
Fixed: createInvoiceItemPayrol crashes on Deduction/Tax amount entry (OFBIZ-13561)
- Coerced the raw HTTP-string Amount parameter to BigDecimal before negating it (this event receives raw, unconverted request strings, unlike a service context) - fixes a crash on every Deduction/Tax line item entry
- Removed the ?: 1d/?: 0d defaults for blank Quantity/Amount to match minilang's null-skip behavior, restoring the original validation-rejects-blank-amount behavior for Earnings/Hours rows
- Restored the description separator's leading space ("X : Y", matching minilang) lost in the conversion
---
.../ofbiz/accounting/invoice/InvoiceEvents.groovy | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceEvents.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceEvents.groovy
index d08f24968a..318893ef4d 100644
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceEvents.groovy
+++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceEvents.groovy
@@ -32,14 +32,20 @@ Map createInvoiceItemPayrol() {
if (payRol.parentTypeId == payRolGroup.invoiceItemTypeId) {
Map createInvoiceItem = [invoiceId: parameters.invoiceId,
invoiceItemTypeId: payRol.invoiceItemTypeId,
- description: "${payRolGroup.description}: ${payRol.description}",
- quantity: parameters."${payRol.invoiceItemTypeId}_Quantity" ?: 1d,
- amount: parameters."${payRol.invoiceItemTypeId}_Amount" ?: 0d]
+ description: "${payRolGroup.description} : ${payRol.description}"]
+ String quantityParam = parameters."${payRol.invoiceItemTypeId}_Quantity"
+ if (quantityParam) {
+ createInvoiceItem.quantity = quantityParam
+ }
+ String amountParam = parameters."${payRol.invoiceItemTypeId}_Amount"
+ if (amountParam) {
+ createInvoiceItem.amount = amountParam
+ }
- if (parameters."${payRol.invoiceItemTypeId}_Quantity" ||
- parameters."${payRol.invoiceItemTypeId}_Amount") {
+ if (quantityParam || amountParam) {
if ('PAYROL_EARN_HOURS' != payRolGroup.invoiceItemTypeId) {
- createInvoiceItem.amount = createInvoiceItem.amount.negate()
+ BigDecimal amountValue = amountParam ? new BigDecimal(amountParam) : BigDecimal.ZERO
+ createInvoiceItem.amount = amountValue.negate()
}
Map serviceResult = run service: 'createInvoiceItem', with: createInvoiceItem
if (ServiceUtil.isError(serviceResult)) {