Calendars now working in accounting, workeffort and myportal with fixed asset, facility and party. reported by adrian and with help from Jacopo.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@791057 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hans Bakker
2009-07-04 04:21:29 +00:00
parent 9add252033
commit fd36165353
15 changed files with 163 additions and 261 deletions
@@ -1,96 +0,0 @@
/*
* 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.
*/
import java.util.*;
import org.ofbiz.entity.*;
import org.ofbiz.entity.condition.*;
import org.ofbiz.base.util.*;
import java.sql.Timestamp;
import java.text.*;
// The view mode - Day, Week, or Month
viewMode = parameters.viewMode ?: "W";
parameters.viewMode = viewMode;
// Prepare vars for mode-specific date calculations
startParam = parameters.start;
if (!startParam) {
start = nowTimestamp.clone();
} else {
start = new Timestamp(Long.parseLong(startParam));
}
numPeriods = 24;
periodType = Calendar.HOUR;
getFrom = null;
prev = null;
next = null;
end = null;
if ("D".equals(viewMode)) {
// Day view
start = UtilDateTime.getDayStart(start, timeZone, locale);
getFrom = new Timestamp(start.getTime());
prev = UtilDateTime.getDayStart(start, -1, timeZone, locale);
next = UtilDateTime.getDayStart(start, 1, timeZone, locale);
} else if ("W".equals(viewMode)) {
// Week view
start = UtilDateTime.getWeekStart(start, timeZone, locale);
getFrom = new Timestamp(start.getTime());
prev = UtilDateTime.getDayStart(start, -7, timeZone, locale);
next = UtilDateTime.getDayStart(start, 7, timeZone, locale);
end = UtilDateTime.getDayStart(start,6, timeZone, locale);
numPeriods = 7;
periodType = Calendar.DATE;
} else {
// Month view
start = UtilDateTime.getMonthStart(start, timeZone, locale);
tempCal = UtilDateTime.toCalendar(start, timeZone, locale);
firstWeekNum = tempCal.get(Calendar.WEEK_OF_YEAR);
globalContext.firstWeekNum = firstWeekNum;
numPeriods = tempCal.getActualMaximum(Calendar.DAY_OF_MONTH);
prev = UtilDateTime.getDayStart(start, -1, timeZone, locale);
next = UtilDateTime.getDayStart(start, numPeriods+1, timeZone, locale);
end = UtilDateTime.getDayStart(start, numPeriods, timeZone, locale);
prevMonthDays = tempCal.get(Calendar.DAY_OF_WEEK) - tempCal.getFirstDayOfWeek();
if (prevMonthDays < 0) {
prevMonthDays = 7 + prevMonthDays;
}
tempCal.add(Calendar.DATE, -(prevMonthDays));
numPeriods += prevMonthDays;
getFrom = new Timestamp(tempCal.getTimeInMillis());
periodType = Calendar.DATE;
globalContext.end = end;
}
entityExprList = [EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED")];
fixedAssetId = parameters.fixedAssetId;
if (fixedAssetId) {
entityExprList.add(EntityCondition.makeCondition("fixedAssetId", EntityOperator.EQUALS, fixedAssetId));
globalContext.fixedAssetId = fixedAssetId;
globalContext.addlParam = "&fixedAssetId=" + fixedAssetId;
}
serviceCtx = [userLogin : userLogin, start : getFrom, numPeriods : numPeriods, periodType : periodType, fixedAssetId : fixedAssetId];
serviceCtx.putAll([entityExprList : entityExprList, locale : locale, timeZone : timeZone]);
result = dispatcher.runSync("getWorkEffortEventsByPeriod", serviceCtx);
globalContext.periods = result.periods;
globalContext.maxConcurrentEntries = result.maxConcurrentEntries;
globalContext.start = start;
globalContext.prev = prev;
globalContext.next = next;
@@ -2246,7 +2246,7 @@ under the License.
<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 -->
@@ -388,22 +388,4 @@ under the License.
</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>
@@ -193,6 +193,24 @@ under the License.
</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>
@@ -50,6 +50,7 @@ import org.ofbiz.entity.condition.EntityExpr;
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 @@ public class WorkEffortServices {
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 @@ public class WorkEffortServices {
* </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 @@ public class WorkEffortServices {
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 @@ public class WorkEffortServices {
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 @@ public class WorkEffortServices {
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();
@@ -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);
@@ -27,25 +27,11 @@ import java.sql.Timestamp;
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 @@ 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));
if (entityExprList) {
serviceCtx.putAll(["entityExprList" : entityExprList]);
}
Map result = dispatcher.runSync("getWorkEffortEventsByPeriod",serviceCtx);
context.put("periods",result.get("periods"));
@@ -71,4 +60,3 @@ context.put("maxConcurrentEntries",result.get("maxConcurrentEntries"));
context.put("start",start);
context.put("prev",prev);
context.put("next",next);
context.put("eventsParam", eventsParam);
@@ -26,27 +26,13 @@ import org.ofbiz.base.util.*;
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 @@ context.put("firstWeekNum", new Integer(firstWeekNum));
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("start", start);
context.put("end", end);
context.put("prev", prev);
context.put("next", next);
context.put("eventsParam", eventsParam);
@@ -25,26 +25,17 @@ import org.ofbiz.webapp.pseudotag.*;
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 @@ Timestamp next = UtilDateTime.getDayStart(start, 7, timeZone, locale);
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("start",start);
context.put("end",end);
context.put("prev",prev);
context.put("next",next);
context.put("eventsParam", eventsParam);
@@ -33,7 +33,7 @@ under the License.
<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}&currentStatusId=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}&currentStatusId=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 @@ under the License.
<#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>&nbsp;</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>&nbsp;</td>
</#if>
</#list>
<#if (period.calendarEntries?size < maxConcurrentEntries)>
@@ -44,12 +44,12 @@ height: auto;
<#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}&currentStatusId=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}&currentStatusId=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 @@ height: auto;
${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>&nbsp;${calEntry.eventStatus?default("&nbsp;")}
<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>&nbsp;${calEntry.eventStatus?default("&nbsp;")}
<br/>
</#list>
</td>
@@ -32,8 +32,8 @@ under the License.
<#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}&nbsp;${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&currentStatusId=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}&nbsp;${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&currentStatusId=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 @@ under the License.
<#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>&nbsp;</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>&nbsp;</td>
</#if>
</#list>
<#if (period.calendarEntries?size < maxConcurrentEntries)>
@@ -29,14 +29,12 @@ under the License.
<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 @@ under the License.
<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 @@ under the License.
</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 @@ under the License.
</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">
@@ -27,6 +27,7 @@ under the License.
<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 @@ under the License.
</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 -->
@@ -142,35 +142,35 @@ under the License.
</menu>
<menu name="Day" extends="Calendar">
<menu-item name="next" title="${uiLabelMap.WorkEffortNextDay}">
<link target="${parameters._LAST_VIEW_NAME_}?period=day&amp;start=${nextMillis}&amp;fixedAssetId=${parameters.fixedAssetId}"/>
<link target="${parameters._LAST_VIEW_NAME_}?period=day&amp;start=${nextMillis}${urlParam}"/>
</menu-item>
<menu-item name="toDay" title="${uiLabelMap.CommonToday}">
<link target="${parameters._LAST_VIEW_NAME_}?period=day&amp;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&amp;start=${prevMillis}&amp;fixedAssetId=${parameters.fixedAssetId}"/>
<link target="${parameters._LAST_VIEW_NAME_}?period=day&amp;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&amp;start=${nextMillis}&amp;fixedAssetId=${parameters.fixedAssetId}"/>
<link target="${parameters._LAST_VIEW_NAME_}?period=week&amp;start=${nextMillis}${urlParam}"/>
</menu-item>
<menu-item name="thisWeek" title="${uiLabelMap.WorkEffortThisWeek}">
<link target="${parameters._LAST_VIEW_NAME_}?period=week&amp;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&amp;start=${prevMillis}&amp;fixedAssetId=${parameters.fixedAssetId}"/>
<link target="${parameters._LAST_VIEW_NAME_}?period=week&amp;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&amp;start=${nextMillis}&amp;fixedAssetId=${parameters.fixedAssetId}"/>
<link target="${parameters._LAST_VIEW_NAME_}?period=month&amp;start=${nextMillis}${urlParam}"/>
</menu-item>
<menu-item name="thisMonth" title="${uiLabelMap.WorkEffortThisMonth}">
<link target="${parameters._LAST_VIEW_NAME_}?period=month&amp;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&amp;start=${prevMillis}&amp;fixedAssetId=${parameters.fixedAssetId}"/>
<link target="${parameters._LAST_VIEW_NAME_}?period=month&amp;start=${prevMillis}${urlParam}"/>
</menu-item>
</menu>
<menu name="Upcoming" extends="Calendar">
@@ -183,13 +183,13 @@ under the License.
<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&amp;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 @@ under the License.
<not><if-empty field="parameters.period"/></not>
</and>
</condition>
<link target="${parameters._LAST_VIEW_NAME_}?period=week&amp;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&amp;fixedAssetId=${parameters.fixedAssetId}"/>
<link target="${parameters._LAST_VIEW_NAME_}?period=day${urlParam}"/>
</menu-item>
<menu-item name="dummy" title="--------">
<condition>