svn commit: r791097 - in /ofbiz/trunk/applications/workeffort: data/WorkEffortDemoData.xml src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java widget/CalendarForms.xml widget/CalendarScreens.xml

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

svn commit: r791097 - in /ofbiz/trunk/applications/workeffort: data/WorkEffortDemoData.xml src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java widget/CalendarForms.xml widget/CalendarScreens.xml

hansbak-2
Author: hansbak
Date: Sat Jul  4 10:15:21 2009
New Revision: 791097

URL: http://svn.apache.org/viewvc?rev=791097&view=rev
Log:
calendar now also show party assigned event properly like project tasks and now the actual dates override the estimated dates

Modified:
    ofbiz/trunk/applications/workeffort/data/WorkEffortDemoData.xml
    ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
    ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml
    ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml

Modified: ofbiz/trunk/applications/workeffort/data/WorkEffortDemoData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/data/WorkEffortDemoData.xml?rev=791097&r1=791096&r2=791097&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/data/WorkEffortDemoData.xml (original)
+++ ofbiz/trunk/applications/workeffort/data/WorkEffortDemoData.xml Sat Jul  4 10:15:21 2009
@@ -32,6 +32,7 @@
     <WorkEffortPartyAssignment workEffortId="STAFF_MTG" partyId="DemoEmployee1" statusId="PRTYASGN_ASSIGNED" roleTypeId="CAL_OWNER" availabilityStatusId="WEPA_AV_BUSY" fromDate="2008-01-01 00:00:00.0"/>
     <WorkEffortPartyAssignment workEffortId="STAFF_MTG" partyId="DemoEmployee2" statusId="PRTYASGN_ASSIGNED" roleTypeId="CAL_ATTENDEE" availabilityStatusId="WEPA_AV_BUSY" fromDate="2008-01-01 00:00:00.0"/>
     <WorkEffortPartyAssignment workEffortId="STAFF_MTG" partyId="DemoEmployee3" statusId="PRTYASGN_ASSIGNED" roleTypeId="CAL_ATTENDEE" availabilityStatusId="WEPA_AV_BUSY" fromDate="2008-01-01 00:00:00.0"/>
+    <WorkEffortPartyAssignment workEffortId="STAFF_MTG" partyId="admin" statusId="PRTYASGN_ASSIGNED" roleTypeId="CAL_ATTENDEE" availabilityStatusId="WEPA_AV_BUSY" fromDate="2008-01-01 00:00:00.0"/>
     
     <!-- Publish the staff meeting calendar event -->
     <WorkEffort workEffortId="CALENDAR_PUB_DEMO" workEffortTypeId="PUBLISH_PROPS" currentStatusId="CAL_CANCELLED" scopeEnumId="WES_PRIVATE" description="Demo Project 1 Customer 1" workEffortName="iCalendar Publish Demonstration"/>

Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=791097&r1=791096&r2=791097&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java (original)
+++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Sat Jul  4 10:15:21 2009
@@ -503,31 +503,86 @@
         if (entityExprList == null) {
             entityExprList = getDefaultWorkEffortExprList(partyIds, facilityId, fixedAssetId, workEffortTypeId);
         }
-        entityExprList.add(EntityCondition.makeCondition("estimatedStartDate", EntityOperator.LESS_THAN, endStamp));
-        List<EntityCondition> completionExprList = UtilMisc.<EntityCondition>toList(EntityCondition.makeCondition("estimatedCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, startStamp), EntityCondition.makeCondition("estimatedCompletionDate", EntityOperator.EQUALS, null));
-        entityExprList.add(EntityCondition.makeCondition(completionExprList, EntityJoinOperator.OR));
+
+        // cancelled status id's
+    List<EntityCondition> cancelledCheckAndList = UtilMisc.<EntityCondition>toList(
+     EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "EVENT_CANCELLED"),
+     EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"));
+        
+        List<EntityCondition> periodCheckAndlList = UtilMisc.<EntityCondition>toList(
+         // the taskstart should be less than the period end and the taskEnd should be larger than the period start
+         EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList(
+         EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList(
+         EntityCondition.makeCondition("actualStartDate", EntityOperator.EQUALS, null),
+         EntityCondition.makeCondition("estimatedStartDate", EntityOperator.NOT_EQUAL, null),
+         EntityCondition.makeCondition("estimatedStartDate", EntityOperator.LESS_THAN_EQUAL_TO, endStamp)
+         ), EntityJoinOperator.AND),
+         EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList(
+         EntityCondition.makeCondition("actualStartDate", EntityOperator.NOT_EQUAL, null),
+         EntityCondition.makeCondition("actualStartDate", EntityOperator.LESS_THAN_EQUAL_TO, endStamp)
+         ), EntityJoinOperator.AND)
+         ), EntityJoinOperator.OR),
+         EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList(
+         EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList(
+         EntityCondition.makeCondition("actualCompletionDate", EntityOperator.EQUALS, null),
+         EntityCondition.makeCondition("estimatedCompletionDate", EntityOperator.NOT_EQUAL, null),
+         EntityCondition.makeCondition("estimatedCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, startStamp)
+         ), EntityJoinOperator.AND),
+         EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList(
+         EntityCondition.makeCondition("actualCompletionDate", EntityOperator.NOT_EQUAL, null),
+         EntityCondition.makeCondition("actualCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, startStamp)
+         ), EntityJoinOperator.AND)
+         ), EntityJoinOperator.OR));
+
+        entityExprList.addAll(periodCheckAndlList);
+
+        // (non cancelled) recurring events
+        List<EntityCondition> recurringEvents = UtilMisc.<EntityCondition>toList(EntityCondition.makeCondition("tempExprId", EntityOperator.NOT_EQUAL, null));
+        if (filterOutCanceledEvents.booleanValue()) {
+         recurringEvents.addAll(cancelledCheckAndList);
+        }
+
+        // (non cancelled) public events
+        List<EntityCondition> publicEvents = UtilMisc.<EntityCondition>toList(EntityCondition.makeCondition("scopeEnumId", EntityOperator.EQUALS, "WES_PUBLIC"));
         if (filterOutCanceledEvents.booleanValue()) {
-            entityExprList.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "EVENT_CANCELLED"));
+         publicEvents.addAll(cancelledCheckAndList);
         }
+        
+        EntityCondition eclTotal = EntityCondition.makeCondition(UtilMisc.toList(
+         EntityCondition.makeCondition(entityExprList, EntityJoinOperator.AND),
+         EntityCondition.makeCondition(recurringEvents, EntityJoinOperator.AND),
+         EntityCondition.makeCondition(publicEvents, EntityJoinOperator.AND)
+         ), EntityJoinOperator.OR);
+        
         List<String> orderByList = UtilMisc.toList("estimatedStartDate");
         if (partyIdsToUse.size() > 0 || UtilValidate.isNotEmpty(facilityId) || UtilValidate.isNotEmpty(fixedAssetId)) {
             try {
                 List<GenericValue> tempWorkEfforts = null;
                 if (UtilValidate.isNotEmpty(partyIdsToUse)) {
-                    EntityConditionList<EntityCondition> ecl = EntityCondition.makeCondition(entityExprList, EntityJoinOperator.AND);
-                 // Debug.log("=====conditions for party: " + ecl);
+                 EntityConditionList<EntityCondition> ecl =
+                 EntityCondition.makeCondition(UtilMisc.toList(
+                 eclTotal,
+                 EntityCondition.makeCondition("partyId", EntityOperator.IN, partyIdsToUse)
+                 ), EntityJoinOperator.AND);
+                 Debug.log("=====conditions for party: " + ecl);
                     tempWorkEfforts = EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssign", ecl, null, orderByList, null, false));
                 } else if (UtilValidate.isNotEmpty(fixedAssetId)) {
-                 entityExprList.add(EntityCondition.makeCondition("fixedAssetId", EntityOperator.EQUALS, fixedAssetId));
-                    EntityConditionList<EntityCondition> ecl = EntityCondition.makeCondition(entityExprList, EntityJoinOperator.AND);
+                 EntityConditionList<EntityCondition> ecl =
+                 EntityCondition.makeCondition(UtilMisc.toList(
+                 eclTotal,
+                 EntityCondition.makeCondition("fixedAssetId", EntityOperator.EQUALS, fixedAssetId)
+                 ), EntityJoinOperator.AND);
                     // Get "old style" work efforts and "new style" work efforts
-                 //Debug.log("=====conditions for fixed asset: " + ecl);
+                 Debug.log("=====conditions for fixed asset: " + ecl);
                     tempWorkEfforts = delegator.findList("WorkEffort", ecl, null, orderByList, null, false);
                     tempWorkEfforts.addAll(EntityUtil.filterByDate(delegator.findList("WorkEffortAndFixedAssetAssign", ecl, null, orderByList, null, false)));
                 } else {
-                 entityExprList.add(EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId));
-                    EntityConditionList<EntityCondition> ecl = EntityCondition.makeCondition(entityExprList, EntityJoinOperator.AND);
-                 // Debug.log("=====conditions for facility: " + ecl);
+                 EntityConditionList<EntityCondition> ecl =
+                 EntityCondition.makeCondition(UtilMisc.toList(
+                 eclTotal,
+                 EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId)
+                 ), EntityJoinOperator.AND);
+                 Debug.log("=====conditions for facility: " + ecl);
                     tempWorkEfforts = delegator.findList("WorkEffort", ecl, null, UtilMisc.toList("estimatedStartDate"), null, false);
                 }
                 validWorkEfforts = WorkEffortWorker.removeDuplicateWorkEfforts(tempWorkEfforts);
@@ -590,6 +645,8 @@
                 List<Map<String, Object>> curWorkEfforts = FastList.newInstance();
                 Map<String, Object> entry = FastMap.newInstance();
                 for (GenericValue workEffort : validWorkEfforts) {
+                 if (workEffort.getTimestamp("actualStartDate") != null) workEffort.put("estimatedStartDate", workEffort.getTimestamp("actualStartDate"));
+                 if (workEffort.getTimestamp("actualCompletionDate") != null) workEffort.put("estimatedCompletionDate", workEffort.getTimestamp("actualCompletionDate"));
                     DateRange weRange = new DateRange(workEffort.getTimestamp("estimatedStartDate"), workEffort.getTimestamp("estimatedCompletionDate"));
                     if (periodRange.intersectsRange(weRange)) {
                         Map<String, Object> calEntry = FastMap.newInstance();

Modified: ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml?rev=791097&r1=791096&r2=791097&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml (original)
+++ ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml Sat Jul  4 10:15:21 2009
@@ -36,7 +36,6 @@
         <field name="partyId"><hidden value="${parameters.userLogin.partyId}"/></field>
         <field name="roleTypeId" use-when="workEffort==null"><hidden value="CAL_OWNER"/></field>
         <field name="statusId" use-when="workEffort==null"><hidden value="PRTYASGN_ASSIGNED"/></field>
-        <field name="currentStatusId"><hidden value="CAL_TENTATIVE"/></field>
         <field name="workEffortName" title="${uiLabelMap.WorkEffortEventName}"><text/></field>
         <field name="description" title="${uiLabelMap.CommonDescription}"><text/></field>
         <field name="workEffortTypeId">
@@ -47,6 +46,10 @@
                 </entity-options>
             </drop-down>
         </field>
+        <field name="currentStatusId" use-when="workEffort!=null">
+            <display-entity entity-name="StatusItem" description="${description}" key-field-name="statusId"/>
+        </field>
+        <field name="currentStatusId" use-when="workEffort==null"><hidden value="CAL_TENTATIVE"/></field>
         <field name="scopeEnumId">
             <drop-down no-current-selected-key="WES_PRIVATE">
                 <entity-options entity-name="Enumeration" key-field-name="enumId" description="${description}">
@@ -57,6 +60,8 @@
         </field>
         <field name="estimatedStartDate"><date-time input-method="time-dropdown" /></field>
         <field name="estimatedCompletionDate"><date-time input-method="time-dropdown"/></field>
+        <field name="actualStartDate" use-when="parentWorkEffortId!=null"><display type="date-time"/></field>
+        <field name="actualCompletionDate" use-when="parentWorkEffortId!=null"><display type="date-time"/></field>
         <field name="addButton" use-when="workEffort==null"><submit/></field>
         <field name="updateButton" use-when="workEffort!=null"><submit/></field>
     </form>
@@ -71,11 +76,16 @@
         <field name="workEffortTypeId">
             <display-entity entity-name="WorkEffortType" description="${description}"/>
         </field>
+        <field name="currentStatusId" use-when="workEffort!=null">
+            <display-entity entity-name="StatusItem" description="${description}" key-field-name="statusId"/>
+        </field>
         <field name="scopeEnumId">
             <display-entity entity-name="Enumeration" key-field-name="enumId" description="${description}"/>
         </field>
         <field name="estimatedStartDate"><display type="date-time"></display></field>
         <field name="estimatedCompletionDate"><display type="date-time"></display></field>
+        <field name="actualStartDate" use-when="parentWorkEffortId!=null"><display type="date-time"/></field>
+        <field name="actualCompletionDate" use-when="parentWorkEffortId!=null"><display type="date-time"/></field>
     </form>
     <form name="showCalEventRoles" type="list" list-name="roles"
         odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
@@ -90,6 +100,9 @@
             <display-entity entity-name="PartyNameView" key-field-name="partyId" description="${groupName}${lastName} ${firstName} ${middleName}"/>
         </field>
         <field name="roleTypeId"><display-entity entity-name="RoleType" description="${description}"/></field>
+        <field name="statusId" use-when="workEffort!=null">
+            <display-entity entity-name="StatusItem" description="${description}"/>
+        </field>
     </form>
     <form name="showCalEventRolesDel" type="list" extends="showCalEventRoles" target="deleteWorkEffortPartyAssign">
         <field name="remove"><submit/></field>

Modified: ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml?rev=791097&r1=791096&r2=791097&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml (original)
+++ ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml Sat Jul  4 10:15:21 2009
@@ -142,10 +142,13 @@
                     <widgets>
                         <section><!-- check if edit form needs to be shown, otherwise show view only form -->
                             <condition>
-                                <or>
-                                    <if-compare field="isCalOwner" operator="equals" value="true" type="Boolean"/>
-                                    <if-has-permission permission="WORKEFFORTMGR" action="ADMIN"/>
-                                </or>
+                                <and>
+                                    <or>
+                                        <if-compare field="isCalOwner" operator="equals" value="true" type="Boolean"/>
+                                        <if-has-permission permission="WORKEFFORTMGR" action="ADMIN"/>
+                                    </or>
+                                    <if-compare field="workEffort.currentStatusId" operator="not-equals" value="PTS_COMPLETED"/>
+                                </and>
                             </condition>
                             <widgets><!-- edit section -->
                                 <container style="lefthalf">