Author: hansbak
Date: Sat Jul 4 04:21:29 2009 New Revision: 791057 URL: http://svn.apache.org/viewvc?rev=791057&view=rev Log: Calendars now working in accounting, workeffort and myportal with fixed asset, facility and party. reported by adrian and with help from Jacopo. Added: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy (with props) Removed: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/ViewCalendar.groovy Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml ofbiz/trunk/applications/accounting/widget/CommonScreens.xml ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java 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/Week.groovy ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/day.ftl ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/month.ftl ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/week.ftl ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=791057&r1=791056&r2=791057&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Sat Jul 4 04:21:29 2009 @@ -2246,7 +2246,7 @@ <view-map name="ListFixedAssetMaints" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#ListFixedAssetMaints"/> <view-map name="EditFixedAssetMeters" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditFixedAssetMeters"/> <view-map name="EditFixedAssetMaintOrders" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditFixedAssetMaintOrders"/> - <view-map name="calendar" type="screen" page="component://workeffort/widget/CalendarScreens.xml#CalendarWithDecorator"/> + <view-map name="calendar" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#Calendar"/> <view-map name="WorkEffortSummary" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#WorkEffortSummary"/> <!-- Depreciation Calculation --> Modified: ofbiz/trunk/applications/accounting/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/CommonScreens.xml?rev=791057&r1=791056&r2=791057&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/CommonScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/CommonScreens.xml Sat Jul 4 04:21:29 2009 @@ -388,22 +388,4 @@ </section> </screen> - <screen name="CommonCalendarDecorator"> - <section> - <actions> - <set field="tabButtonItem" value="ListFixedAssetCalendar"/> - <script location="component://accounting/webapp/accounting/WEB-INF/actions/fixedasset/ViewCalendar.groovy"/> - <entity-one entity-name="FixedAsset" value-field="fixedAsset"/> - </actions> - <widgets> - <decorator-screen name="CommonFixedAssetDecorator"> - <decorator-section name="body"> - <!--include-menu name="FixedAssetCalendarTabBar" location="component://accounting/widget/Menus.xml"/--> - <decorator-section-include name="body"/> - </decorator-section> - </decorator-screen> - </widgets> - </section> - </screen> - </screens> Modified: ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml?rev=791057&r1=791056&r2=791057&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml Sat Jul 4 04:21:29 2009 @@ -193,6 +193,24 @@ </widgets> </section> </screen> + + <screen name="Calendar"> + <section> + <actions> + <set field="tabButtonItem" value="ListFixedAssetCalendar"/> + <set field="fixedAssetId" from-field="parameters.fixedAssetId"/> + </actions> + <widgets> + <decorator-screen name="CommonFixedAssetDecorator" location="${parameters.fixedAssetDecoratorLocation}"> + <decorator-section name="body"> + <include-screen name="Calendar" location="component://workeffort/widget/CalendarScreens.xml"/> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + + <!-- Fixed Asset Registrations --> <screen name="EditFixedAssetRegistrations"> <section> 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=791057&r1=791056&r2=791057&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 04:21:29 2009 @@ -50,6 +50,7 @@ import org.ofbiz.entity.condition.EntityJoinOperator; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.model.ModelEntity; +import org.ofbiz.entity.model.ModelField; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.security.Security; import org.ofbiz.service.DispatchContext; @@ -366,8 +367,8 @@ 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_CREATED")); +// entityExprList.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_COMPLETED")); entityExprList.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "PRUN_CLOSED")); } EntityCondition typesCondition = null; @@ -421,7 +422,24 @@ * </ul> * </ul> */ + public static Map<String, Object> getWorkEffortEventsByPeriod(DispatchContext ctx, Map<String, ? extends Object> context) { + + /* + To create testdata for this function for fixedasset/facility + + 1) go to Manufacturing -> JobShop, then click on "create new Production run": + https://localhost:8443/manufacturing/control/CreateProductionRun + 2) enter as productId "PROD_MANUF", quantity 1, start date tomorrow and press the submit button + ` 3) in the next screen, click on the "Confirm" link (top part of the sccreen) + + Now you have a confirmed production run (starting tomorrow) happening in facility "WebStoreWarehouse", + with a task happening in fixed asset "WORKCENTER_COST" + + In the calendars screen, selecting the proper facility you should see the work effort associated to the production run; + if you select the proper fixed asset you should see the task. + + */ GenericDelegator delegator = ctx.getDelegator(); Security security = ctx.getSecurity(); GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -435,6 +453,7 @@ Collection<String> partyIds = UtilGenerics.checkCollection(context.get("partyIds")); String facilityId = (String) context.get("facilityId"); String fixedAssetId = (String) context.get("fixedAssetId"); + // Debug.log("======by period for fixedAsset: " + fixedAssetId + " facilityId: " + facilityId + "partyId: " + partyId + " entityExprList:" + (List) context.get("entityExprList")); String workEffortTypeId = (String) context.get("workEffortTypeId"); Boolean filterOutCanceledEvents = (Boolean) context.get("filterOutCanceledEvents"); if (filterOutCanceledEvents == null) { @@ -479,70 +498,36 @@ partyIdsToUse.add(userLogin.getString("partyId")); } } + List<EntityCondition> entityExprList = UtilGenerics.checkList(context.get("entityExprList")); if (entityExprList == null) { - entityExprList = getDefaultWorkEffortExprList(partyIdsToUse, facilityId, fixedAssetId, workEffortTypeId); + entityExprList = getDefaultWorkEffortExprList(partyIds, facilityId, fixedAssetId, workEffortTypeId); } - - 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( - 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) - ), EntityJoinOperator.AND); - + 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)); if (filterOutCanceledEvents.booleanValue()) { entityExprList.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "EVENT_CANCELLED")); } - // always take all recurring workefforts and 'AND' all previous conditions including the period check - EntityConditionList<EntityCondition> ecl = - EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( - EntityCondition.makeCondition("tempExprId", EntityOperator.NOT_EQUAL, null), - EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( - EntityCondition.makeCondition(entityExprList, EntityJoinOperator.AND), - periodCheck - ), EntityJoinOperator.AND) - ), 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"); 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); 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)) { + entityExprList.add(EntityCondition.makeCondition("fixedAssetId", EntityOperator.EQUALS, fixedAssetId)); + EntityConditionList<EntityCondition> ecl = EntityCondition.makeCondition(entityExprList, 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 { + entityExprList.add(EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId)); + EntityConditionList<EntityCondition> ecl = EntityCondition.makeCondition(entityExprList, EntityJoinOperator.AND); + // Debug.log("=====conditions for facility: " + ecl); tempWorkEfforts = delegator.findList("WorkEffort", ecl, null, UtilMisc.toList("estimatedStartDate"), null, false); } validWorkEfforts = WorkEffortWorker.removeDuplicateWorkEfforts(tempWorkEfforts); @@ -605,8 +590,6 @@ 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(); Added: 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=791057&view=auto ============================================================================== --- ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy (added) +++ ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy Sat Jul 4 04:21:29 2009 @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +facilityId = parameters.facilityId; +fixedAssetId = parameters.fixedAssetId; +partyId = parameters.partyId; +workEffortTypeId = parameters.workEffortTypeId; + +urlParam = null; +if (facilityId) { + urlParam = "facilityId=" + facilityId; +} +if (fixedAssetId) { + urlParam = "fixedAssetId=" + fixedAssetId; +} +if (partyId) { + urlParam = "partyId=" + partyId; +} + +if (workEffortTypeId) { + urlParam = "workEffortTypeId=" + workEffortTypeId; +} + +if (urlParam) { + urlParam = "&" + urlParam; +} + +context.put("urlParam", urlParam); Propchange: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain 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=791057&r1=791056&r2=791057&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 Sat Jul 4 04:21:29 2009 @@ -27,25 +27,11 @@ String currentDay = parameters.get("currentDay"); String startParam = parameters.get("start"); -facilityId = parameters.get("facilityId"); -fixedAssetId = parameters.get("fixedAssetId"); -partyId = parameters.get("partyId"); -workEffortTypeId = parameters.get("workEffortTypeId"); - -eventsParam = ""; -if (facilityId != null) { - eventsParam = "facilityId=" + facilityId; -} -if (fixedAssetId != null) { - eventsParam = "fixedAssetId=" + fixedAssetId; -} -if (partyId != null) { - eventsParam = "partyId=" + partyId; -} - -if (workEffortTypeId != null) { - eventsParam = "workEffortTypeId=" + workEffortTypeId; -} +facilityId = parameters.facilityId; +fixedAssetId = parameters.fixedAssetId; +partyId = parameters.partyId; +workEffortTypeId = parameters.workEffortTypeId; +entityExprList = context.entityExprList; Timestamp start = null; if (UtilValidate.isNotEmpty(startParam)) { @@ -64,6 +50,9 @@ 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)); +if (entityExprList) { + serviceCtx.putAll(["entityExprList" : entityExprList]); +} Map result = dispatcher.runSync("getWorkEffortEventsByPeriod",serviceCtx); context.put("periods",result.get("periods")); @@ -71,4 +60,3 @@ context.put("start",start); context.put("prev",prev); context.put("next",next); -context.put("eventsParam", eventsParam); 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=791057&r1=791056&r2=791057&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 Sat Jul 4 04:21:29 2009 @@ -26,27 +26,13 @@ import org.ofbiz.webapp.pseudotag.*; import org.ofbiz.workeffort.workeffort.*; -startParam = parameters.get("start"); +startParam = parameters.start; -facilityId = parameters.get("facilityId"); -fixedAssetId = parameters.get("fixedAssetId"); -partyId = parameters.get("partyId"); -workEffortTypeId = parameters.get("workEffortTypeId"); - -eventsParam = ""; -if (facilityId != null) { - eventsParam = "facilityId=" + facilityId; -} -if (fixedAssetId != null) { - eventsParam = "fixedAssetId=" + fixedAssetId; -} -if (partyId != null) { - eventsParam = "partyId=" + partyId; -} - -if (workEffortTypeId != null) { - eventsParam = "workEffortTypeId=" + workEffortTypeId; -} +facilityId = parameters.facilityId; +fixedAssetId = parameters.fixedAssetId; +partyId = parameters.partyId; +workEffortTypeId = parameters.workEffortTypeId; +entityExprList = context.entityExprList; start = null; if (UtilValidate.isNotEmpty(startParam)) { @@ -79,6 +65,9 @@ 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)); +if (entityExprList) { + serviceCtx.putAll(["entityExprList" : entityExprList]); +} result = dispatcher.runSync("getWorkEffortEventsByPeriod", serviceCtx); @@ -88,4 +77,3 @@ context.put("end", end); context.put("prev", prev); context.put("next", next); -context.put("eventsParam", eventsParam); 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=791057&r1=791056&r2=791057&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 Sat Jul 4 04:21:29 2009 @@ -25,26 +25,17 @@ import org.ofbiz.workeffort.workeffort.*; import java.sql.Timestamp; -String currentDay = parameters.get("currentDay"); -String startParam = parameters.get("start"); +String currentDay = parameters.currentDay; +String startParam = parameters.start; -facilityId = parameters.get("facilityId"); -fixedAssetId = parameters.get("fixedAssetId"); -partyId = parameters.get("partyId"); -workEffortTypeId = parameters.get("workEffortTypeId"); - -eventsParam = ""; -if (facilityId != null) { - eventsParam = "facilityId=" + facilityId; -} -if (fixedAssetId != null) { - eventsParam = "fixedAssetId=" + fixedAssetId; -} -if (partyId != null) { - eventsParam = "partyId=" + partyId; -} -if (workEffortTypeId != null) { - eventsParam = "workEffortTypeId=" + workEffortTypeId; +facilityId = parameters.facilityId; +fixedAssetId = parameters.fixedAssetId; +partyId = parameters.partyId; +workEffortTypeId = parameters.workEffortTypeId; +entityExprList = (List) context.get("entityExprList"); +filterOutCanceledEvents = parameters.filterOutCanceledEvents; +if (!filterOutCanceledEvents) { + filterOutCanceledEvents = Boolean.FALSE; } Timestamp start = null; @@ -64,8 +55,14 @@ context.nextMillis = new Long(next.getTime()).toString(); Timestamp end = UtilDateTime.getDayStart(start, 6, timeZone, locale); -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)); +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)); +if (entityExprList) { + serviceCtx.putAll(["entityExprList" : entityExprList]); +} Map result = dispatcher.runSync("getWorkEffortEventsByPeriod",serviceCtx); context.put("periods",result.get("periods")); @@ -74,4 +71,3 @@ context.put("end",end); context.put("prev",prev); context.put("next",next); -context.put("eventsParam", eventsParam); Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/day.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/day.ftl?rev=791057&r1=791056&r2=791057&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/day.ftl (original) +++ ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/day.ftl Sat Jul 4 04:21:29 2009 @@ -33,7 +33,7 @@ <tr<#if currentPeriod> class="current-period"<#else><#if (period.calendarEntries?size > 0)> class="active-period"</#if></#if>> <td class="label"> ${period.start?time?string.short}<br/> - <a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=day&form=edit&start=${parameters.start?if_exists}¤tStatusId=CAL_TENTATIVE&estimatedStartDate=${period.start?string("yyyy-MM-dd HH:mm:ss")}&estimatedCompletionDate=${period.end?string("yyyy-MM-dd HH:mm:ss")}${addlParam?if_exists}</@ofbizUrl>">${uiLabelMap.CommonAddNew}</a> + <a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=day&form=edit&start=${parameters.start?if_exists}¤tStatusId=CAL_TENTATIVE&estimatedStartDate=${period.start?string("yyyy-MM-dd HH:mm:ss")}&estimatedCompletionDate=${period.end?string("yyyy-MM-dd HH:mm:ss")}${urlParam?if_exists}${addlParam?if_exists}</@ofbizUrl>">${uiLabelMap.CommonAddNew}</a> </td> <#list period.calendarEntries as calEntry> <#if calEntry.workEffort.actualStartDate?exists> @@ -66,7 +66,7 @@ <#else> ${startDate?time?string.short}-${completionDate?time?string.short} </#if> - <br/><a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?form=edit&period=day&start=${parameters.start?if_exists}&workEffortId=${calEntry.workEffort.workEffortId}${addlParam?if_exists}</@ofbizUrl>">${calEntry.workEffort.workEffortName?default("Undefined")}</a> </td> + <br/><a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?form=edit&period=day&start=${parameters.start?if_exists}&workEffortId=${calEntry.workEffort.workEffortId}${urlParam?if_exists}${addlParam?if_exists}</@ofbizUrl>">${calEntry.workEffort.workEffortName?default("Undefined")}</a> </td> </#if> </#list> <#if (period.calendarEntries?size < maxConcurrentEntries)> Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/month.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/month.ftl?rev=791057&r1=791056&r2=791057&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/month.ftl (original) +++ ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/month.ftl Sat Jul 4 04:21:29 2009 @@ -44,12 +44,12 @@ <#if indexMod7 = 0> <tr> <td class="label"> - <a href='<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=week&start=${period.start.time?string("#")}<#if eventsParam?has_content>&${eventsParam}</#if>${addlParam?if_exists}</@ofbizUrl>'>${uiLabelMap.CommonWeek} ${period.start?date?string("w")}</a> + <a href='<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=week&start=${period.start.time?string("#")}${urlParam?if_exists}${addlParam?if_exists}</@ofbizUrl>'>${uiLabelMap.CommonWeek} ${period.start?date?string("w")}</a> </td> </#if> <td<#if currentPeriod> class="current-period"<#else><#if (period.calendarEntries?size > 0)> class="active-period"</#if></#if>> - <span class="h1"><a href='<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=day&start=${period.start.time?string("#")}<#if eventsParam?has_content>&${eventsParam}</#if>${addlParam?if_exists}</@ofbizUrl>'>${period.start?date?string("d")?cap_first}</a></span> - <a class="add-new" href='<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=month&form=edit&start=${parameters.start?if_exists}¤tStatusId=CAL_TENTATIVE&estimatedStartDate=${period.start?string("yyyy-MM-dd HH:mm:ss")}&estimatedCompletionDate=${period.end?string("yyyy-MM-dd HH:mm:ss")}${addlParam?if_exists}</@ofbizUrl>'>${uiLabelMap.CommonAddNew}</a> + <span class="h1"><a href='<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=day&start=${period.start.time?string("#")}${urlParam?if_exists}${addlParam?if_exists}</@ofbizUrl>'>${period.start?date?string("d")?cap_first}</a></span> + <a class="add-new" href='<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=month&form=edit&start=${parameters.start?if_exists}¤tStatusId=CAL_TENTATIVE&estimatedStartDate=${period.start?string("yyyy-MM-dd HH:mm:ss")}&estimatedCompletionDate=${period.end?string("yyyy-MM-dd HH:mm:ss")}${urlParam?if_exists}${addlParam?if_exists}</@ofbizUrl>'>${uiLabelMap.CommonAddNew}</a> <br class="clear"/> <#list period.calendarEntries as calEntry> <#if calEntry.workEffort.actualStartDate?exists> @@ -81,7 +81,7 @@ ${startDate?time?string.short}-${completionDate?time?string.short} </#if> <br/> - <a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?form=edit&period=month&start=${parameters.start?if_exists}&workEffortId=${calEntry.workEffort.workEffortId}${addlParam?if_exists}</@ofbizUrl>" class="event">${calEntry.workEffort.workEffortName?default("Undefined")}</a> ${calEntry.eventStatus?default(" ")} + <a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?form=edit&period=month&start=${parameters.start?if_exists}&workEffortId=${calEntry.workEffort.workEffortId}${urlParam?if_exists}${addlParam?if_exists}</@ofbizUrl>" class="event">${calEntry.workEffort.workEffortName?default("Undefined")}</a> ${calEntry.eventStatus?default(" ")} <br/> </#list> </td> Modified: ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/week.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/week.ftl?rev=791057&r1=791056&r2=791057&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/week.ftl (original) +++ ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/week.ftl Sat Jul 4 04:21:29 2009 @@ -32,8 +32,8 @@ <#if (nowTimestamp >= period.start) && (nowTimestamp <= period.end)><#assign currentPeriod = true/></#if> <tr<#if currentPeriod> class="current-period"<#else><#if (period.calendarEntries?size > 0)> class="active-period"</#if></#if>> <td class="centered" width="1%"> - <a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=day&start=${period.start.time?string("#")}<#if eventsParam?has_content>&${eventsParam}</#if>${addlParam?if_exists}</@ofbizUrl>">${period.start?date?string("EEEE")?cap_first} ${period.start?date?string.short}</a><br/> - <a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=week&form=edit&start=${parameters.start?if_exists}&workEffortTypeId=EVENT¤tStatusId=CAL_TENTATIVE&estimatedStartDate=${period.start?string("yyyy-MM-dd HH:mm:ss")}&estimatedCompletionDate=${period.end?string("yyyy-MM-dd HH:mm:ss")}${addlParam?if_exists}</@ofbizUrl>">${uiLabelMap.CommonAddNew}</a> + <a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=day&start=${period.start.time?string("#")}${urlParam?if_exists}${addlParam?if_exists}</@ofbizUrl>">${period.start?date?string("EEEE")?cap_first} ${period.start?date?string.short}</a><br/> + <a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=week&form=edit&start=${parameters.start?if_exists}&parentTypeId=EVENT¤tStatusId=CAL_TENTATIVE&estimatedStartDate=${period.start?string("yyyy-MM-dd HH:mm:ss")}&estimatedCompletionDate=${period.end?string("yyyy-MM-dd HH:mm:ss")}${addlParam?if_exists}${urlParam?if_exists}</@ofbizUrl>">${uiLabelMap.CommonAddNew}</a> </td> <#list period.calendarEntries as calEntry> <#if calEntry.workEffort.actualStartDate?exists> @@ -68,7 +68,7 @@ <#else> ${startDate?time?string.short}-${completionDate?time?string.short} </#if> - <br/><a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?form=edit&period=week&start=${parameters.start?if_exists}&workEffortId=${calEntry.workEffort.workEffortId}${addlParam?if_exists}</@ofbizUrl>" class="event">${calEntry.workEffort.workEffortName?default("Undefined")}</a> </td> + <br/><a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?form=edit&period=week&start=${parameters.start?if_exists}&workEffortId=${calEntry.workEffort.workEffortId}${addlParam?if_exists}${urlParam?if_exists}</@ofbizUrl>" class="event">${calEntry.workEffort.workEffortName?default("Undefined")}</a> </td> </#if> </#list> <#if (period.calendarEntries?size < maxConcurrentEntries)> Modified: ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml?rev=791057&r1=791056&r2=791057&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml (original) +++ ofbiz/trunk/applications/workeffort/widget/CalendarForms.xml Sat Jul 4 04:21:29 2009 @@ -29,14 +29,12 @@ <option key="month" description="${uiLabelMap.WorkEffortMonthView}"/> </drop-down> </field> - <field name="updateButton"><submit/></field> </form> <form name="editCalEvent" type="single" target="createWorkEffortAndPartyAssign" default-map-name="workEffort"> <alt-target use-when="workEffort!=null" target="updateWorkEffort"/> <field name="workEffortId" use-when="workEffort!=null"><hidden/></field> <field name="partyId"><hidden value="${parameters.userLogin.partyId}"/></field> <field name="roleTypeId" use-when="workEffort==null"><hidden value="CAL_OWNER"/></field> - <field name="workEffortTypeId"><hidden value="EVENT"/></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> @@ -44,7 +42,7 @@ <field name="workEffortTypeId"> <drop-down no-current-selected-key="MEETING"> <entity-options entity-name="WorkEffortType" description="${description}"> - <entity-constraint name="parentTypeId" value="EVENT"/> + <entity-constraint name="parentTypeId" value="${parameters.parentTypeId}"/> <entity-order-by field-name="description"/> </entity-options> </drop-down> @@ -59,7 +57,8 @@ </field> <field name="estimatedStartDate"><date-time input-method="time-dropdown" /></field> <field name="estimatedCompletionDate"><date-time input-method="time-dropdown"/></field> - <field name="add" title="${uiLabelMap.CommonAdd}"><submit/></field> + <field name="addButton" use-when="workEffort==null"><submit/></field> + <field name="updateButton" use-when="workEffort!=null"><submit/></field> </form> <form name="cancelEvent" type="single" target="updateWorkEffort"> <field name="workEffortId"><hidden value="${parameters.workEffortId}"/></field> @@ -97,7 +96,7 @@ </form> <form name="addCalEventRole" type="single" target="createWorkEffortPartyAssign"> <field name="workEffortId"><hidden value="${parameters.workEffortId}"/></field> - <field name="statusId"><hidden value="PRTYASGN_ASSIGNED"/></field> + <field name="statusId" use-when="workEffort==null"><hidden value="PRTYASGN_ASSIGNED"/></field> <field name="partyId" position="1"><lookup target-form-name="LookupPartyName" size="10"></lookup></field> <field name="roleTypeId" position="2"> <drop-down no-current-selected-key="CAL_ATTENDEE"> Modified: ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml?rev=791057&r1=791056&r2=791057&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml (original) +++ ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml Sat Jul 4 04:21:29 2009 @@ -27,6 +27,7 @@ <set field="titleProperty" value="PageTitleCalendar"/> <script location="component://common/webcommon/WEB-INF/actions/includes/retrievePortletAttributes.groovy"/> <set field="parameters.period" from-field="parameters.period" default-value="${initialView}"/> + <script location="component://workeffort/webapp/workeffort/WEB-INF/actions/calendar/CreateUrlParam.groovy"/> </actions> <widgets> <section> @@ -126,25 +127,24 @@ </actions> <widgets> <section> - <condition> + <condition><!-- check if need to display detail screen --> <and> + <if-compare field="parameters.form" operator="equals" value="edit"/> <or> <and> <not><if-empty field="workEffort"/></not> <if-compare field="workEffort.currentStatusId" operator="not-equals" value="CAL_CANCELLED"/> </and> <if-empty field="workEffort"/> - <if-has-permission permission="WORKEFFORTMGR" action="ADMIN"/> </or> - <if-compare field="parameters.form" operator="equals" value="edit"/> </and> </condition> <widgets> - <section> + <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-empty field="workEffort"/> + <if-has-permission permission="WORKEFFORTMGR" action="ADMIN"/> </or> </condition> <widgets><!-- edit section --> Modified: ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml?rev=791057&r1=791056&r2=791057&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml (original) +++ ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml Sat Jul 4 04:21:29 2009 @@ -142,35 +142,35 @@ </menu> <menu name="Day" extends="Calendar"> <menu-item name="next" title="${uiLabelMap.WorkEffortNextDay}"> - <link target="${parameters._LAST_VIEW_NAME_}?period=day&start=${nextMillis}&fixedAssetId=${parameters.fixedAssetId}"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=day&start=${nextMillis}${urlParam}"/> </menu-item> <menu-item name="toDay" title="${uiLabelMap.CommonToday}"> - <link target="${parameters._LAST_VIEW_NAME_}?period=day&fixedAssetId=${parameters.fixedAssetId}"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=day${urlParam}"/> </menu-item> <menu-item name="prev" title="${uiLabelMap.WorkEffortPreviousDay}"> - <link target="${parameters._LAST_VIEW_NAME_}?period=day&start=${prevMillis}&fixedAssetId=${parameters.fixedAssetId}"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=day&start=${prevMillis}${urlParam}"/> </menu-item> </menu> <menu name="Week" extends="Calendar"> <menu-item name="next" title="${uiLabelMap.WorkEffortNextWeek}"> - <link target="${parameters._LAST_VIEW_NAME_}?period=week&start=${nextMillis}&fixedAssetId=${parameters.fixedAssetId}"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=week&start=${nextMillis}${urlParam}"/> </menu-item> <menu-item name="thisWeek" title="${uiLabelMap.WorkEffortThisWeek}"> - <link target="${parameters._LAST_VIEW_NAME_}?period=week&fixedAssetId=${parameters.fixedAssetId}"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=week${urlParam}"/> </menu-item> <menu-item name="prev" title="${uiLabelMap.WorkEffortPreviousWeek}"> - <link target="${parameters._LAST_VIEW_NAME_}?period=week&start=${prevMillis}&fixedAssetId=${parameters.fixedAssetId}"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=week&start=${prevMillis}${urlParam}"/> </menu-item> </menu> <menu name="Month" extends="Calendar"> <menu-item name="next" title="${uiLabelMap.WorkEffortNextMonth}"> - <link target="${parameters._LAST_VIEW_NAME_}?period=month&start=${nextMillis}&fixedAssetId=${parameters.fixedAssetId}"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=month&start=${nextMillis}${urlParam}"/> </menu-item> <menu-item name="thisMonth" title="${uiLabelMap.WorkEffortThisMonth}"> - <link target="${parameters._LAST_VIEW_NAME_}?period=month&fixedAssetId=${parameters.fixedAssetId}"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=month${urlParam}"/> </menu-item> <menu-item name="prev" title="${uiLabelMap.WorkEffortPreviousMonth}"> - <link target="${parameters._LAST_VIEW_NAME_}?period=month&start=${prevMillis}&fixedAssetId=${parameters.fixedAssetId}"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=month&start=${prevMillis}${urlParam}"/> </menu-item> </menu> <menu name="Upcoming" extends="Calendar"> @@ -183,13 +183,13 @@ <if-empty field="parameters.fixedAssetId"/> </and> </condition> - <link target="${parameters._LAST_VIEW_NAME_}?period=upcoming"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=upcoming${urlParam}"/> </menu-item> <menu-item name="month" title="${uiLabelMap.WorkEffortMonthView}"> <condition> <if-compare field="parameters.period" operator="not-equals" value="month"/> </condition> - <link target="${parameters._LAST_VIEW_NAME_}?period=month&fixedAssetId=${parameters.fixedAssetId}"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=month${urlParam}"/> </menu-item> <menu-item name="week" title="${uiLabelMap.WorkEffortWeekView}"> <condition> @@ -198,13 +198,13 @@ <not><if-empty field="parameters.period"/></not> </and> </condition> - <link target="${parameters._LAST_VIEW_NAME_}?period=week&fixedAssetId=${parameters.fixedAssetId}"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=week${urlParam}"/> </menu-item> <menu-item name="day" title="${uiLabelMap.WorkEffortDayView}"> <condition> <if-compare field="parameters.period" operator="not-equals" value="day"/> </condition> - <link target="${parameters._LAST_VIEW_NAME_}?period=day&fixedAssetId=${parameters.fixedAssetId}"/> + <link target="${parameters._LAST_VIEW_NAME_}?period=day${urlParam}"/> </menu-item> <menu-item name="dummy" title="--------"> <condition> |
Free forum by Nabble | Edit this page |