Author: hansbak
Date: Sun Jul 5 03:14:55 2009 New Revision: 791197 URL: http://svn.apache.org/viewvc?rev=791197&view=rev Log: only select workefforts for the calendar if there is at least a estimated/actual start date but allow an empty enddate. change the ftl's to cater for that Modified: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java 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/CalendarScreens.xml Modified: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml?rev=791197&r1=791196&r2=791197&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml (original) +++ ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml Sun Jul 5 03:14:55 2009 @@ -43,12 +43,6 @@ <field-to-result field="newEntity.workEffortId" result-name="workEffortId"/> <set-nonpk-fields map="parameters" value-field="newEntity"/> - <if-not-empty field="newEntity.estimatedStartDate"> - <if-empty field="newEntity.estimatedCompletionDate"> - <set field="newEntity.estimatedCompletionDate" from-field="newEntity.estimatedStartDate"/> - </if-empty> - </if-not-empty> - <now-timestamp field="nowTimestamp"/> <set from-field="nowTimestamp" field="newEntity.lastStatusUpdate"/> <set from-field="nowTimestamp" field="newEntity.lastModifiedDate"/> 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=791197&r1=791196&r2=791197&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 Jul 5 03:14:55 2009 @@ -509,8 +509,15 @@ EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "EVENT_CANCELLED"), EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED")); + // should have at least a start date + EntityCondition startDateRequired = EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( + EntityCondition.makeCondition("estimatedStartDate", EntityOperator.NOT_EQUAL, null), + EntityCondition.makeCondition("actualStartDate", EntityOperator.NOT_EQUAL, null) + ), EntityJoinOperator.OR); + List<EntityCondition> periodCheckAndlList = UtilMisc.<EntityCondition>toList( - // the taskstart should be less than the period end and the taskEnd should be larger than the period start + startDateRequired, + // the startdate should be less than the period end EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( EntityCondition.makeCondition("actualStartDate", EntityOperator.EQUALS, null), @@ -522,18 +529,26 @@ EntityCondition.makeCondition("actualStartDate", EntityOperator.LESS_THAN_EQUAL_TO, endStamp) ), EntityJoinOperator.AND) ), EntityJoinOperator.OR), + // if the completion date is not null then it should be larger than the period start EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( + // can also be empty + EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( + EntityCondition.makeCondition("estimatedCompletionDate", EntityOperator.EQUALS, null), + EntityCondition.makeCondition("actualCompletionDate", EntityOperator.EQUALS, null) + ), EntityJoinOperator.AND), + // check estimated value if the actual is not provided 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), + // at last check the actual value EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList( EntityCondition.makeCondition("actualCompletionDate", EntityOperator.NOT_EQUAL, null), EntityCondition.makeCondition("actualCompletionDate", EntityOperator.GREATER_THAN_EQUAL_TO, startStamp) ), EntityJoinOperator.AND) ), EntityJoinOperator.OR)); - + entityExprList.addAll(periodCheckAndlList); // (non cancelled) recurring events @@ -542,8 +557,12 @@ recurringEvents.addAll(cancelledCheckAndList); } - // (non cancelled) public events - List<EntityCondition> publicEvents = UtilMisc.<EntityCondition>toList(EntityCondition.makeCondition("scopeEnumId", EntityOperator.EQUALS, "WES_PUBLIC")); + // (non cancelled) public events, with a startdate + List<EntityCondition> publicEvents = UtilMisc.<EntityCondition>toList( + EntityCondition.makeCondition("scopeEnumId", EntityOperator.EQUALS, "WES_PUBLIC"), + startDateRequired + ); + if (filterOutCanceledEvents.booleanValue()) { publicEvents.addAll(cancelledCheckAndList); } @@ -564,7 +583,7 @@ eclTotal, EntityCondition.makeCondition("partyId", EntityOperator.IN, partyIdsToUse) ), EntityJoinOperator.AND); - Debug.log("=====conditions for party: " + ecl); + // Debug.log("=====conditions for party: " + ecl); tempWorkEfforts = EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssign", ecl, null, orderByList, null, false)); } else if (UtilValidate.isNotEmpty(fixedAssetId)) { EntityConditionList<EntityCondition> ecl = @@ -573,7 +592,7 @@ EntityCondition.makeCondition("fixedAssetId", EntityOperator.EQUALS, fixedAssetId) ), EntityJoinOperator.AND); // Get "old style" work efforts and "new style" work efforts - Debug.log("=====conditions for fixed asset: " + ecl); + // Debug.log("=====conditions for fixed asset: " + ecl); tempWorkEfforts = delegator.findList("WorkEffort", ecl, null, orderByList, null, false); tempWorkEfforts.addAll(EntityUtil.filterByDate(delegator.findList("WorkEffortAndFixedAssetAssign", ecl, null, orderByList, null, false))); } else { @@ -582,7 +601,7 @@ eclTotal, EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId) ), EntityJoinOperator.AND); - Debug.log("=====conditions for facility: " + ecl); + // Debug.log("=====conditions for facility: " + ecl); tempWorkEfforts = delegator.findList("WorkEffort", ecl, null, UtilMisc.toList("estimatedStartDate"), null, false); } validWorkEfforts = WorkEffortWorker.removeDuplicateWorkEfforts(tempWorkEfforts); @@ -645,9 +664,16 @@ 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")); + Timestamp startDate = workEffort.getTimestamp("estimatedStartDate"); + if (workEffort.getTimestamp("actualStartDate") != null) { + startDate = workEffort.getTimestamp("actualStartDate"); + } + Timestamp endDate = workEffort.getTimestamp("estimatedCompletionDate"); + if (workEffort.getTimestamp("actualCompletionDate") != null){ + endDate = workEffort.getTimestamp("actualCompletionDate"); + } + if (endDate == null) endDate = startDate; + DateRange weRange = new DateRange(startDate, endDate); if (periodRange.intersectsRange(weRange)) { Map<String, Object> calEntry = FastMap.newInstance(); calEntry.put("workEffort", workEffort); 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=791197&r1=791196&r2=791197&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/day.ftl (original) +++ ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/day.ftl Sun Jul 5 03:14:55 2009 @@ -33,35 +33,37 @@ <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")}${urlParam?if_exists}${addlParam?if_exists}</@ofbizUrl>">${uiLabelMap.CommonAddNew}</a> + <a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=day&form=edit&parentTypeId=${parentTypeId}&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> + <#list period.calendarEntries as calEntry> <#if calEntry.workEffort.actualStartDate?exists> <#assign startDate = calEntry.workEffort.actualStartDate> <#else> - <#assign startDate = calEntry.workEffort.estimatedStartDate> + <#assign startDate = calEntry.workEffort.estimatedStartDate?if_exists> </#if> <#if calEntry.workEffort.actualCompletionDate?exists> <#assign completionDate = calEntry.workEffort.actualCompletionDate> <#else> - <#assign completionDate = calEntry.workEffort.estimatedCompletionDate> + <#assign completionDate = calEntry.workEffort.estimatedCompletionDate?if_exists> </#if> - <#if !completionDate?exists> + <#if !completionDate?has_content && calEntry.workEffort.actualMilliSeconds?has_content> <#assign completionDate = calEntry.workEffort.actualStartDate + calEntry.workEffort.actualMilliSeconds> </#if> - <#if !completionDate?exists> + <#if !completionDate?has_content && calEntry.workEffort.estimatedMilliSeconds?has_content> <#assign completionDate = calEntry.workEffort.estimatedStartDate + calEntry.workEffort.estimatedMilliSeconds> </#if> <#if calEntry.startOfPeriod> <td<#if (calEntry.periodSpan > 1)> rowspan="${calEntry.periodSpan}"</#if> width="${entryWidth?string("#")}%"> - <#if (startDate.compareTo(start) <= 0 && completionDate.compareTo(next) >= 0)> + <#if (startDate.compareTo(start) <= 0 && completionDate?has_content && completionDate.compareTo(next) >= 0)> ${uiLabelMap.CommonAllDay} - <#elseif startDate.before(start)> + <#elseif startDate.before(start) && completionDate?has_content> ${uiLabelMap.CommonUntil} ${completionDate?time?string.short} - <#elseif completionDate.after(next)> + <#elseif !completionDate?has_content> + ${uiLabelMap.CommonFrom} ${startDate?time?string.short} - ? + <#elseif completionDate.after(period.end)> ${uiLabelMap.CommonFrom} ${startDate?time?string.short} <#else> ${startDate?time?string.short}-${completionDate?time?string.short} 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=791197&r1=791196&r2=791197&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/month.ftl (original) +++ ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/month.ftl Sun Jul 5 03:14:55 2009 @@ -49,39 +49,42 @@ </#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("#")}${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> + <a class="add-new" href='<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=month&form=edit&start=${parameters.start?if_exists}&parentTypeId=${parentTypeId}¤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> <#assign startDate = calEntry.workEffort.actualStartDate> <#else> - <#assign startDate = calEntry.workEffort.estimatedStartDate> + <#assign startDate = calEntry.workEffort.estimatedStartDate?if_exists> </#if> <#if calEntry.workEffort.actualCompletionDate?exists> <#assign completionDate = calEntry.workEffort.actualCompletionDate> <#else> - <#assign completionDate = calEntry.workEffort.estimatedCompletionDate> + <#assign completionDate = calEntry.workEffort.estimatedCompletionDate?if_exists> </#if> - <#if !completionDate?exists> + <#if !completionDate?has_content && calEntry.workEffort.actualMilliSeconds?has_content> <#assign completionDate = calEntry.workEffort.actualStartDate + calEntry.workEffort.actualMilliSeconds> </#if> - <#if !completionDate?exists> + <#if !completionDate?has_content && calEntry.workEffort.estimatedMilliSeconds?has_content> <#assign completionDate = calEntry.workEffort.estimatedStartDate + calEntry.workEffort.estimatedMilliSeconds> </#if> <hr/> - <#if (startDate.compareTo(period.start) <= 0 && completionDate.compareTo(period.end) >= 0)> + <#if (startDate.compareTo(period.start) <= 0 && completionDate?has_content && completionDate.compareTo(period.end) >= 0)> ${uiLabelMap.CommonAllDay} - <#elseif startDate.before(period.start)> + <#elseif startDate.before(period.start) && completionDate?has_content> ${uiLabelMap.CommonUntil} ${completionDate?time?string.short} + <#elseif !completionDate?has_content> + ${uiLabelMap.CommonFrom} ${startDate?time?string.short} - ? <#elseif completionDate.after(period.end)> ${uiLabelMap.CommonFrom} ${startDate?time?string.short} <#else> ${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}${urlParam?if_exists}${addlParam?if_exists}</@ofbizUrl>" class="event">${calEntry.workEffort.workEffortName?default("Undefined")}</a> ${calEntry.eventStatus?default(" ")} + <a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?form=edit&parentTypeId=${parentTypeId}&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=791197&r1=791196&r2=791197&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/week.ftl (original) +++ ofbiz/trunk/applications/workeffort/webapp/workeffort/calendar/week.ftl Sun Jul 5 03:14:55 2009 @@ -33,42 +33,44 @@ <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("#")}${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> + <a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?period=week&form=edit&start=${parameters.start?if_exists}&parentTypeId=${parentTypeId}¤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> <#assign startDate = calEntry.workEffort.actualStartDate> <#else> - <#assign startDate = calEntry.workEffort.estimatedStartDate> + <#assign startDate = calEntry.workEffort.estimatedStartDate?if_exists> </#if> <#if calEntry.workEffort.actualCompletionDate?exists> <#assign completionDate = calEntry.workEffort.actualCompletionDate> <#else> - <#assign completionDate = calEntry.workEffort.estimatedCompletionDate> + <#assign completionDate = calEntry.workEffort.estimatedCompletionDate?if_exists> </#if> - <#if !completionDate?exists> + <#if !completionDate?has_content && calEntry.workEffort.actualMilliSeconds?has_content> <#assign completionDate = calEntry.workEffort.actualStartDate + calEntry.workEffort.actualMilliSeconds> </#if> - <#if !completionDate?exists> + <#if !completionDate?has_content && calEntry.workEffort.estimatedMilliSeconds?has_content> <#assign completionDate = calEntry.workEffort.estimatedStartDate + calEntry.workEffort.estimatedMilliSeconds> </#if> <#if calEntry.startOfPeriod> <td<#if (calEntry.periodSpan > 1)> rowspan="${calEntry.periodSpan}"</#if> width="${entryWidth?string("#")}%"> - <#if (startDate.compareTo(start) <= 0 && completionDate.compareTo(next) >= 0)> + <#if (startDate.compareTo(period.start) <= 0 && completionDate?has_content && completionDate.compareTo(period.end) >= 0)> ${uiLabelMap.CommonAllWeek} - <#elseif (startDate.compareTo(period.start) = 0 && completionDate.compareTo(period.end) = 0)> + <#elseif (startDate.compareTo(period.start) = 0 && completionDate?has_content && completionDate.compareTo(period.end) = 0)> ${uiLabelMap.CommonAllDay} - <#elseif startDate.before(start)> + <#elseif startDate.before(start) && completionDate?has_content> ${uiLabelMap.CommonUntil} ${completionDate?datetime?string.short} - <#elseif completionDate.after(next)> + <#elseif !completionDate?has_content> + ${uiLabelMap.CommonFrom} ${startDate?time?string.short} - ? + <#elseif completionDate.after(period.end)> ${uiLabelMap.CommonFrom} ${startDate?time?string.short} <#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}${urlParam?if_exists}</@ofbizUrl>" class="event">${calEntry.workEffort.workEffortName?default("Undefined")}</a> </td> + <br/><a href="<@ofbizUrl>${parameters._LAST_VIEW_NAME_}?form=edit&parentTypeId=${parentTypeId}&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/CalendarScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml?rev=791197&r1=791196&r2=791197&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml (original) +++ ofbiz/trunk/applications/workeffort/widget/CalendarScreens.xml Sun Jul 5 03:14:55 2009 @@ -28,6 +28,7 @@ <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"/> + <set field="parentTypeId" from-field="parameters.parentTypeId" default-value="EVENT"/><!-- workeffortTypeId parent to ad events --> </actions> <widgets> <section> |
Free forum by Nabble | Edit this page |