This is an automated email from the ASF dual-hosted git repository.
surajk 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 21a8bfa Improved: Converted massChangePaymentStatus service from mini-lang to groovy. (OFBIZ-11498) Thanks Devanshu Vyas for reporting and Rushikesh Mawal for initial patch. 21a8bfa is described below commit 21a8bfaef7addd921b181ba6f48ce1df2078d98f Author: Suraj Khurana <[hidden email]> AuthorDate: Sat May 23 15:23:13 2020 +0530 Improved: Converted massChangePaymentStatus service from mini-lang to groovy. (OFBIZ-11498) Thanks Devanshu Vyas for reporting and Rushikesh Mawal for initial patch. --- .../accounting/groovyScripts/payment/PaymentServices.groovy | 13 +++++++++++++ .../accounting/minilang/payment/PaymentServices.xml | 10 ---------- applications/accounting/servicedef/services_payment.xml | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/applications/accounting/groovyScripts/payment/PaymentServices.groovy b/applications/accounting/groovyScripts/payment/PaymentServices.groovy index c28ce07..212207d 100644 --- a/applications/accounting/groovyScripts/payment/PaymentServices.groovy +++ b/applications/accounting/groovyScripts/payment/PaymentServices.groovy @@ -133,4 +133,17 @@ def updatePaymentContent() { return ServiceUtil.returnError("Error getting Payment Content") } } +def massChangePaymentStatus() { + serviceResult = success() + Map setPaymentStatusMap = [:] + parameters.paymentIds.each{ paymentId -> + setPaymentStatusMap.paymentId = paymentId + setPaymentStatusMap.statusId = parameters.statusId + setPaymentStatusMap.userLogin = parameters.userLogin + result = run service: 'setPaymentStatus', with: setPaymentStatusMap + if (ServiceUtil.isError(result)) return result + setPaymentStatusMap.clear() + } + return serviceResult +} diff --git a/applications/accounting/minilang/payment/PaymentServices.xml b/applications/accounting/minilang/payment/PaymentServices.xml index 1c32621..ae862251 100644 --- a/applications/accounting/minilang/payment/PaymentServices.xml +++ b/applications/accounting/minilang/payment/PaymentServices.xml @@ -785,16 +785,6 @@ under the License. </else> </if-not-empty> </simple-method> - - <simple-method method-name="massChangePaymentStatus" short-description="Service set status of Payments in bulk."> - <iterate list="parameters.paymentIds" entry="paymentId"> - <set field="setPaymentStatusMap.paymentId" from-field="paymentId"/> - <set field="setPaymentStatusMap.statusId" from-field="parameters.statusId"/> - <call-service service-name="setPaymentStatus" in-map-name="setPaymentStatusMap"/> - <clear-field field="setPaymentStatusMap"/> - </iterate> - </simple-method> - <simple-method method-name="createPaymentFromOrder" short-description="Service auto create Payment from Order when payment does exist yet and not disabled by accounting config"> <entity-one entity-name="OrderHeader" value-field="orderHeader"/> diff --git a/applications/accounting/servicedef/services_payment.xml b/applications/accounting/servicedef/services_payment.xml index dd9b2cd..e1c8344 100644 --- a/applications/accounting/servicedef/services_payment.xml +++ b/applications/accounting/servicedef/services_payment.xml @@ -227,8 +227,8 @@ under the License. <implements service="createPaymentGroupAndMember"/> </service> - <service name="massChangePaymentStatus" engine="simple" - location="component://accounting/minilang/payment/PaymentServices.xml" invoke="massChangePaymentStatus" auth="true"> + <service name="massChangePaymentStatus" engine="groovy" + location="component://accounting/groovyScripts/payment/PaymentServices.groovy" invoke="massChangePaymentStatus" auth="true"> <description>Set status of Payments in bulk.</description> <attribute name="paymentIds" type="List" mode="IN" optional="false"/> <attribute name="statusId" type="String" mode="IN" optional="false"/> |
Free forum by Nabble | Edit this page |