You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2017/07/24 13:07:52 UTC
svn commit: r1802811 -
/ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/rate/RateServices.groovy
Author: nmalin
Date: Mon Jul 24 13:07:52 2017
New Revision: 1802811
URL: http://svn.apache.org/viewvc?rev=1802811&view=rev
Log:
Fixed: remove uneeded makeValidContext call with Groovy DSL improvement on run service at revision 1802798
Modified:
ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/rate/RateServices.groovy
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=1802811&r1=1802810&r2=1802811&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/rate/RateServices.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/rate/RateServices.groovy Mon Jul 24 13:07:52 2017
@@ -21,10 +21,8 @@ import org.apache.ofbiz.base.util.UtilDa
import org.apache.ofbiz.base.util.UtilProperties
import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.entity.util.EntityUtil
-import org.apache.ofbiz.service.ModelService
import org.apache.ofbiz.service.ServiceUtil
-
import java.sql.Timestamp
@@ -50,8 +48,7 @@ def updateRateAmount() {
if (rateAmountLookedUpValue) {
updating = (rateAmountLookedUpValue.fromDate.compareTo(newEntity.fromDate) == 0)
if (rateAmountLookedUpValue.rateAmount != rateAmount) {
- Map expireRateAmountMap = dispatcher.getDispatchContext().makeValidContext('expireRateAmount', ModelService.IN_PARAM, rateAmountLookedUpValue)
- result = run service: 'expireRateAmount', with: expireRateAmountMap
+ result = run service: 'expireRateAmount', with: rateAmountLookedUpValue
if (ServiceUtil.isError(result)) return result
} else {
return error(UtilProperties.getMessage('AccountingErrorUiLabels', 'AccountingUpdateRateAmountAlreadyExist', locale))
@@ -107,8 +104,7 @@ def updatePartyRate() {
}
}
if (parameters.rateAmount) {
- Map createRateAmountMap = dispatcher.getDispatchContext().makeValidContext('updateRateAmount', ModelService.IN_PARAM, parameters)
- result = run service: 'updateRateAmount', with: createRateAmountMap
+ result = run service: 'updateRateAmount', with: parameters
if (ServiceUtil.isError(result)) return result
}
return success()
@@ -123,8 +119,7 @@ def expirePartyRate() {
lookedUpValue.store()
//expire related rate amount
- Map expireRateAmountMap = dispatcher.getDispatchContext().makeValidContext('expireRateAmount', ModelService.IN_PARAM, parameters)
- result = run service: 'expireRateAmount', with: expireRateAmountMap
+ result = run service: 'expireRateAmount', with: parameters
if (ServiceUtil.isError(result)) return result
}
return success()
@@ -165,8 +160,8 @@ def getRateAmount() {
serviceName = 'getRatesAmountsFromEmplPositionTypeId'
}
if (serviceName) {
- Map serviceContextMap = dispatcher.getDispatchContext().makeValidContext(serviceName, ModelService.IN_PARAM, parameters)
- if (!parameters.rateCurrencyUomId) {
+ Map serviceContextMap = new HashMap<>(parameters)
+ if (!serviceContextMap.rateCurrencyUomId) {
serviceContextMap.rateCurrencyUomId = UtilProperties.getPropertyValue('general.properties', 'currency.uom.id.default', 'USD')
}
Map result = run service: serviceName, with: serviceContextMap
@@ -177,7 +172,7 @@ def getRateAmount() {
if (!ratesList) {
ratesList = from('RateAmount').where([rateTypeId: parameters.rateTypeId]).queryList();
- Map serviceContextMap = dispatcher.getDispatchContext().makeValidContext("filterRateAmountList", ModelService.IN_PARAM, parameters)
+ Map serviceContextMap = new HashMap<>(parameters)
serviceContextMap.ratesList = ratesList
Map result = run service: 'filterRateAmountList', with: serviceContextMap
ratesList = EntityUtil.filterByDate(result.filteredRatesList)