Author: deepak
Date: Sun Dec 16 12:21:52 2018 New Revision: 1849024 URL: http://svn.apache.org/viewvc?rev=1849024&view=rev Log: Improved: Convert createBudget service to entity-auto (OFBIZ-10715) Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/budget/BudgetServices.groovy ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/secas.xml ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/services_budget.xml Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/budget/BudgetServices.groovy URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/budget/BudgetServices.groovy?rev=1849024&r1=1849023&r2=1849024&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/budget/BudgetServices.groovy (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/budget/BudgetServices.groovy Sun Dec 16 12:21:52 2018 @@ -19,24 +19,6 @@ import org.apache.ofbiz.entity.GenericValue - -def createBudget() { - //create new entity and create all the fields - GenericValue newEntity = makeValue('Budget', parameters) - - //create a non existing ID if not supplied - newEntity.budgetId = delegator.getNextSeqId('Budget', 1) - - //finally create the record (should not exist already) - newEntity.create() - - Map setStatusMap = ['budgetId': newEntity.budgetId] - setStatusMap.statusId = 'BG_CREATED' - Map result = run service: 'updateBudgetStatus', with: setStatusMap - result.budgetId = newEntity.budgetId - return result -} - def updateBudgetStatus() { Map result = success() List budgetStatuses = from('BudgetStatus').where([budgetId: parameters.budgetId]).orderBy('-statusDate').queryList() Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/secas.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/secas.xml?rev=1849024&r1=1849023&r2=1849024&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/secas.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/secas.xml Sun Dec 16 12:21:52 2018 @@ -21,6 +21,11 @@ under the License. <service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd"> + <eca service="createBudget" event="commit"> + <set field-name="statusId" value="BG_CREATED"/> + <action service="createBudgetStatus" mode="sync" run-as-user="system"/> + </eca> + <eca service="createPaymentApplication" event="commit"> <condition field-name="invoiceId" operator="is-not-empty"/> <action service="checkInvoicePaymentApplications" mode="sync"/> Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/services_budget.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/services_budget.xml?rev=1849024&r1=1849023&r2=1849024&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/services_budget.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/services_budget.xml Sun Dec 16 12:21:52 2018 @@ -25,8 +25,8 @@ under the License. <version>1.0</version> <!-- Budget --> - <service name="createBudget" default-entity-name="Budget" engine="groovy" - location="component://accounting/groovyScripts/budget/BudgetServices.groovy" invoke="createBudget" auth="true"> + <service name="createBudget" default-entity-name="Budget" engine="entity-auto" + invoke="create" auth="true"> <description>Create a Budget</description> <auto-attributes include="pk" mode="INOUT" optional="true"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> |
Free forum by Nabble | Edit this page |