Commit 3f2213c1 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fix the problem : when we invoke an alarm manually, alarm table record is reset.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40403 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 67237161
...@@ -192,10 +192,11 @@ class PeriodicityMixin: ...@@ -192,10 +192,11 @@ class PeriodicityMixin:
periodicity_stop_date = self.getPeriodicityStopDate() periodicity_stop_date = self.getPeriodicityStopDate()
if next_start_date is None: if next_start_date is None:
next_start_date = current_date next_start_date = current_date
if next_start_date > current_date \ if periodicity_stop_date is not None \
or (periodicity_stop_date is not None \ and next_start_date >= periodicity_stop_date:
and next_start_date >= periodicity_stop_date):
return None return None
elif next_start_date > current_date:
return next_start_date
timezone = self._getTimezone(next_start_date) timezone = self._getTimezone(next_start_date)
previous_date = next_start_date previous_date = next_start_date
......
...@@ -150,6 +150,9 @@ class TestAlarm(ERP5TypeTestCase): ...@@ -150,6 +150,9 @@ class TestAlarm(ERP5TypeTestCase):
alarm.setNextAlarmDate(current_date=now) alarm.setNextAlarmDate(current_date=now)
next_date = addToDate(next_date,hour=1) next_date = addToDate(next_date,hour=1)
self.assertEquals(alarm.getAlarmDate(),next_date) self.assertEquals(alarm.getAlarmDate(),next_date)
# check if manual invoking does not break getAlarmDate() result.
alarm.activeSense()
self.assertEquals(alarm.getAlarmDate(),next_date)
def test_04_Every3Hours(self, quiet=0, run=run_all_test): def test_04_Every3Hours(self, quiet=0, run=run_all_test):
if not run: return if not run: return
......
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