Fixed: remove uneeded makeValidContext call with Groovy DSL improvement on run service at revision
@@ -21,10 +21,8 @@ import org.apache.ofbiz.base.util.UtilDateTime
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)
