Commit c2dea837 authored by Łukasz Nowak's avatar Łukasz Nowak

- fix condition for alarm not being configured in alarm table

Alarm can be recognised as replaceable in catalog in two cases:

 * if alarm_date from catalog is empty (existing case)
 * if alarm is not existing in catalog yet (case added by changing indentation)

Second case happens during first indexation.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31573 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 684d15db
...@@ -583,20 +583,21 @@ Alarm Tool Node: %s ...@@ -583,20 +583,21 @@ Alarm Tool Node: %s
result_list = self.Alarm_zGetAlarmDate(uid=self.getUid()) result_list = self.Alarm_zGetAlarmDate(uid=self.getUid())
if len(result_list) == 1: if len(result_list) == 1:
alarm_date = result_list[0].alarm_date alarm_date = result_list[0].alarm_date
# But if the catalog does not have a valid one, replace it # But if the catalog does not have a valid one, replace it
# with the start date. # with the start date.
if alarm_date is None or alarm_date < periodicity_start_date: if alarm_date is None or alarm_date < periodicity_start_date:
alarm_date = periodicity_start_date alarm_date = periodicity_start_date
# Check if it is valid. # Check if it is valid.
periodicity_stop_date = self.getPeriodicityStopDate() periodicity_stop_date = self.getPeriodicityStopDate()
if periodicity_stop_date is not None \ if periodicity_stop_date is not None \
and alarm_date >= periodicity_stop_date: and alarm_date >= periodicity_stop_date:
alarm_date = None alarm_date = None
else: else:
# convert the date to the user provided timezone # convert the date to the user provided timezone
alarm_zone = periodicity_start_date.timezone() alarm_zone = periodicity_start_date.timezone()
alarm_date = alarm_date.toZone(alarm_zone) alarm_date = alarm_date.toZone(alarm_zone)
return alarm_date return alarm_date
# XXX there seem to be something which wants to call setters against # XXX there seem to be something which wants to call setters against
......
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