Re: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy

hans_bakker
Thank you for your help Adrian.

On Tue, 2009-08-04 at 23:40 +0000, [hidden email] wrote:

> Author: adrianc
> Date: Tue Aug  4 23:40:00 2009
> New Revision: 801024
>
> URL: http://svn.apache.org/viewvc?rev=801024&view=rev
> Log:
> Fixed a bug in the Month view work effort calendar.
>
> 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=801024&r1=801023&r2=801024&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 Tue Aug  4 23:40:00 2009
> @@ -51,24 +51,30 @@
>  context.prevMillis = new Long(prev.getTime()).toString();
>  next = UtilDateTime.getDayStart(start, numDays+1, timeZone, locale);
>  context.nextMillis = new Long(next.getTime()).toString();
> -end = UtilDateTime.getDayStart(start, numDays, timeZone, locale);
> +end = UtilDateTime.getMonthEnd(start, timeZone, locale);
>  
>  //Find out what date to get from
>  getFrom = null;
>  prevMonthDays =  tempCal.get(Calendar.DAY_OF_WEEK) - tempCal.getFirstDayOfWeek();
> -if (prevMonthDays < 0) prevMonthDays = 7 + prevMonthDays;
> -tempCal.add(Calendar.DATE,-(prevMonthDays));
> +if (prevMonthDays < 0) prevMonthDays += 7;
> +tempCal.add(Calendar.DATE, -prevMonthDays);
>  numDays += prevMonthDays;
>  getFrom = new Timestamp(tempCal.getTimeInMillis());
>  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;
> +lastWeekCal = UtilDateTime.toCalendar(end, timeZone, locale);
> +monthEndDay = lastWeekCal.get(Calendar.DAY_OF_WEEK);
> +getTo = UtilDateTime.getWeekEnd(end, timeZone, locale);
> +lastWeekCal = UtilDateTime.toCalendar(getTo, timeZone, locale);
> +followingMonthDays = lastWeekCal.get(Calendar.DAY_OF_WEEK) - monthEndDay;
> +if (followingMonthDays < 0) {
> + followingMonthDays += 7;
> +}
> +numDays += followingMonthDays;
>  
> -serviceCtx = UtilMisc.toMap("userLogin", userLogin, "start", getFrom,"numPeriods", new Integer(numDays), "periodType", new Integer(Calendar.DATE));
> +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]);
>
>
--
Antwebsystems.com: Quality OFBiz services for competitive rates

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy

Adrian Crum-2

A good demo of the bug before the online demo is updated:

Using the online demo, go to the work effort month view calendar. Click Next Month until you reach October. Notice the last week. Switch the locale to French and look at the last week again.

-Adrian


--- On Tue, 8/4/09, Hans Bakker <[hidden email]> wrote:

> From: Hans Bakker <[hidden email]>
> Subject: Re: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
> To: [hidden email]
> Date: Tuesday, August 4, 2009, 6:35 PM
> Thank you for your help Adrian.
>
> On Tue, 2009-08-04 at 23:40 +0000, [hidden email]
> wrote:
> > Author: adrianc
> > Date: Tue Aug  4 23:40:00 2009
> > New Revision: 801024
> >
> > URL: http://svn.apache.org/viewvc?rev=801024&view=rev
> > Log:
> > Fixed a bug in the Month view work effort calendar.
> >
> > 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=801024&r1=801023&r2=801024&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
> Tue Aug  4 23:40:00 2009
> > @@ -51,24 +51,30 @@
> >  context.prevMillis = new
> Long(prev.getTime()).toString();
> >  next = UtilDateTime.getDayStart(start,
> numDays+1, timeZone, locale);
> >  context.nextMillis = new
> Long(next.getTime()).toString();
> > -end = UtilDateTime.getDayStart(start, numDays,
> timeZone, locale);
> > +end = UtilDateTime.getMonthEnd(start, timeZone,
> locale);
> > 
> >  //Find out what date to get from
> >  getFrom = null;
> >  prevMonthDays = 
> tempCal.get(Calendar.DAY_OF_WEEK) -
> tempCal.getFirstDayOfWeek();
> > -if (prevMonthDays < 0) prevMonthDays = 7 +
> prevMonthDays;
> > -tempCal.add(Calendar.DATE,-(prevMonthDays));
> > +if (prevMonthDays < 0) prevMonthDays += 7;
> > +tempCal.add(Calendar.DATE, -prevMonthDays);
> >  numDays += prevMonthDays;
> >  getFrom = new
> Timestamp(tempCal.getTimeInMillis());
> >  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;
> > +lastWeekCal = UtilDateTime.toCalendar(end, timeZone,
> locale);
> > +monthEndDay = lastWeekCal.get(Calendar.DAY_OF_WEEK);
> > +getTo = UtilDateTime.getWeekEnd(end, timeZone,
> locale);
> > +lastWeekCal = UtilDateTime.toCalendar(getTo,
> timeZone, locale);
> > +followingMonthDays =
> lastWeekCal.get(Calendar.DAY_OF_WEEK) - monthEndDay;
> > +if (followingMonthDays < 0) {
> > +    followingMonthDays += 7;
> > +}
> > +numDays += followingMonthDays;
> > 
> > -serviceCtx = UtilMisc.toMap("userLogin", userLogin,
> "start", getFrom,"numPeriods", new Integer(numDays),
> "periodType", new Integer(Calendar.DATE));
> > +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]);
> >
> >
> --
> Antwebsystems.com: Quality OFBiz services for competitive
> rates
>
>



Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy

hans_bakker
Thanks Adrian again...i checked it and see that october is one day short
in the french locale....but if that really 'breaks' the calendar?

On Tue, 2009-08-04 at 19:30 -0700, Adrian Crum wrote:

> A good demo of the bug before the online demo is updated:
>
> Using the online demo, go to the work effort month view calendar. Click Next Month until you reach October. Notice the last week. Switch the locale to French and look at the last week again.
>
> -Adrian
>
>
> --- On Tue, 8/4/09, Hans Bakker <[hidden email]> wrote:
>
> > From: Hans Bakker <[hidden email]>
> > Subject: Re: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
> > To: [hidden email]
> > Date: Tuesday, August 4, 2009, 6:35 PM
> > Thank you for your help Adrian.
> >
> > On Tue, 2009-08-04 at 23:40 +0000, [hidden email]
> > wrote:
> > > Author: adrianc
> > > Date: Tue Aug  4 23:40:00 2009
> > > New Revision: 801024
> > >
> > > URL: http://svn.apache.org/viewvc?rev=801024&view=rev
> > > Log:
> > > Fixed a bug in the Month view work effort calendar.
> > >
> > > 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=801024&r1=801023&r2=801024&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
> > Tue Aug  4 23:40:00 2009
> > > @@ -51,24 +51,30 @@
> > >  context.prevMillis = new
> > Long(prev.getTime()).toString();
> > >  next = UtilDateTime.getDayStart(start,
> > numDays+1, timeZone, locale);
> > >  context.nextMillis = new
> > Long(next.getTime()).toString();
> > > -end = UtilDateTime.getDayStart(start, numDays,
> > timeZone, locale);
> > > +end = UtilDateTime.getMonthEnd(start, timeZone,
> > locale);
> > >  
> > >  //Find out what date to get from
> > >  getFrom = null;
> > >  prevMonthDays =
> > tempCal.get(Calendar.DAY_OF_WEEK) -
> > tempCal.getFirstDayOfWeek();
> > > -if (prevMonthDays < 0) prevMonthDays = 7 +
> > prevMonthDays;
> > > -tempCal.add(Calendar.DATE,-(prevMonthDays));
> > > +if (prevMonthDays < 0) prevMonthDays += 7;
> > > +tempCal.add(Calendar.DATE, -prevMonthDays);
> > >  numDays += prevMonthDays;
> > >  getFrom = new
> > Timestamp(tempCal.getTimeInMillis());
> > >  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;
> > > +lastWeekCal = UtilDateTime.toCalendar(end, timeZone,
> > locale);
> > > +monthEndDay = lastWeekCal.get(Calendar.DAY_OF_WEEK);
> > > +getTo = UtilDateTime.getWeekEnd(end, timeZone,
> > locale);
> > > +lastWeekCal = UtilDateTime.toCalendar(getTo,
> > timeZone, locale);
> > > +followingMonthDays =
> > lastWeekCal.get(Calendar.DAY_OF_WEEK) - monthEndDay;
> > > +if (followingMonthDays < 0) {
> > > +    followingMonthDays += 7;
> > > +}
> > > +numDays += followingMonthDays;
> > >  
> > > -serviceCtx = UtilMisc.toMap("userLogin", userLogin,
> > "start", getFrom,"numPeriods", new Integer(numDays),
> > "periodType", new Integer(Calendar.DATE));
> > > +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]);
> > >
> > >
> > --
> > Antwebsystems.com: Quality OFBiz services for competitive
> > rates
> >
> >
>
>
>      
--
Antwebsystems.com: Quality OFBiz services for competitive rates

Reply | Threaded
Open this post in threaded view
|

Discussion: OFBiz Internationalization (was: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy)

Adrian Crum-2
In reply to this post by Adrian Crum-2
The attached email is the motivation for this appeal.

Developers - please keep in mind that OFBiz operates in multiple languages, time zones, currencies, and calendars. We can't assume anything in those regards.

If you are going to work on any of those issues (time, date, currency, language) make sure you understand what you are doing.

IBM has been doing this (internationalization) for decades and they have a Java library for it - ICU (http://site.icu-project.org). Parts of the library are in use in OFBiz, but the main point is to understand the differences in cultures, calendars, currencies, etc. The IBM ICU library is a good guide to enlighten you in internationalization.

If you are a contributor or a committer, please spend some time to learn about internationalization. Doing so will keep OFBiz on the forefront of global ERP.

-Adrian


--- On Tue, 8/4/09, Adrian Crum <[hidden email]> wrote:

> From: Adrian Crum <[hidden email]>
> Subject: Re: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
> To: [hidden email]
> Date: Tuesday, August 4, 2009, 7:30 PM
>
> A good demo of the bug before the online demo is updated:
>
> Using the online demo, go to the work effort month view
> calendar. Click Next Month until you reach October. Notice
> the last week. Switch the locale to French and look at the
> last week again.
>
> -Adrian
>
>
> --- On Tue, 8/4/09, Hans Bakker <[hidden email]>
> wrote:
>
> > From: Hans Bakker <[hidden email]>
> > Subject: Re: svn commit: r801024 -
> /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
> > To: [hidden email]
> > Date: Tuesday, August 4, 2009, 6:35 PM
> > Thank you for your help Adrian.
> >
> > On Tue, 2009-08-04 at 23:40 +0000, [hidden email]
> > wrote:
> > > Author: adrianc
> > > Date: Tue Aug  4 23:40:00 2009
> > > New Revision: 801024
> > >
> > > URL: http://svn.apache.org/viewvc?rev=801024&view=rev
> > > Log:
> > > Fixed a bug in the Month view work effort
> calendar.
> > >
> > > 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=801024&r1=801023&r2=801024&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
> > Tue Aug  4 23:40:00 2009
> > > @@ -51,24 +51,30 @@
> > >  context.prevMillis = new
> > Long(prev.getTime()).toString();
> > >  next = UtilDateTime.getDayStart(start,
> > numDays+1, timeZone, locale);
> > >  context.nextMillis = new
> > Long(next.getTime()).toString();
> > > -end = UtilDateTime.getDayStart(start, numDays,
> > timeZone, locale);
> > > +end = UtilDateTime.getMonthEnd(start, timeZone,
> > locale);
> > > 
> > >  //Find out what date to get from
> > >  getFrom = null;
> > >  prevMonthDays = 
> > tempCal.get(Calendar.DAY_OF_WEEK) -
> > tempCal.getFirstDayOfWeek();
> > > -if (prevMonthDays < 0) prevMonthDays = 7 +
> > prevMonthDays;
> > > -tempCal.add(Calendar.DATE,-(prevMonthDays));
> > > +if (prevMonthDays < 0) prevMonthDays += 7;
> > > +tempCal.add(Calendar.DATE, -prevMonthDays);
> > >  numDays += prevMonthDays;
> > >  getFrom = new
> > Timestamp(tempCal.getTimeInMillis());
> > >  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;
> > > +lastWeekCal = UtilDateTime.toCalendar(end,
> timeZone,
> > locale);
> > > +monthEndDay =
> lastWeekCal.get(Calendar.DAY_OF_WEEK);
> > > +getTo = UtilDateTime.getWeekEnd(end, timeZone,
> > locale);
> > > +lastWeekCal = UtilDateTime.toCalendar(getTo,
> > timeZone, locale);
> > > +followingMonthDays =
> > lastWeekCal.get(Calendar.DAY_OF_WEEK) - monthEndDay;
> > > +if (followingMonthDays < 0) {
> > > +    followingMonthDays += 7;
> > > +}
> > > +numDays += followingMonthDays;
> > > 
> > > -serviceCtx = UtilMisc.toMap("userLogin",
> userLogin,
> > "start", getFrom,"numPeriods", new Integer(numDays),
> > "periodType", new Integer(Calendar.DATE));
> > > +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]);
> > >
> > >
> > --
> > Antwebsystems.com: Quality OFBiz services for
> competitive
> > rates
> >
> >
>
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy

Adrian Crum-2
In reply to this post by hans_bakker

It doesn't break the calendar. The calendar wasn't "broken" before your change. Your change was broken.

-Adrian


--- On Tue, 8/4/09, Hans Bakker <[hidden email]> wrote:

> From: Hans Bakker <[hidden email]>
> Subject: Re: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
> To: [hidden email]
> Date: Tuesday, August 4, 2009, 11:15 PM
> Thanks Adrian again...i checked it
> and see that october is one day short
> in the french locale....but if that really 'breaks' the
> calendar?
>
> On Tue, 2009-08-04 at 19:30 -0700, Adrian Crum wrote:
> > A good demo of the bug before the online demo is
> updated:
> >
> > Using the online demo, go to the work effort month
> view calendar. Click Next Month until you reach October.
> Notice the last week. Switch the locale to French and look
> at the last week again.
> >
> > -Adrian
> >
> >
> > --- On Tue, 8/4/09, Hans Bakker <[hidden email]>
> wrote:
> >
> > > From: Hans Bakker <[hidden email]>
> > > Subject: Re: svn commit: r801024 -
> /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
> > > To: [hidden email]
> > > Date: Tuesday, August 4, 2009, 6:35 PM
> > > Thank you for your help Adrian.
> > >
> > > On Tue, 2009-08-04 at 23:40 +0000, [hidden email]
> > > wrote:
> > > > Author: adrianc
> > > > Date: Tue Aug  4 23:40:00 2009
> > > > New Revision: 801024
> > > >
> > > > URL: http://svn.apache.org/viewvc?rev=801024&view=rev
> > > > Log:
> > > > Fixed a bug in the Month view work effort
> calendar.
> > > >
> > > > 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=801024&r1=801023&r2=801024&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
> > > Tue Aug  4 23:40:00 2009
> > > > @@ -51,24 +51,30 @@
> > > >  context.prevMillis = new
> > > Long(prev.getTime()).toString();
> > > >  next =
> UtilDateTime.getDayStart(start,
> > > numDays+1, timeZone, locale);
> > > >  context.nextMillis = new
> > > Long(next.getTime()).toString();
> > > > -end = UtilDateTime.getDayStart(start,
> numDays,
> > > timeZone, locale);
> > > > +end = UtilDateTime.getMonthEnd(start,
> timeZone,
> > > locale);
> > > > 
> > > >  //Find out what date to get from
> > > >  getFrom = null;
> > > >  prevMonthDays =
> > > tempCal.get(Calendar.DAY_OF_WEEK) -
> > > tempCal.getFirstDayOfWeek();
> > > > -if (prevMonthDays < 0) prevMonthDays = 7
> +
> > > prevMonthDays;
> > > >
> -tempCal.add(Calendar.DATE,-(prevMonthDays));
> > > > +if (prevMonthDays < 0) prevMonthDays +=
> 7;
> > > > +tempCal.add(Calendar.DATE,
> -prevMonthDays);
> > > >  numDays += prevMonthDays;
> > > >  getFrom = new
> > > Timestamp(tempCal.getTimeInMillis());
> > > >  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;
> > > > +lastWeekCal = UtilDateTime.toCalendar(end,
> timeZone,
> > > locale);
> > > > +monthEndDay =
> lastWeekCal.get(Calendar.DAY_OF_WEEK);
> > > > +getTo = UtilDateTime.getWeekEnd(end,
> timeZone,
> > > locale);
> > > > +lastWeekCal =
> UtilDateTime.toCalendar(getTo,
> > > timeZone, locale);
> > > > +followingMonthDays =
> > > lastWeekCal.get(Calendar.DAY_OF_WEEK) -
> monthEndDay;
> > > > +if (followingMonthDays < 0) {
> > > > +    followingMonthDays += 7;
> > > > +}
> > > > +numDays += followingMonthDays;
> > > > 
> > > > -serviceCtx = UtilMisc.toMap("userLogin",
> userLogin,
> > > "start", getFrom,"numPeriods", new
> Integer(numDays),
> > > "periodType", new Integer(Calendar.DATE));
> > > > +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]);
> > > >
> > > >
> > > --
> > > Antwebsystems.com: Quality OFBiz services for
> competitive
> > > rates
> > >
> > >
> >
> >
> >       
> --
> Antwebsystems.com: Quality OFBiz services for competitive
> rates
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Discussion: OFBiz Internationalization (was: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy)

Jacques Le Roux
Administrator
In reply to this post by Adrian Crum-2
Hi Adrian,

Thanks for the calendar fix and this reminder. I really appreciate your concern about OFBiz staying at forefront of global ERPs :o)

Jacques

From: "Adrian Crum" <[hidden email]>

> The attached email is the motivation for this appeal.
>
> Developers - please keep in mind that OFBiz operates in multiple languages, time zones, currencies, and calendars. We can't assume
> anything in those regards.
>
> If you are going to work on any of those issues (time, date, currency, language) make sure you understand what you are doing.
>
> IBM has been doing this (internationalization) for decades and they have a Java library for it - ICU
> (http://site.icu-project.org). Parts of the library are in use in OFBiz, but the main point is to understand the differences in
> cultures, calendars, currencies, etc. The IBM ICU library is a good guide to enlighten you in internationalization.
>
> If you are a contributor or a committer, please spend some time to learn about internationalization. Doing so will keep OFBiz on
> the forefront of global ERP.
>
> -Adrian
>
>
> --- On Tue, 8/4/09, Adrian Crum <[hidden email]> wrote:
>
>> From: Adrian Crum <[hidden email]>
>> Subject: Re: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
>> To: [hidden email]
>> Date: Tuesday, August 4, 2009, 7:30 PM
>>
>> A good demo of the bug before the online demo is updated:
>>
>> Using the online demo, go to the work effort month view
>> calendar. Click Next Month until you reach October. Notice
>> the last week. Switch the locale to French and look at the
>> last week again.
>>
>> -Adrian
>>
>>
>> --- On Tue, 8/4/09, Hans Bakker <[hidden email]>
>> wrote:
>>
>> > From: Hans Bakker <[hidden email]>
>> > Subject: Re: svn commit: r801024 -
>> /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
>> > To: [hidden email]
>> > Date: Tuesday, August 4, 2009, 6:35 PM
>> > Thank you for your help Adrian.
>> >
>> > On Tue, 2009-08-04 at 23:40 +0000, [hidden email]
>> > wrote:
>> > > Author: adrianc
>> > > Date: Tue Aug 4 23:40:00 2009
>> > > New Revision: 801024
>> > >
>> > > URL: http://svn.apache.org/viewvc?rev=801024&view=rev
>> > > Log:
>> > > Fixed a bug in the Month view work effort
>> calendar.
>> > >
>> > > 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=801024&r1=801023&r2=801024&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
>> > Tue Aug 4 23:40:00 2009
>> > > @@ -51,24 +51,30 @@
>> > > context.prevMillis = new
>> > Long(prev.getTime()).toString();
>> > > next = UtilDateTime.getDayStart(start,
>> > numDays+1, timeZone, locale);
>> > > context.nextMillis = new
>> > Long(next.getTime()).toString();
>> > > -end = UtilDateTime.getDayStart(start, numDays,
>> > timeZone, locale);
>> > > +end = UtilDateTime.getMonthEnd(start, timeZone,
>> > locale);
>> > >
>> > > //Find out what date to get from
>> > > getFrom = null;
>> > > prevMonthDays =
>> > tempCal.get(Calendar.DAY_OF_WEEK) -
>> > tempCal.getFirstDayOfWeek();
>> > > -if (prevMonthDays < 0) prevMonthDays = 7 +
>> > prevMonthDays;
>> > > -tempCal.add(Calendar.DATE,-(prevMonthDays));
>> > > +if (prevMonthDays < 0) prevMonthDays += 7;
>> > > +tempCal.add(Calendar.DATE, -prevMonthDays);
>> > > numDays += prevMonthDays;
>> > > getFrom = new
>> > Timestamp(tempCal.getTimeInMillis());
>> > > 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;
>> > > +lastWeekCal = UtilDateTime.toCalendar(end,
>> timeZone,
>> > locale);
>> > > +monthEndDay =
>> lastWeekCal.get(Calendar.DAY_OF_WEEK);
>> > > +getTo = UtilDateTime.getWeekEnd(end, timeZone,
>> > locale);
>> > > +lastWeekCal = UtilDateTime.toCalendar(getTo,
>> > timeZone, locale);
>> > > +followingMonthDays =
>> > lastWeekCal.get(Calendar.DAY_OF_WEEK) - monthEndDay;
>> > > +if (followingMonthDays < 0) {
>> > > + followingMonthDays += 7;
>> > > +}
>> > > +numDays += followingMonthDays;
>> > >
>> > > -serviceCtx = UtilMisc.toMap("userLogin",
>> userLogin,
>> > "start", getFrom,"numPeriods", new Integer(numDays),
>> > "periodType", new Integer(Calendar.DATE));
>> > > +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]);
>> > >
>> > >
>> > --
>> > Antwebsystems.com: Quality OFBiz services for
>> competitive
>> > rates
>> >
>> >
>>
>>
>>
>>
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Discussion: OFBiz Internationalization (was: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy)

Jacques Le Roux
Administrator
Sorry I cheked "concern" (I had a doubt has it's a false friend in French). I meaned your interest.

Jacques

From: "Jacques Le Roux" <[hidden email]>

> Hi Adrian,
>
> Thanks for the calendar fix and this reminder. I really appreciate your concern about OFBiz staying at forefront of global ERPs
> :o)
>
> Jacques
>
> From: "Adrian Crum" <[hidden email]>
>> The attached email is the motivation for this appeal.
>>
>> Developers - please keep in mind that OFBiz operates in multiple languages, time zones, currencies, and calendars. We can't
>> assume
>> anything in those regards.
>>
>> If you are going to work on any of those issues (time, date, currency, language) make sure you understand what you are doing.
>>
>> IBM has been doing this (internationalization) for decades and they have a Java library for it - ICU
>> (http://site.icu-project.org). Parts of the library are in use in OFBiz, but the main point is to understand the differences in
>> cultures, calendars, currencies, etc. The IBM ICU library is a good guide to enlighten you in internationalization.
>>
>> If you are a contributor or a committer, please spend some time to learn about internationalization. Doing so will keep OFBiz on
>> the forefront of global ERP.
>>
>> -Adrian
>>
>>
>> --- On Tue, 8/4/09, Adrian Crum <[hidden email]> wrote:
>>
>>> From: Adrian Crum <[hidden email]>
>>> Subject: Re: svn commit: r801024 - /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
>>> To: [hidden email]
>>> Date: Tuesday, August 4, 2009, 7:30 PM
>>>
>>> A good demo of the bug before the online demo is updated:
>>>
>>> Using the online demo, go to the work effort month view
>>> calendar. Click Next Month until you reach October. Notice
>>> the last week. Switch the locale to French and look at the
>>> last week again.
>>>
>>> -Adrian
>>>
>>>
>>> --- On Tue, 8/4/09, Hans Bakker <[hidden email]>
>>> wrote:
>>>
>>> > From: Hans Bakker <[hidden email]>
>>> > Subject: Re: svn commit: r801024 -
>>> /ofbiz/trunk/applications/workeffort/webapp/workeffort/WEB-INF/actions/calendar/Month.groovy
>>> > To: [hidden email]
>>> > Date: Tuesday, August 4, 2009, 6:35 PM
>>> > Thank you for your help Adrian.
>>> >
>>> > On Tue, 2009-08-04 at 23:40 +0000, [hidden email]
>>> > wrote:
>>> > > Author: adrianc
>>> > > Date: Tue Aug 4 23:40:00 2009
>>> > > New Revision: 801024
>>> > >
>>> > > URL: http://svn.apache.org/viewvc?rev=801024&view=rev
>>> > > Log:
>>> > > Fixed a bug in the Month view work effort
>>> calendar.
>>> > >
>>> > > 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=801024&r1=801023&r2=801024&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
>>> > Tue Aug 4 23:40:00 2009
>>> > > @@ -51,24 +51,30 @@
>>> > > context.prevMillis = new
>>> > Long(prev.getTime()).toString();
>>> > > next = UtilDateTime.getDayStart(start,
>>> > numDays+1, timeZone, locale);
>>> > > context.nextMillis = new
>>> > Long(next.getTime()).toString();
>>> > > -end = UtilDateTime.getDayStart(start, numDays,
>>> > timeZone, locale);
>>> > > +end = UtilDateTime.getMonthEnd(start, timeZone,
>>> > locale);
>>> > >
>>> > > //Find out what date to get from
>>> > > getFrom = null;
>>> > > prevMonthDays =
>>> > tempCal.get(Calendar.DAY_OF_WEEK) -
>>> > tempCal.getFirstDayOfWeek();
>>> > > -if (prevMonthDays < 0) prevMonthDays = 7 +
>>> > prevMonthDays;
>>> > > -tempCal.add(Calendar.DATE,-(prevMonthDays));
>>> > > +if (prevMonthDays < 0) prevMonthDays += 7;
>>> > > +tempCal.add(Calendar.DATE, -prevMonthDays);
>>> > > numDays += prevMonthDays;
>>> > > getFrom = new
>>> > Timestamp(tempCal.getTimeInMillis());
>>> > > 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;
>>> > > +lastWeekCal = UtilDateTime.toCalendar(end,
>>> timeZone,
>>> > locale);
>>> > > +monthEndDay =
>>> lastWeekCal.get(Calendar.DAY_OF_WEEK);
>>> > > +getTo = UtilDateTime.getWeekEnd(end, timeZone,
>>> > locale);
>>> > > +lastWeekCal = UtilDateTime.toCalendar(getTo,
>>> > timeZone, locale);
>>> > > +followingMonthDays =
>>> > lastWeekCal.get(Calendar.DAY_OF_WEEK) - monthEndDay;
>>> > > +if (followingMonthDays < 0) {
>>> > > + followingMonthDays += 7;
>>> > > +}
>>> > > +numDays += followingMonthDays;
>>> > >
>>> > > -serviceCtx = UtilMisc.toMap("userLogin",
>>> userLogin,
>>> > "start", getFrom,"numPeriods", new Integer(numDays),
>>> > "periodType", new Integer(Calendar.DATE));
>>> > > +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]);
>>> > >
>>> > >
>>> > --
>>> > Antwebsystems.com: Quality OFBiz services for
>>> competitive
>>> > rates
>>> >
>>> >
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
>