Author: hansbak
Date: Sun Jun 21 14:37:57 2009 New Revision: 787017 URL: http://svn.apache.org/viewvc?rev=787017&view=rev Log: on the calendar also show the public events Modified: ofbiz/trunk/applications/workeffort/data/WorkEffortDemoData.xml ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Modified: ofbiz/trunk/applications/workeffort/data/WorkEffortDemoData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/data/WorkEffortDemoData.xml?rev=787017&r1=787016&r2=787017&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/data/WorkEffortDemoData.xml (original) +++ ofbiz/trunk/applications/workeffort/data/WorkEffortDemoData.xml Sun Jun 21 14:37:57 2009 @@ -36,10 +36,14 @@ <!-- 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"/> <WorkEffortAssoc workEffortIdFrom="CALENDAR_PUB_DEMO" workEffortIdTo="STAFF_MTG" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" fromDate="2008-01-01 00:00:00.0"/> - <WorkEffort workEffortId="OneOffMeeting" workEffortTypeId="MEETING" currentStatusId="CAL_TENTATIVE" lastStatusUpdate="2008-01-01 00:00:00.0" scopeEnumId="WES_PRIVATE" workEffortName="One off Meeting june 14" description="Staff Meeting" estimatedStartDate="2009-06-14 09:00:00.0" estimatedCompletionDate="2009-06-14 10:00:00.0"/> + <!-- one off event --> + <WorkEffort workEffortId="OneOffMeeting" workEffortTypeId="MEETING" currentStatusId="CAL_TENTATIVE" lastStatusUpdate="2008-01-01 00:00:00.0" scopeEnumId="WES_PRIVATE" workEffortName="One off Meeting june 12" description="Staff Meeting" estimatedStartDate="2009-06-12 09:00:00.0" estimatedCompletionDate="2009-06-12 10:00:00.0"/> <WorkEffortAssoc workEffortIdFrom="CALENDAR_PUB_DEMO" workEffortIdTo="OneOffMeeting" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" fromDate="2008-01-01 00:00:00.0"/> <WorkEffortPartyAssignment workEffortId="OneOffMeeting" partyId="DemoEmployee1" statusId="PRTYASGN_ASSIGNED" roleTypeId="CAL_OWNER" availabilityStatusId="WEPA_AV_BUSY" fromDate="2008-01-01 00:00:00.0"/> <WorkEffortPartyAssignment workEffortId="OneOffMeeting" partyId="DemoEmployee2" statusId="PRTYASGN_ASSIGNED" roleTypeId="CAL_ATTENDEE" availabilityStatusId="WEPA_AV_BUSY" fromDate="2008-01-01 00:00:00.0"/> <WorkEffortPartyAssignment workEffortId="OneOffMeeting" partyId="admin" statusId="PRTYASGN_ASSIGNED" roleTypeId="CAL_ATTENDEE" availabilityStatusId="WEPA_AV_BUSY" fromDate="2008-01-01 00:00:00.0"/> + <!-- public event --> + <WorkEffort workEffortId="PublicEvent" workEffortTypeId="MEETING" currentStatusId="CAL_TENTATIVE" lastStatusUpdate="2008-01-01 00:00:00.0" scopeEnumId="WES_PUBLIC" workEffortName="The general company party june 17" description="General Party" estimatedStartDate="2009-06-17 19:00:00.0" estimatedCompletionDate="2009-06-17 23:00:00.0"/> + <WorkEffortAssoc workEffortIdFrom="CALENDAR_PUB_DEMO" workEffortIdTo="PublicEvent" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" fromDate="2008-01-01 00:00:00.0"/> </entity-engine-xml> 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=787017&r1=787016&r2=787017&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 Sun Jun 21 14:37:57 2009 @@ -484,7 +484,7 @@ entityExprList = getDefaultWorkEffortExprList(partyIdsToUse, facilityId, fixedAssetId, workEffortTypeId); } - entityExprList.add( + EntityCondition periodCheck = EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( // the taskstart should be less than the periodend and the taskEnd should be larger than the period start EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( @@ -509,17 +509,23 @@ EntityCondition.makeCondition("actualCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, startStamp) ), EntityJoinOperator.AND) ), EntityJoinOperator.OR) - ), EntityJoinOperator.AND)); + ), EntityJoinOperator.AND); if (filterOutCanceledEvents.booleanValue()) { entityExprList.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "EVENT_CANCELLED")); } - // always take all repeating workefforts and 'AND' all previous conditions + // always take all recurring workefforts and 'AND' all previous conditions EntityConditionList<EntityCondition> ecl = EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( - EntityCondition.makeCondition(entityExprList, EntityJoinOperator.AND), - EntityCondition.makeCondition("tempExprId", EntityOperator.NOT_EQUAL, null) + EntityCondition.makeCondition("tempExprId", EntityOperator.NOT_EQUAL, null), + periodCheck ), EntityJoinOperator.OR); + // get all public workefforts in the required period + EntityConditionList<EntityCondition> eclPublic = + EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( + EntityCondition.makeCondition("scopeEnumId", EntityOperator.EQUALS, "WES_PUBLIC"), + periodCheck + ), EntityJoinOperator.AND); List<String> orderByList = UtilMisc.toList("estimatedStartDate"); @@ -528,6 +534,7 @@ List<GenericValue> tempWorkEfforts = null; if (UtilValidate.isNotEmpty(partyIdsToUse)) { tempWorkEfforts = EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssign", ecl, null, orderByList, null, false)); + tempWorkEfforts.addAll(delegator.findList("WorkEffort", eclPublic, null, orderByList, null, false)); } else if (UtilValidate.isNotEmpty(fixedAssetId)) { // Get "old style" work efforts and "new style" work efforts tempWorkEfforts = delegator.findList("WorkEffort", ecl, null, orderByList, null, false); |
Free forum by Nabble | Edit this page |