This is an automated email from the ASF dual-hosted git repository.

mridulpathak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 3531f6eed9 Fixed: Three regressions in the minilang-to-Groovy 
conversion of PaymentServices.groovy (OFBIZ-13600)
3531f6eed9 is described below

commit 3531f6eed9e094257f297e0741eaee981d738945
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 0d8b75600f..7e3f98360f 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
@@ -590,7 +590,7 @@ Map createPaymentAndPaymentGroupForInvoices() {
                        paymentGroupName: "Payment group for Check 
Run(InvoiceIds-${parameters.invoiceIds})"]
         paymentGroupId = result.paymentGroupId
     }
-    require(result.paymentGroupId as boolean, label('AccountingUiLabels', 
'AccountingNoInvoicesReadyOrOutstandingAmountZero'))
+    require(result?.paymentGroupId as boolean, label('AccountingUiLabels', 
'AccountingNoInvoicesReadyOrOutstandingAmountZero'))
     return result
 }
 
@@ -620,7 +620,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')
@@ -961,7 +962,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