You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by su...@apache.org on 2020/05/16 09:22:22 UTC

[ofbiz-framework] branch trunk updated: Improved: Called service directly instead of simple methoda call as service has been changed to entity-auto. (#142)

This is an automated email from the ASF dual-hosted git repository.

surajk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 9913e56  Improved: Called service directly instead of simple methoda call as service has been changed to entity-auto. (#142)
9913e56 is described below

commit 9913e566cc5c6c6258e5870137094f138a244489
Author: Suraj Khurana <64...@users.noreply.github.com>
AuthorDate: Sat May 16 14:52:12 2020 +0530

    Improved: Called service directly instead of simple methoda call as service has been changed to entity-auto. (#142)
    
    (OFBIZ-11616)
    Also, updated time sheet related test data as timesheet status should be appropriate before updating or deleting.
---
 applications/workeffort/minilang/test/WorkEffortTests.xml        | 4 ++--
 applications/workeffort/minilang/timesheet/TimesheetServices.xml | 4 +++-
 applications/workeffort/testdef/data/WorkEffortTestData.xml      | 1 +
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/applications/workeffort/minilang/test/WorkEffortTests.xml b/applications/workeffort/minilang/test/WorkEffortTests.xml
index f30adf9..fe05f6c 100644
--- a/applications/workeffort/minilang/test/WorkEffortTests.xml
+++ b/applications/workeffort/minilang/test/WorkEffortTests.xml
@@ -494,7 +494,7 @@ under the License.
     </simple-method>
     <simple-method method-name="testUpdateTimeEntry" short-description="Test the service updateTimeEntry" login-required="false">
         <set field="serviceCtx.timeEntryId" value="TestTimeEntry-1"/>
-        <set field="serviceCtx.timesheetId" value="TestTimesheet-1"/>
+        <set field="serviceCtx.timesheetId" value="TestTimesheet-4"/>
         <entity-one entity-name="UserLogin" value-field="userLogin">
             <field-map field-name="userLoginId" value="system"/>
         </entity-one>
@@ -505,7 +505,7 @@ under the License.
         </entity-one>
         <assert>
             <not><if-empty field="timeEntry"/></not>
-            <if-compare operator="equals" field="timeEntry.timesheetId" value="TestTimesheet-1"/>
+            <if-compare operator="equals" field="timeEntry.timesheetId" value="TestTimesheet-4"/>
         </assert>
         <check-errors/>
     </simple-method>
diff --git a/applications/workeffort/minilang/timesheet/TimesheetServices.xml b/applications/workeffort/minilang/timesheet/TimesheetServices.xml
index 0dafbf2..b1725c9 100644
--- a/applications/workeffort/minilang/timesheet/TimesheetServices.xml
+++ b/applications/workeffort/minilang/timesheet/TimesheetServices.xml
@@ -42,7 +42,9 @@ under the License.
             <field-map field-name="thruDate" from-field="parameters.thruDate"/>
         </entity-and>
         <if-empty field="timesheets">
-                <call-simple-method method-name="createTimesheet"/>
+            <call-service service-name="createTimesheet" in-map-name="parameters">
+                <result-to-result result-name="timesheetId"/>
+            </call-service>
             <else>
                 <add-error>
                     <fail-property resource="WorkEffortUiLabels" property="WorkEffortTimesheetAlreadyExists"/>
diff --git a/applications/workeffort/testdef/data/WorkEffortTestData.xml b/applications/workeffort/testdef/data/WorkEffortTestData.xml
index 6aa37e0..2a90b07 100644
--- a/applications/workeffort/testdef/data/WorkEffortTestData.xml
+++ b/applications/workeffort/testdef/data/WorkEffortTestData.xml
@@ -71,6 +71,7 @@ under the License.
     <Timesheet timesheetId="TestTimesheet-1" partyId="TestParty" statusId="TIMESHEET_COMPLETED" comments="Test timesheet 1"/>
     <Timesheet timesheetId="TestTimesheet-2" partyId="TestParty-1" statusId="TIMESHEET_IN_PROCESS" comments="Test timesheet 2"/>
     <Timesheet timesheetId="TestTimesheet-3" partyId="TestParty-1" statusId="TIMESHEET_IN_PROCESS" comments="Test timesheet 3"/>
+    <Timesheet timesheetId="TestTimesheet-4" partyId="TestParty-1" statusId="TIMESHEET_IN_PROCESS" comments="Test timesheet 4"/>
 
     <TimeEntry timeEntryId="TestTimeEntry-1" hours="8.0" workEffortId="TestWorkeffort-3"/>
     <TimeEntry timeEntryId="TestTimeEntry-2" hours="8.0" workEffortId="TestWorkeffort-4"/>