Author: jacopoc Date: Sat Sep 30 22:54:28 2006 New Revision: 451718 URL: http://svn.apache.org/viewvc?view=rev&rev=451718 Log: Applied patch from Scott Gray to fix bad usage of time variables. However I really think that many of the methods in this class can be replaced by more standard ones (the ones in the util classes of other components).
Modified: incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java Modified: incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java?view=diff&rev=451718&r1=451717&r2=451718 ============================================================================== --- incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java (original) +++ incubator/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java Sat Sep 30 22:54:28 2006 @@ -312,8 +312,7 @@ if (moveDay != 0) return 0; Time startTime = (Time) position.get("startTime"); Double capacity = (Double) position.get("capacity"); - // TODO after test (01:00:00).getTime() = 0 and not 3600000 so currently we add this value to be correct but it's needed to find why (maybe GMT pb) - Timestamp startAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateFrom).getTime() + startTime.getTime() + 3600000); + Timestamp startAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateFrom).getTime() + startTime.getTime() + cDateTrav.get(Calendar.ZONE_OFFSET) + cDateTrav.get(Calendar.DST_OFFSET)); if (dateFrom.before(startAvailablePeriod) ) return 0; Timestamp endAvailablePeriod = new Timestamp(startAvailablePeriod.getTime()+capacity.longValue()); if (dateFrom.after(endAvailablePeriod)) return 0; @@ -345,8 +344,7 @@ Time startTime = (Time) position.get("startTime"); int moveDay = ((Integer) position.get("moveDay")).intValue(); dateTo = (moveDay == 0) ? dateFrom : UtilDateTime.getDayStart(dateFrom,moveDay); - // TODO after test (01:00:00).getTime() = 0 and not 3600000 so currently we add this value to be correct but it's needed to find why (maybe GMT pb) - Timestamp startAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateTo).getTime() + startTime.getTime() + 3600000); + Timestamp startAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateTo).getTime() + startTime.getTime() + cDateTrav.get(Calendar.ZONE_OFFSET) + cDateTrav.get(Calendar.DST_OFFSET)); if (dateTo.before(startAvailablePeriod) ) { dateTo = startAvailablePeriod; } @@ -357,7 +355,7 @@ startTime = (Time) position.get("startTime"); moveDay = ((Integer) position.get("moveDay")).intValue(); if (moveDay != 0) dateTo = UtilDateTime.getDayStart(dateTo,moveDay); - dateTo.setTime(dateTo.getTime() + startTime.getTime() + 3600000); + dateTo.setTime(dateTo.getTime() + startTime.getTime() + cDateTrav.get(Calendar.ZONE_OFFSET) + cDateTrav.get(Calendar.DST_OFFSET)); } result.put("dateTo",dateTo); result.put("nextCapacity",position.get("capacity")); @@ -469,8 +467,7 @@ if (moveDay != 0) return 0; Time startTime = (Time) position.get("startTime"); Double capacity = (Double) position.get("capacity"); - //TODO after test (01:00:00).getTime() = 0 and not 3600000 so currently we add this value to be correct but it's needed to find why (maybe GMT pb) - Timestamp startAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateFrom).getTime() + startTime.getTime() + 3600000); + Timestamp startAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateFrom).getTime() + startTime.getTime() + cDateTrav.get(Calendar.ZONE_OFFSET) + cDateTrav.get(Calendar.DST_OFFSET)); if (dateFrom.before(startAvailablePeriod) ) return 0; Timestamp endAvailablePeriod = new Timestamp(startAvailablePeriod.getTime()+capacity.longValue()); if (dateFrom.after(endAvailablePeriod)) return 0; @@ -502,8 +499,7 @@ int moveDay = ((Integer) position.get("moveDay")).intValue(); Double capacity = (Double) position.get("capacity"); dateTo = (moveDay == 0) ? dateFrom : UtilDateTime.getDayEnd(dateFrom,moveDay); - //TODO after test (01:00:00).getTime() = 0 and not 3600000 so currently we add this value to be correct but it's needed to find why (maybe GMT pb) - Timestamp endAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateTo).getTime() + startTime.getTime() + 3600000 + capacity.longValue()); + Timestamp endAvailablePeriod = new Timestamp(UtilDateTime.getDayStart(dateTo).getTime() + startTime.getTime() + capacity.longValue() + cDateTrav.get(Calendar.ZONE_OFFSET) + cDateTrav.get(Calendar.DST_OFFSET)); if (dateTo.after(endAvailablePeriod) ) { dateTo = endAvailablePeriod; } @@ -515,7 +511,7 @@ moveDay = ((Integer) position.get("moveDay")).intValue(); capacity = (Double) position.get("capacity"); if (moveDay != 0) dateTo = UtilDateTime.getDayStart(dateTo,moveDay); - dateTo.setTime(dateTo.getTime() + startTime.getTime() + 3600000 + capacity.longValue()); + dateTo.setTime(dateTo.getTime() + startTime.getTime() + capacity.longValue() + cDateTrav.get(Calendar.ZONE_OFFSET) + cDateTrav.get(Calendar.DST_OFFSET)); } result.put("dateTo",dateTo); result.put("previousCapacity",position.get("capacity"));