Commit 751ba999 authored by Romain Courteaud's avatar Romain Courteaud

Check if duration between stop_date and start_date is positiv.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17266 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 58ad420e
......@@ -144,6 +144,7 @@ class PresencePeriod(Movement, PeriodicityMixin):
periodicity_stop_date = self.getPeriodicityStopDate(
start_date)
second_duration = int(stop_date) - int(start_date)
if second_duration > 0:
# First date has to respect the periodicity config
next_start_date = self.getNextPeriodicalDate(start_date-1)
while (next_start_date is not None) and \
......@@ -162,7 +163,7 @@ class PresencePeriod(Movement, PeriodicityMixin):
elif (current_exception_date is not None) and \
(current_exception_date < next_start_date.Date()):
# SQL method don't like iterator
# yield (next_start_date, next_start_date+duration)
# yield (next_start_date, next_start_date+duration)
result.append([next_start_date,
addToDate(next_start_date, second=second_duration)])
# Update the next exception date
......@@ -172,7 +173,7 @@ class PresencePeriod(Movement, PeriodicityMixin):
current_exception_date = None
else:
# SQL method don't like iterator
# yield (next_start_date, next_start_date+duration)
# yield (next_start_date, next_start_date+duration)
result.append([next_start_date,
addToDate(next_start_date, second=second_duration)])
next_start_date = self.getNextPeriodicalDate(next_start_date)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment