This is an automated email from the ASF dual-hosted git repository. jleroux pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit 2eeed5182d427bbb071eb5b23c0c7dd5fcc4dcef Author: Jacques Le Roux <[email protected]> AuthorDate: Sat Dec 3 18:43:19 2022 +0100 Fixed: Eca createPaymentFromOrder failed if payment already exist (OFBIZ-12717) Groovy migration, before migration was <if-not-empty field="orderPaymentPrefAndPayments"> <log level="info" message="Payment not created for order ${orderHeader.orderId}, at least a single payment already exists"/> <return/> </if-not-empty> ) After migration is if (from("OrderPaymentPrefAndPayment") .where([EntityCondition.makeCondition("orderId", orderHeader.orderId), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")]) .queryCount() > 1) { return error("Payment not created for order ${orderHeader.orderId}, at least a single payment already exists") } queryCount() > 1 had to be queryCount() > 0 return error had to be return failure Thanks: Marie-Aline Pantais --- applications/accounting/groovyScripts/payment/PaymentServices.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/accounting/groovyScripts/payment/PaymentServices.groovy b/applications/accounting/groovyScripts/payment/PaymentServices.groovy index 45b93c14fb..dddf3db680 100644 --- a/applications/accounting/groovyScripts/payment/PaymentServices.groovy +++ b/applications/accounting/groovyScripts/payment/PaymentServices.groovy @@ -587,8 +587,8 @@ def createPaymentFromOrder() { if (from("OrderPaymentPrefAndPayment") .where([EntityCondition.makeCondition("orderId", orderHeader.orderId), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")]) - .queryCount() > 1) { - return error("Payment not created for order ${orderHeader.orderId}, at least a single payment already exists") + .queryCount() > 0) { + return failure("Payment not created for order ${orderHeader.orderId}, at least a single payment already exists") } GenericValue orderRoleTo = from("OrderRole")

