svn commit: r691101 - in /ofbiz/trunk: applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r691101 - in /ofbiz/trunk: applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml

hansbak-2
Author: hansbak
Date: Mon Sep  1 21:01:22 2008
New Revision: 691101

URL: http://svn.apache.org/viewvc?rev=691101&view=rev
Log:
some more corrections on generate an invoice from a project

Modified:
    ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml
    ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml

Modified: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml?rev=691101&r1=691100&r2=691101&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml (original)
+++ ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/TimesheetServices.xml Mon Sep  1 21:01:22 2008
@@ -174,10 +174,12 @@
                             <if-compare field="parameters.combineInvoiceItem" operator="equals" value="Y" >
                                 <set field="invoiceItemMap.description" value="${workEffort.workEffortName} [Task:${workEffort.workEffortId}]"/>
                                 <get-related value-name="workEffort" relation-name="CustRequestWorkEffort" list-name="custRequestWorkEfforts"/>
-                                <first-from-list entry-name="custRequestWorkEffort" list-name="custRequestWorkEfforts"/>
-                                <get-related-one value-name="custRequestWorkEffort" relation-name="CustRequest" to-value-name="custRequest"/>
-                                <if-not-empty field="custRequest">
-                                    <set field="invoiceItemMap.description" value="${custRequest.custRequestName} [CRQ:${custRequest.custRequestId}]"/>
+                                <if-not-empty field="custRequestWorkEfforts">
+                                 <first-from-list entry-name="custRequestWorkEffort" list-name="custRequestWorkEfforts"/>
+                                 <get-related-one value-name="custRequestWorkEffort" relation-name="CustRequest" to-value-name="custRequest"/>
+                                 <if-not-empty field="custRequest">
+                                     <set field="invoiceItemMap.description" value="${custRequest.custRequestName} [CRQ:${custRequest.custRequestId}]"/>
+                                 </if-not-empty>
                                 </if-not-empty>
                                 <set field="invoiceItemMap.quantity" from-field="timeEntry.hours" default-value="0.0" type="Double"/>
                                 <clear-field field-name="invoiceItemMap.invoiceItemSeqId"/><!-- make sure a new one is created -->
@@ -211,11 +213,11 @@
                             <result-to-field result-name="invoiceItemSeqId" field-name="invoiceItemMap.invoiceItemSeqId"/>
                         </call-service>
                     </if-compare>
-                    
-                    <!--  update the timeentry -->
-                    <set field="timeEntry.invoiceId" from-field="invoiceItemMap.invoiceId"/>
-                    <set field="timeEntry.invoiceItemSeqId" from-field="invoiceItemMap.invoiceItemSeqId"/>
-                    <store-value value-name="timeEntry"/>
+                    <!--  update the time entry -->
+                    <set field="updTimeEntry.timeEntryId" from-field="timeEntry.timeEntryId"/>
+                    <set field="updTimeEntry.invoiceId" from-field="invoiceItemMap.invoiceId"/>
+                    <set field="updTimeEntry.invoiceItemSeqId" from-field="invoiceItemMap.invoiceItemSeqId"/>
+                    <call-service service-name="updateTimeEntry" in-map-name="updTimeEntry"/>
                     <else>
                         <log level="info" message="Timeentry: ${timeEntry.timeEntryId} already connected to invoiceId: ${timeEntry.invoiceId}...not added to invoiceItem"/>
                     </else>                    
@@ -266,9 +268,18 @@
     </simple-method>
     <simple-method method-name="updateTimeEntry" short-description="Update TimeEntry">
         <entity-one entity-name="TimeEntry" value-name="lookedUpValue"/>
-        <call-simple-method method-name="checkTimesheetStatus"/>
-        <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
-        <store-value value-name="lookedUpValue"/>
+        <!-- allow update of invoiceId and seqId if not yet filled, else check status -->
+        <if-not-empty field="parameters.invoiceId">
+         <if-empty field="lookedUpValue.invoiceId">
+         <set field="lookedUpValue.invoiceId" from-field="parameters.invoiceId"/>
+         <set field="lookedUpValue.invoiceItemSeqId" from-field="parameters.invoiceItemSeqId"/>
+         <else>
+         <call-simple-method method-name="checkTimesheetStatus"/>
+         <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
+         </else>
+         </if-empty>
+        </if-not-empty>
+ <store-value value-name="lookedUpValue"/>
     </simple-method>
     <simple-method method-name="deleteTimeEntry" short-description="Delete TimeEntry">
         <entity-one entity-name="TimeEntry" value-name="lookedUpValue"/>
@@ -360,6 +371,4 @@
         <check-errors/>
     </simple-method>
     
-    
-    
 </simple-methods>

Modified: ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml?rev=691101&r1=691100&r2=691101&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Mon Sep  1 21:01:22 2008
@@ -995,11 +995,10 @@
         <iterate entry-name="task" list-name="tasks">
             <if-empty field="notFirst">
                 <!-- first time so create invoice -->
-                <set-service-fields service-name="addWorkEffortTimeToNewInvoice" map-name="parameters" to-map-name="addtaskToNewInvoice"/>
+                <set-service-fields service-name="addWorkEffortTimeToNewInvoice" map-name="parameters" to-map-name="addTaskToNewInvoice"/>
                 <set field="addTaskToNewInvoice.workEffortId" from-field="task.workEffortId"/>
-                <set field="addtaskToNewInvoice.combineInvoiceItem" value="Y"/>
-           <set field="addtaskToNewInvoice.invoiceId" from-field="parameters.invoiceId"/>
-            <call-service service-name="addWorkEffortTimeToNewInvoice" in-map-name="addtaskToNewInvoice">
+                <set field="addTaskToNewInvoice.combineInvoiceItem" value="Y"/>
+            <call-service service-name="addWorkEffortTimeToNewInvoice" in-map-name="addTaskToNewInvoice">
                 <result-to-field result-name="invoiceId" field-name="parameters.invoiceId"/>
                 </call-service>
                 <set field="addTaskToInvoice.combineInvoiceItem" value="Y"/>