Hans,
This code will break in France. It would be better to increment a
calendar until the week changes, then subtract a day.
-Adrian
[email protected] wrote:
Author: hansbak
Date: Fri Jul 31 06:51:26 2009
New Revision: 799525
URL: http://svn.apache.org/viewvc?rev=799525&view=rev
Log:
fill also the last week of the monthview
Modified:
ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
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=799525&r1=799524&r2=799525&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
Fri Jul 31 06:51:26 2009
@@ -63,6 +63,11 @@
firstWeekNum = tempCal.get(Calendar.WEEK_OF_YEAR);
context.put("firstWeekNum", new Integer(firstWeekNum));
+// also get days until the end of the week at the end of the month
+lastWeekCal = UtilDateTime.toCalendar(UtilDateTime.addDaysToTimestamp(start,
numDays - prevMonthDays), timeZone, locale);
+followingMonthDays = 7 + lastWeekCal.getFirstDayOfWeek() -
lastWeekCal.get(Calendar.DAY_OF_WEEK);
+if (followingMonthDays < 7) numDays += followingMonthDays;
+
serviceCtx = UtilMisc.toMap("userLogin", userLogin, "start", getFrom,"numPeriods", new
Integer(numDays), "periodType", new Integer(Calendar.DATE));
serviceCtx.putAll(UtilMisc.toMap("partyId", partyId, "facilityId", facilityId, "fixedAssetId", fixedAssetId,
"workEffortTypeId", workEffortTypeId, "locale", locale, "timeZone", timeZone));
if (entityExprList) {