Author: nmalin
Date: Mon Jun 19 18:27:14 2017 New Revision: 1799252 URL: http://svn.apache.org/viewvc?rev=1799252&view=rev Log: Improved: Convert RateServices.xml mini-lang to groovyDSL (OFBIZ-9381) With service rate minilang conversion to groovy, I renamed deleteRateAmount and deletePartyRate to expireRateAmount and expirePartyRate for more coherence between the service process and the name. The previous service naming have been kept to set them as deprecated Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/rate/RateServices.groovy ofbiz/ofbiz-framework/trunk/applications/accounting/minilang/test/RateTests.xml ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/services_rate.xml ofbiz/ofbiz-framework/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml ofbiz/ofbiz-framework/trunk/applications/accounting/widget/GlobalGlAccountsForms.xml ofbiz/ofbiz-framework/trunk/applications/accounting/widget/InvoiceForms.xml ofbiz/ofbiz-framework/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/PartyForms.xml Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/rate/RateServices.groovy URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/rate/RateServices.groovy?rev=1799252&r1=1799251&r2=1799252&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/rate/RateServices.groovy (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/rate/RateServices.groovy Mon Jun 19 18:27:14 2017 @@ -49,8 +49,8 @@ def updateRateAmount() { if (rateAmountLookedUpValue) { updating = (rateAmountLookedUpValue.fromDate.compareTo(newEntity.fromDate) == 0) if (rateAmountLookedUpValue.rateAmount != rateAmount) { - Map deleteRateAmountMap = dispatcher.getDispatchContext().makeValidContext('deleteRateAmount', 'IN', rateAmountLookedUpValue) - result = run service: 'deleteRateAmount', with: deleteRateAmountMap + Map expireRateAmountMap = dispatcher.getDispatchContext().makeValidContext('expireRateAmount', 'IN', rateAmountLookedUpValue) + result = run service: 'expireRateAmount', with: expireRateAmountMap if (ServiceUtil.isError(result)) return result } else { return error(UtilProperties.getMessage('AccountingErrorUiLabels', 'AccountingUpdateRateAmountAlreadyExist', locale)) @@ -64,7 +64,7 @@ def updateRateAmount() { /** * Service to expire a rate amount value */ -def deleteRateAmount() { +def expireRateAmount() { GenericValue lookedUpValue = delegator.makeValidValue('RateAmount', parameters) if (!lookedUpValue.rateCurrencyUomId) { lookedUpValue.rateCurrencyUomId = UtilProperties.getPropertyValue('general.properties', 'currency.uom.id.default') @@ -79,6 +79,13 @@ def deleteRateAmount() { } return success() } +/** + * Information to update the specific customer code after change service deleteRateAmount to expireRateAmount + * @return + */ +def deleteRateAmount() { + return error('delete rate amount isn\'t possible, please update your code with service name "expireRateAmount" instead "deleteRateAmount"') +} def updatePartyRate() { List<GenericValue> partyRates = from('PartyRate').where([partyId: partyId, rateTypeId: rateTypeId]).queryList() @@ -105,16 +112,18 @@ def updatePartyRate() { } return success() } - def deletePartyRate() { + return error('delete party rate isn\'t possible, please update your code with service name "expirePartyRate" instead "deletePartyRate"') +} +def expirePartyRate() { GenericValue lookedUpValue = from('PartyRate').where([partyId: partyId, rateTypeId: rateTypeId, fromDate: fromDate]).queryOne() if (lookedUpValue) { lookedUpValue.thruDate = UtilDateTime.nowTimestamp() lookedUpValue.store() //expire related rate amount - Map deleteRateAmountMap = dispatcher.getDispatchContext().makeValidContext('deleteRateAmount', 'IN', parameters) - result = run service: 'deleteRateAmount', with: deleteRateAmountMap + Map expireRateAmountMap = dispatcher.getDispatchContext().makeValidContext('expireRateAmount', 'IN', parameters) + result = run service: 'expireRateAmount', with: expireRateAmountMap if (ServiceUtil.isError(result)) return result } return success() Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/minilang/test/RateTests.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/minilang/test/RateTests.xml?rev=1799252&r1=1799251&r2=1799252&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/minilang/test/RateTests.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/minilang/test/RateTests.xml Mon Jun 19 18:27:14 2017 @@ -47,7 +47,7 @@ under the License. </assert> <check-errors/> </simple-method> - <simple-method method-name="testDeleteRateAmount" short-description="test to delete RateAmount" login-required="false"> + <simple-method method-name="testExpireRateAmount" short-description="test to expire RateAmount" login-required="false"> <set field="serviceCtx.rateTypeId" value="AVERAGE_PAY_RATE"/> <set field="serviceCtx.emplPositionTypeId" value="TEST_EMPLOYEE"/> <set field="serviceCtx.periodTypeId" value="RATE_MONTH"/> @@ -56,7 +56,7 @@ under the License. <field-map field-name="userLoginId" value="system"/> </entity-one> <set field="serviceCtx.userLogin" from-field="userLogin"/> - <call-service service-name="deleteRateAmount" in-map-name="serviceCtx"/> + <call-service service-name="expireRateAmount" in-map-name="serviceCtx"/> <entity-one entity-name="RateAmount" value-field="rateAmount"> <field-map field-name="rateTypeId" value="AVERAGE_PAY_RATE"/> <field-map field-name="workEffortId" value="_NA_"/> @@ -170,7 +170,7 @@ under the License. </assert> <check-errors/> </simple-method> - <simple-method method-name="testDeletePartyRate" short-description="test to delete PartyRate" login-required="false"> + <simple-method method-name="testExpirePartyRate" short-description="test to expire PartyRate" login-required="false"> <set field="serviceCtx.partyId" value="TEST_PARTY"/> <set field="serviceCtx.rateTypeId" value="AVERAGE_PAY_RATE"/> <set field="serviceCtx.fromDate" type="Timestamp" value="2013-07-04 00:00:00"/> @@ -178,7 +178,7 @@ under the License. <field-map field-name="userLoginId" value="system"/> </entity-one> <set field="serviceCtx.userLogin" from-field="userLogin"/> - <call-service service-name="deletePartyRate" in-map-name="serviceCtx"/> + <call-service service-name="expirePartyRate" in-map-name="serviceCtx"/> <entity-one entity-name="PartyRate" value-field="partyRate"> <field-map field-name="rateTypeId" value="AVERAGE_PAY_RATE"/> <field-map field-name="partyId" value="TEST_PARTY"/> Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/services_rate.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/services_rate.xml?rev=1799252&r1=1799251&r2=1799252&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/services_rate.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/servicedef/services_rate.xml Mon Jun 19 18:27:14 2017 @@ -36,8 +36,8 @@ under the License. <override name="periodTypeId" default-value="RATE_HOUR"/> <override name="partyId" default-value="_NA_"/> </service> - <service name="deleteRateAmount" default-entity-name="RateAmount" engine="groovy" auth="true" - location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="deleteRateAmount"> + <service name="expireRateAmount" default-entity-name="RateAmount" engine="groovy" auth="true" + location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="expireRateAmount"> <description>expire Rate Amount</description> <permission-service service-name="acctgBasePermissionCheck" main-action="CREATE"/> <auto-attributes include="pk" mode="IN" optional="true"/> @@ -48,6 +48,14 @@ under the License. <override name="periodTypeId" default-value="RATE_HOUR"/> <override name="partyId" default-value="_NA_"/> </service> + <service name="deleteRateAmount" default-entity-name="RateAmount" engine="groovy" auth="true" + location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="deleteRateAmount"> + <description>Deprecated please use expireRateAmount</description> + <permission-service service-name="acctgBasePermissionCheck" main-action="CREATE"/> + <auto-attributes include="pk" mode="IN" optional="true"/> + <override name="rateTypeId" optional="false"/> + <override name="fromDate" optional="false"/> + </service> <service name="getRateAmount" default-entity-name="RateAmount" engine="simple" auth="true" location="component://accounting/minilang/rate/RateServices.xml" invoke="getRateAmount"> <description>Get Rate Amount</description> @@ -118,6 +126,13 @@ under the License. </service> <service name="deletePartyRate" default-entity-name="PartyRate" engine="groovy" auth="true" location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="deletePartyRate"> + <description>Deletes PartyRate</description> + <permission-service service-name="acctgBasePermissionCheck" main-action="UPDATE"/> + <auto-attributes include="pk" mode="IN" optional="false"/> + <attribute name="rateAmountFromDate" type="Timestamp" mode="IN" optional="true"/> + </service> + <service name="expirePartyRate" default-entity-name="PartyRate" engine="groovy" auth="true" + location="component://accounting/groovyScripts/rate/RateServices.groovy" invoke="expirePartyRate"> <description>Expire PartyRate and expire related rateAmount</description> <permission-service service-name="acctgBasePermissionCheck" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=1799252&r1=1799251&r2=1799252&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Mon Jun 19 18:27:14 2017 @@ -1675,9 +1675,9 @@ under the License. <response name="error" type="view" value="ViewRateAmounts"/> </request-map> - <request-map uri="deleteRateAmount"> + <request-map uri="expireRateAmount"> <security https="true" auth="true"/> - <event type="service" invoke="deleteRateAmount"/> + <event type="service" invoke="expireRateAmount"/> <response name="success" type="view" value="ViewRateAmounts"/> <response name="error" type="view" value="ViewRateAmounts"/> </request-map> Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/widget/GlobalGlAccountsForms.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/widget/GlobalGlAccountsForms.xml?rev=1799252&r1=1799251&r2=1799252&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/widget/GlobalGlAccountsForms.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/widget/GlobalGlAccountsForms.xml Mon Jun 19 18:27:14 2017 @@ -228,7 +228,7 @@ under the License. <field name="acctgTransEntrySeqId"><display/></field> <field name="reconciledAmount"><display/></field> </form> - <form name="ListRateAmounts" type="list" target="deleteRateAmount" paginate-target="viewRateAmounts" + <form name="ListRateAmounts" type="list" target="expireRateAmount" paginate-target="viewRateAmounts" odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar"> <actions> <set field="sortField" from-field="parameters.sortField" default-value="rateTypeId"/> Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/widget/InvoiceForms.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/widget/InvoiceForms.xml?rev=1799252&r1=1799251&r2=1799252&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/widget/InvoiceForms.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/widget/InvoiceForms.xml Mon Jun 19 18:27:14 2017 @@ -81,7 +81,7 @@ under the License. </hyperlink> </field> <field name="invoiceTypeId" sort-field="true"><display-entity entity-name="InvoiceType"/></field> - <field name="invoiceDate" sort-field="true"><display type="date"/></field> + <field name="invoiceDate" sort-field="true"><display description="${date:dateTimeString(invoiceDate, timeZone, locale)}"/></field> <field name="statusId" title="${uiLabelMap.CommonStatus}" sort-field="true"><display-entity entity-name="StatusItem"/></field> <field name="description" sort-field="true"><display/></field> <field name="partyIdFrom" title="${uiLabelMap.AccountingFromParty}" sort-field="true"> Modified: ofbiz/ofbiz-framework/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml?rev=1799252&r1=1799251&r2=1799252&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml Mon Jun 19 18:27:14 2017 @@ -505,9 +505,9 @@ under the License. <response name="success" type="view" value="EditPartyRates"/> <response name="error" type="view" value="EditPartyRates"/> </request-map> - <request-map uri="deletePartyRate"> + <request-map uri="expirePartyRate"> <security https="true" auth="true"/> - <event type="service" invoke="deletePartyRate"/> + <event type="service" invoke="expirePartyRate"/> <response name="success" type="view" value="EditPartyRates"/> <response name="error" type="view" value="EditPartyRates"/> </request-map> Modified: ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/PartyForms.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/PartyForms.xml?rev=1799252&r1=1799251&r2=1799252&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/PartyForms.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/party/widget/partymgr/PartyForms.xml Mon Jun 19 18:27:14 2017 @@ -128,7 +128,7 @@ under the License. </sort-order> </form> - <grid name="ListParty" target="deletePartyRate" list-name="listIt" + <grid name="ListParty" target="expirePartyRate" list-name="listIt" odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar"> <actions> <service service-name="performFindParty" auto-field-map="parameters" result-map-list="listIt"/> @@ -564,7 +564,7 @@ under the License. <field name="submitButton" title="${uiLabelMap.CommonCreate}"><submit button-type="button"/></field> </form> - <form name="ListPartyRates" type="list" target="deletePartyRate" + <form name="ListPartyRates" type="list" target="expirePartyRate" odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar"> <actions> <entity-condition entity-name="PartyRate" filter-by-date="true"> |
Free forum by Nabble | Edit this page |