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 4d7f463db7 Fixed: Three regressions in the minilang-to-Groovy 
conversion of PaymentServices.groovy (OFBIZ-13600)
4d7f463db7 is described below

commit 4d7f463db7a6593484faca0f8dc0706c62389e9f
Author: Mridul Pathak <[email protected]>
AuthorDate: Sat Sep 19 13:49:18 2026 +0530

    Fixed: Three regressions in the minilang-to-Groovy conversion of 
PaymentServices.groovy (OFBIZ-13600)
    
    - removePaymentApplication misspelled statusId as statustId when calling 
setInvoiceStatus, a required parameter, so removing a payment application tied 
to a paid invoice threw a validation exception instead of reverting the invoice 
back to INVOICE_READY
    - createPaymentAndPaymentGroupForInvoices dereferenced its result variable 
without a null check when no invoices produced a valid party grouping, throwing 
an NPE where the original minilang degraded gracefully
    - createPaymentFromOrder returned failure() instead of a plain success when 
an order already had a non-cancelled payment preference, turning an intentional 
no-op into a FAIL-classified result that ServiceUtil.isError() does not catch
    
    Each fix was verified against the original minilang and covered by a 
temporary RED/GREEN test before removal, and the accounting component's payment 
test suite, plus the full accounting suite for regression confidence, pass 
unchanged.
---
 .../org/apache/ofbiz/accounting/payment/PaymentServices.groovy     | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
index 53e2ed2a9a..d8006701b8 100644
--- 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
+++ 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/payment/PaymentServices.groovy
@@ -602,7 +602,7 @@ Map createPaymentAndPaymentGroupForInvoices() {
                        paymentGroupName: "Payment group for Check 
Run(InvoiceIds-${parameters.invoiceIds})"]
         paymentGroupId = result.paymentGroupId
     }
-    if (!result.paymentGroupId) {
+    if (!result?.paymentGroupId) {
         return error(label('AccountingUiLabels', 
'AccountingNoInvoicesReadyOrOutstandingAmountZero'))
     }
     return result
@@ -634,7 +634,8 @@ Map createPaymentFromOrder() {
                 .where([EntityCondition.makeCondition('orderId', 
orderHeader.orderId),
                         EntityCondition.makeCondition('statusId', 
EntityOperator.NOT_EQUAL, 'PAYMENT_CANCELLED')])
                 .queryCount() > 0) {
-            return failure("Payment not created for order 
${orderHeader.orderId}, at least a single payment already exists")
+            logInfo("Payment not created for order ${orderHeader.orderId}, at 
least a single payment already exists")
+            return success()
         }
 
         GenericValue orderRoleTo = from('OrderRole')
@@ -992,7 +993,7 @@ Map removePaymentApplication() {
         GenericValue invoice = from('Invoice').where(invoiceId: 
paymentApplication.invoiceId).queryOne()
         if (invoice.statusId == 'INVOICE_PAID') {
             run service: 'setInvoiceStatus', with: [invoiceId: 
paymentApplication.invoiceId,
-                                                    statustId: 'INVOICE_READY']
+                                                    statusId: 'INVOICE_READY']
         }
         toMessage = label('AccountingUiLabels', 
'AccountingPaymentApplToInvoice', paymentApplicationFields)
     }

Reply via email to