From e4e91e3eccb879355ee3048dd9f8ebdfab4b6f11 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Sat, 17 Sep 2016 10:31:05 +0000 Subject: [PATCH] Fixes: RateAmount is not found when the level is 'WorkEffort' (OFBIZ-8052) When you create a RateAmount, you can determine for which WorkEffort it should apply. But when this RateAmount is retrieved for a specific WorkEffort, it fails to find the good RateAmount. The problem comes from the check done to retrieve the RateAmount at a WorkEffort level. This is the used check : In this 'entity-and', the partyId is set as a constraint. But it is possible to enable a special RateAmount only for a WorkEffort without regarding the partyId. This makes the retrieving more accurate by checking first the WorkEffort, then from the retrieved list, check if the partyId matches and finally from this second retrieval, check if the emplPositionTypeId match. The getRateAmount service searches for the applicable rate from most specific to most general in the RateAmount entity Defaults for periodTypeId is per hour and default currency is the currency in general.properties The order is: 1. for specific rateTypeId, workEffortId (workEffort) 2. for specific rateTypeId, partyId (party) 3. for specific rateTypeId, emplPositionTypeId (emplPositionType) 4. for specific rateTypeId (rateType) Then, the results are filtered to improve the result. If you pass a workEffortId and a partyId, the service will first search the list of all the rateAmount with the specified workEffortId. Then, if there is at least one rateAmount with same partyId than the one in the parameter in the list, the list will be reduced to those entries. At the end, the first record of the list is chosen. For a easier debugging time, there is a log triggered when no records are found for the input. This log shows up when there are rateAmounts corresponding to the input parameters without the rateCurrencyUomId and the periodTypeId. jleroux: in only fixed few typos in the comment above which comes from the The getRateAmount service description Thanks: Florian Montalbano git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1761179 13f79535-47bb-0310-9956-ffa450edef68 --- .../accounting/minilang/rate/RateServices.xml | 304 +++++++++++------- .../accounting/servicedef/services_rate.xml | 39 +++ 2 files changed, 225 insertions(+), 118 deletions(-) diff --git a/applications/accounting/minilang/rate/RateServices.xml b/applications/accounting/minilang/rate/RateServices.xml index e075240ffe..403933a1d2 100644 --- a/applications/accounting/minilang/rate/RateServices.xml +++ b/applications/accounting/minilang/rate/RateServices.xml @@ -127,7 +127,15 @@ under the License. 3. for specific rateTypeId, emplPositionTypeId (emplPositionType) 4. for specific rateTypeId (rateType) - Then will be checked if the requested periodTypeId and currency can be found, if not issue an error message + Then, the results are filtered to improve the result. If you pass a workEffortId and a partyId, + the service will first search the list of all the rateAmount with the specified workEffortId. Then, if + there is at least one rateAmount with same partyId than the one in the parameter in the list, the list will + be reduced to those entries. + At the end, the first record of the list is chosen. + + For a easier debugging time, there is a log triggered when no records are found for the input. This log + shows up when there are rateAmounts corresponding to the input parameters without the rateCurrencyUomId and + the periodTypeId. --> @@ -144,150 +152,67 @@ under the License. - - - - - - - - - - + + + + + + + - - - + - - - - - - - - - - - + + + + + + + - - - + + - - - - - - - - - - - + + + + + + + + - - + + - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + @@ -297,7 +222,150 @@ under the License. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/applications/accounting/servicedef/services_rate.xml b/applications/accounting/servicedef/services_rate.xml index 5eae859930..7b74a420d8 100644 --- a/applications/accounting/servicedef/services_rate.xml +++ b/applications/accounting/servicedef/services_rate.xml @@ -49,6 +49,45 @@ under the License. + + Get all Rates Amounts for a given workEffortId + + + + + + + + + Get all Rates Amounts for a given partyId + + + + + + + + + Get all Rates Amounts for a given emplPositionTypeId + + + + + + + + + Get the most specific non-empty Rate Amount list from a list of Rate Amount, given the input parameters : + workEffortId, partyId, emplPositionTypeId and rateTypeId + + + + +