Adrian, this interesting, thanks. I think that what I did will help to go in the direction you are describing; I still have to do some work on this and I will do my best to implement what you have suggested... or at least to help make easier this refactoring.
Jacopo On Mar 22, 2010, at 5:00 PM, Adrian Crum wrote: > Jacopo, > > Thank you for working on this. It is a step in the right direction. > > Some time ago, I separated out the EntityCondition preparation from the > getWorkEffortEventsByPeriod service (rev 574662) so that other applications > can use the work effort services and screens. The idea was to prepare the > entity conditions *outside* of the getWorkEffortEventsByPeriod service so > that each application could provide its own set of conditions - producing > application-specific calendars. The getWorkEffortEventsByPeriod service would > not contain any entity condition preparation code - it only uses the entity > conditions passed to it. > > Over the years this pattern has been lost. I'm wondering if the changes you > made here could have been accommodated by the original pattern. For example, > a personal calendar application prepares entity conditions for a personal > calendar and then invokes getWorkEffortEventsByPeriod with those conditions, > a manufacturing application prepares entity conditions for a production run > and then invokes getWorkEffortEventsByPeriod with those conditions, etc. > > -Adrian > > > [email protected] wrote: >> Author: jacopoc >> Date: Sun Mar 21 08:34:32 2010 >> New Revision: 925741 >> URL: http://svn.apache.org/viewvc?rev=925741&view=rev >> Log: >> Refactored event search mechanism for the workeffort calendar: there is now >> a calendar type (personal/manufacturing/..) that can be explicitly used to >> perform searches (constrained by the traditional fields like facilityId, >> partyIds, fixedAssetId, workEffortTypeId); previoulsy the concept of >> "calendar type" was somewhat impled in the search constraints (for example, >> if facilityId was set then production runs were included in the search >> results). >> Modified: >> ofbiz/trunk/applications/workeffort/data/WorkEffortTypeData.xml >> ofbiz/trunk/applications/workeffort/servicedef/services.xml >> >> ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java >> >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy >> >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Days.groovy >> >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy >> >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Upcoming.groovy >> >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Week.groovy >> ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml >> Modified: ofbiz/trunk/applications/workeffort/data/WorkEffortTypeData.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/data/WorkEffortTypeData.xml?rev=925741&r1=925740&r2=925741&view=diff >> ============================================================================== >> --- ofbiz/trunk/applications/workeffort/data/WorkEffortTypeData.xml >> (original) >> +++ ofbiz/trunk/applications/workeffort/data/WorkEffortTypeData.xml Sun Mar >> 21 08:34:32 2010 >> @@ -37,6 +37,10 @@ under the License. >> <Enumeration description="Restricted, private access" enumCode="PRIVATE" >> enumId="WES_PRIVATE" sequenceId="02" enumTypeId="WORK_EFF_SCOPE"/> >> <Enumeration description="Very restricted, confidential access" >> enumCode="CONFIDENTIAL" enumId="WES_CONFIDENTIAL" sequenceId="03" >> enumTypeId="WORK_EFF_SCOPE"/> >> + <EnumerationType description="Calendar Type" enumTypeId="CALENDAR_TYPE" >> hasTable="N" parentTypeId=""/> >> + <Enumeration description="Personal Calendar" enumCode="PERSONAL" >> enumId="CAL_PERSONAL" sequenceId="01" enumTypeId="CALENDAR_TYPE"/> >> + <Enumeration description="Manufacturing Calendar" >> enumCode="MANUFACTURING" enumId="CAL_MANUFACTURING" sequenceId="02" >> enumTypeId="CALENDAR_TYPE"/> >> + >> <!-- workeffort status --> >> <StatusType description="WorkEffort Asset" hasTable="N" parentTypeId="" >> statusTypeId="WORK_EFF_ASSET_STTS"/> >> <StatusType description="WorkEffort Assignment" hasTable="N" >> parentTypeId="" statusTypeId="WORK_EFFORT_ASSIGN"/> >> Modified: ofbiz/trunk/applications/workeffort/servicedef/services.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/servicedef/services.xml?rev=925741&r1=925740&r2=925741&view=diff >> ============================================================================== >> --- ofbiz/trunk/applications/workeffort/servicedef/services.xml (original) >> +++ ofbiz/trunk/applications/workeffort/servicedef/services.xml Sun Mar 21 >> 08:34:32 2010 >> @@ -226,6 +226,7 @@ under the License. >> If filterOutCanceledEvents is set to Boolean(true) then >> workEfforts with currentStatusId=EVENT_CANCELLED will not be returned. >> To limit the events to a particular partyId, specify the partyId. >> To limit the events to a set of partyIds, specify a Collection of partyIds. >> </description> >> + <attribute name="calendarType" type="String" mode="IN" >> optional="true"/> >> <attribute name="partyId" type="String" mode="IN" optional="true"/> >> <attribute name="partyIds" type="java.util.Collection" mode="IN" >> optional="true"/> >> <attribute name="facilityId" type="String" mode="IN" >> optional="true"/> >> 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=925741&r1=925740&r2=925741&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 Mar 21 08:34:32 2010 >> @@ -349,42 +349,36 @@ public class WorkEffortServices { >> return resultMap; >> } >> - private static List<EntityCondition> >> getDefaultWorkEffortExprList(Collection<String> partyIds, String facilityId, >> String fixedAssetId, String workEffortTypeId, List<EntityCondition> >> cancelledCheckAndList) { >> - List<EntityCondition> entityExprList = >> UtilMisc.<EntityCondition>toList(EntityCondition.makeCondition("currentStatusId", >> EntityOperator.NOT_EQUAL, "CAL_CANCELLED"), >> EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, >> "PRUN_CANCELLED")); >> + private static List<EntityCondition> >> getDefaultWorkEffortExprList(String calendarType, Collection<String> >> partyIds, String workEffortTypeId, List<EntityCondition> >> cancelledCheckAndList) { >> + List<EntityCondition> entityExprList = FastList.newInstance(); >> + if (cancelledCheckAndList != null) { >> + entityExprList.addAll(cancelledCheckAndList); >> + } >> List<EntityExpr> typesList = FastList.newInstance(); >> if (UtilValidate.isNotEmpty(workEffortTypeId)) { >> typesList.add(EntityCondition.makeCondition("workEffortTypeId", >> EntityOperator.EQUALS, workEffortTypeId)); >> } >> - if (UtilValidate.isNotEmpty(partyIds)) { >> - // (non cancelled) public events, with a startdate >> + if ("CAL_PERSONAL".equals(calendarType)) { >> + // public events are always included to the "personal calendar" >> List<EntityCondition> publicEvents = >> UtilMisc.<EntityCondition>toList( >> EntityCondition.makeCondition("scopeEnumId", >> EntityOperator.EQUALS, "WES_PUBLIC"), >> EntityCondition.makeCondition("parentTypeId", >> EntityOperator.EQUALS, "EVENT") >> ); >> - >> - if (cancelledCheckAndList != null) { >> - publicEvents.addAll(cancelledCheckAndList); >> + if (UtilValidate.isNotEmpty(partyIds)) { >> + entityExprList.add( >> + EntityCondition.makeCondition(UtilMisc.toList( >> + EntityCondition.makeCondition("partyId", >> EntityOperator.IN, partyIds), >> + EntityCondition.makeCondition(publicEvents, >> EntityJoinOperator.AND) >> + ), EntityJoinOperator.OR)); >> } >> + } >> + if ("CAL_MANUFACTURING".equals(calendarType)) { >> entityExprList.add( >> EntityCondition.makeCondition(UtilMisc.toList( >> - EntityCondition.makeCondition("partyId", >> EntityOperator.IN, partyIds), >> - EntityCondition.makeCondition(publicEvents, >> EntityJoinOperator.AND) >> + >> EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, >> "PROD_ORDER_HEADER"), >> + >> EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, >> "PROD_ORDER_TASK") >> ), EntityJoinOperator.OR)); >> } >> - if (UtilValidate.isNotEmpty(facilityId)) { >> - entityExprList.add(EntityCondition.makeCondition("facilityId", >> EntityOperator.EQUALS, facilityId)); >> - typesList.add(EntityCondition.makeCondition("workEffortTypeId", >> EntityOperator.EQUALS, "PROD_ORDER_HEADER")); >> - >> entityExprList.add(EntityCondition.makeCondition("currentStatusId", >> EntityOperator.NOT_EQUAL, "PRUN_CREATED")); >> - >> entityExprList.add(EntityCondition.makeCondition("currentStatusId", >> EntityOperator.NOT_EQUAL, "PRUN_COMPLETED")); >> - >> entityExprList.add(EntityCondition.makeCondition("currentStatusId", >> EntityOperator.NOT_EQUAL, "PRUN_CLOSED")); >> - } >> - if (UtilValidate.isNotEmpty(fixedAssetId)) { >> - >> entityExprList.add(EntityCondition.makeCondition("fixedAssetId", >> EntityOperator.EQUALS, fixedAssetId)); >> -// >> typesList.add(EntityCondition.makeCondition("workEffortTypeId", >> EntityOperator.EQUALS, "PROD_ORDER_TASK")); >> -// >> entityExprList.add(EntityCondition.makeCondition("currentStatusId", >> EntityOperator.NOT_EQUAL, "PRUN_CREATED")); >> -// >> entityExprList.add(EntityCondition.makeCondition("currentStatusId", >> EntityOperator.NOT_EQUAL, "PRUN_COMPLETED")); >> - >> entityExprList.add(EntityCondition.makeCondition("currentStatusId", >> EntityOperator.NOT_EQUAL, "PRUN_CLOSED")); >> - } >> EntityCondition typesCondition = null; >> if (typesList.size() == 0) { >> return entityExprList; >> @@ -463,6 +457,10 @@ public class WorkEffortServices { >> Timestamp startDay = (Timestamp) context.get("start"); >> Integer numPeriodsInteger = (Integer) context.get("numPeriods"); >> + String calendarType = (String) context.get("calendarType"); >> + if (UtilValidate.isEmpty(calendarType)) { >> + calendarType = "CAL_PERSONAL"; >> + } >> String partyId = (String) context.get("partyId"); >> Collection<String> partyIds = >> UtilGenerics.checkCollection(context.get("partyIds")); >> String facilityId = (String) context.get("facilityId"); >> @@ -507,8 +505,7 @@ public class WorkEffortServices { >> return ServiceUtil.returnError("You do not have permission >> to view information for party with ID [" + partyId + "], you must be logged >> in as a user associated with this party, or have the WORKEFFORTMGR_VIEW or >> WORKEFFORTMGR_ADMIN permissions."); >> } >> } else { >> - // if a facilityId or a fixedAssetId are not specified, don't >> set a default partyId... >> - if (UtilValidate.isEmpty(facilityId) && >> UtilValidate.isEmpty(fixedAssetId) && >> UtilValidate.isNotEmpty(userLogin.getString("partyId"))) { >> + if ("CAL_PERSONAL".equals(calendarType) && >> UtilValidate.isNotEmpty(userLogin.getString("partyId"))) { >> partyIdsToUse.add(userLogin.getString("partyId")); >> } >> } >> @@ -516,12 +513,20 @@ public class WorkEffortServices { >> // 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")); >> + EntityCondition.makeCondition("currentStatusId", >> EntityOperator.NOT_EQUAL, "CAL_CANCELLED"), >> + EntityCondition.makeCondition("currentStatusId", >> EntityOperator.NOT_EQUAL, "PRUN_CANCELLED")); >> List<EntityCondition> entityExprList = >> UtilGenerics.checkList(context.get("entityExprList")); >> if (entityExprList == null) { >> - entityExprList = getDefaultWorkEffortExprList(partyIdsToUse, >> facilityId, fixedAssetId, workEffortTypeId, cancelledCheckAndList); >> + entityExprList = getDefaultWorkEffortExprList(calendarType, >> partyIdsToUse, workEffortTypeId, cancelledCheckAndList); >> + } >> + >> + if (UtilValidate.isNotEmpty(facilityId)) { >> + entityExprList.add(EntityCondition.makeCondition("facilityId", >> EntityOperator.EQUALS, facilityId)); >> + } >> + if (UtilValidate.isNotEmpty(fixedAssetId)) { >> + >> entityExprList.add(EntityCondition.makeCondition("fixedAssetId", >> EntityOperator.EQUALS, fixedAssetId)); >> } >> // should have at least a start date >> @@ -578,35 +583,21 @@ public class WorkEffortServices { >> ), 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)) { >> - // Debug.log("=====conditions for party: " + eclTotal); >> - tempWorkEfforts = >> EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssignAndType", >> eclTotal, null, orderByList, null, false)); >> - } else if (UtilValidate.isNotEmpty(fixedAssetId)) { >> - 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); >> - tempWorkEfforts = delegator.findList("WorkEffort", ecl, >> null, orderByList, null, false); >> - >> tempWorkEfforts.addAll(EntityUtil.filterByDate(delegator.findList("WorkEffortAndFixedAssetAssign", >> ecl, null, orderByList, null, false))); >> - } else { >> - 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); >> - } catch (GenericEntityException e) { >> - Debug.logWarning(e, module); >> + try { >> + List<GenericValue> tempWorkEfforts = null; >> + if (UtilValidate.isNotEmpty(partyIdsToUse)) { >> + // Debug.log("=====conditions for party: " + eclTotal); >> + tempWorkEfforts = >> EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssignAndType", >> eclTotal, null, orderByList, null, false)); >> + } else { >> + tempWorkEfforts = delegator.findList("WorkEffort", >> eclTotal, null, orderByList, null, false); >> + } >> + if (!"CAL_PERSONAL".equals(calendarType) && >> UtilValidate.isNotEmpty(fixedAssetId)) { >> + // Get "new style" work efforts >> + >> tempWorkEfforts.addAll(EntityUtil.filterByDate(delegator.findList("WorkEffortAndFixedAssetAssign", >> eclTotal, null, orderByList, null, false))); >> } >> + validWorkEfforts = >> WorkEffortWorker.removeDuplicateWorkEfforts(tempWorkEfforts); >> + } catch (GenericEntityException e) { >> + Debug.logWarning(e, module); >> } >> // Split the WorkEffort list into a map with entries for each >> period, period start is the key >> Modified: >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy?rev=925741&r1=925740&r2=925741&view=diff >> ============================================================================== >> --- >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy >> (original) >> +++ >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy >> Sun Mar 21 08:34:32 2010 >> @@ -21,7 +21,8 @@ facilityId = parameters.facilityId; >> fixedAssetId = parameters.fixedAssetId; >> partyId = parameters.partyId; >> workEffortTypeId = parameters.workEffortTypeId; >> - +calendarType = parameters.calendarType; >> + >> urlParam = ""; >> if (facilityId) { >> urlParam = "facilityId=" + facilityId; >> @@ -46,6 +47,13 @@ if (workEffortTypeId) { >> urlParam = urlParam + "workEffortTypeId=" + workEffortTypeId; >> } >> +if (calendarType) { >> + if (urlParam) { >> + urlParam = urlParam + "&"; >> + } >> + urlParam = urlParam + "calendarType=" + calendarType; >> +} >> + >> if (urlParam) { >> urlParam = "&" + urlParam; >> } >> Modified: >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Days.groovy >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Days.groovy?rev=925741&r1=925740&r2=925741&view=diff >> ============================================================================== >> --- >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Days.groovy >> (original) >> +++ >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Days.groovy >> Sun Mar 21 08:34:32 2010 >> @@ -31,6 +31,7 @@ facilityId = parameters.facilityId; >> fixedAssetId = parameters.fixedAssetId; >> partyId = parameters.partyId; >> workEffortTypeId = parameters.workEffortTypeId; >> +calendarType = parameters.calendarType; >> entityExprList = context.entityExprList; >> Timestamp start = null; >> @@ -49,7 +50,7 @@ Timestamp next = UtilDateTime.getDayStar >> context.nextMillis = new Long(next.getTime()).toString(); >> Map serviceCtx = UtilMisc.toMap("userLogin", >> userLogin,"start",start,"numPeriods",new Integer(24),"periodType",new >> Integer(Calendar.HOUR)); >> -serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", >> facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", >> workEffortTypeId, "locale", locale, "timeZone", timeZone)); >> +serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", >> facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", >> workEffortTypeId, "calendarType", calendarType, "locale", locale, >> "timeZone", timeZone)); >> if (entityExprList) { >> serviceCtx.putAll(["entityExprList" : entityExprList]); >> } >> Modified: >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy?rev=925741&r1=925740&r2=925741&view=diff >> ============================================================================== >> --- >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy >> (original) >> +++ >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy >> Sun Mar 21 08:34:32 2010 >> @@ -32,6 +32,7 @@ facilityId = parameters.facilityId; >> fixedAssetId = parameters.fixedAssetId; >> partyId = parameters.partyId; >> workEffortTypeId = parameters.workEffortTypeId; >> +calendarType = parameters.calendarType; >> entityExprList = context.entityExprList; >> start = null; >> @@ -75,7 +76,7 @@ if (followingMonthDays < 0) { >> numDays += followingMonthDays; serviceCtx = UtilMisc.toMap("userLogin", >> userLogin, "start", getFrom, "numPeriods", new Integer(numDays), >> "periodType", new Integer(Calendar.DATE)); >> -serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", >> facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", >> workEffortTypeId, "locale", locale, "timeZone", timeZone)); >> +serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", >> facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", >> workEffortTypeId, "calendarType", calendarType, "locale", locale, >> "timeZone", timeZone)); >> if (entityExprList) { >> serviceCtx.putAll(["entityExprList" : entityExprList]); >> } >> Modified: >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Upcoming.groovy >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Upcoming.groovy?rev=925741&r1=925740&r2=925741&view=diff >> ============================================================================== >> --- >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Upcoming.groovy >> (original) >> +++ >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Upcoming.groovy >> Sun Mar 21 08:34:32 2010 >> @@ -28,6 +28,7 @@ facilityId = parameters.get("facilityId" >> fixedAssetId = parameters.get("fixedAssetId"); >> partyId = parameters.get("partyId"); >> workEffortTypeId = parameters.get("workEffortTypeId"); >> +calendarType = parameters.calendarType; >> start = nowTimestamp.clone(); >> eventsParam = ""; >> if (facilityId != null) { >> @@ -44,7 +45,7 @@ if (workEffortTypeId != null) { >> } >> Map serviceCtx = UtilMisc.toMap("userLogin", userLogin, "start", start, >> "numPeriods", new Integer(7), "periodType", new Integer(Calendar.DATE)); >> -serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", >> facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", >> workEffortTypeId, "locale", locale, "timeZone", timeZone)); >> +serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", >> facilityId, "fixedAssetId", fixedAssetId, "workEffortTypeId", >> workEffortTypeId, "calendarType", calendarType, "locale", locale, >> "timeZone", timeZone)); >> Map result = dispatcher.runSync("getWorkEffortEventsByPeriod",serviceCtx); >> context.put("days", result.get("periods")); >> Modified: >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Week.groovy >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Week.groovy?rev=925741&r1=925740&r2=925741&view=diff >> ============================================================================== >> --- >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Week.groovy >> (original) >> +++ >> ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Week.groovy >> Sun Mar 21 08:34:32 2010 >> @@ -32,6 +32,7 @@ facilityId = parameters.facilityId; >> fixedAssetId = parameters.fixedAssetId; >> partyId = parameters.partyId; >> workEffortTypeId = parameters.workEffortTypeId; >> +calendarType = parameters.calendarType; >> entityExprList = (List) context.get("entityExprList"); >> filterOutCanceledEvents = parameters.filterOutCanceledEvents; >> if (!filterOutCanceledEvents) { >> @@ -58,7 +59,7 @@ Timestamp end = UtilDateTime.getDayStart >> Map serviceCtx = UtilMisc.toMap("userLogin", >> userLogin,"start",start,"numPeriods",new Integer(7), >> "periodType",new Integer(Calendar.DATE)); >> serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", >> facilityId, - "fixedAssetId", fixedAssetId, "workEffortTypeId", >> workEffortTypeId, + "fixedAssetId", fixedAssetId, "workEffortTypeId", >> workEffortTypeId, "calendarType", calendarType, >> "locale", locale, "timeZone", timeZone)); >> if (entityExprList) { >> serviceCtx.putAll(["entityExprList" : entityExprList]); >> Modified: ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml?rev=925741&r1=925740&r2=925741&view=diff >> ============================================================================== >> --- ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml (original) >> +++ ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml Sun Mar 21 >> 08:34:32 2010 >> @@ -21,6 +21,14 @@ under the License. >> <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd"> >> <form name="FilterCalendarEvents" type="single" target="calendar"> >> + <field name="calendarType"> >> + <drop-down allow-empty="false"> >> + <entity-options entity-name="Enumeration" >> key-field-name="enumId" description="${description}"> >> + <entity-constraint name="enumTypeId" >> value="CALENDAR_TYPE"/> >> + <entity-order-by field-name="sequenceId"/> >> + </entity-options> >> + </drop-down> >> + </field> >> <field name="partyId"> >> <lookup target-form-name="LookupPartyName" size="16"/> >> </field>
