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
result_list = self.Alarm_zGetAlarmDate(uid=self.getUid())
if len(result_list) == 1:
alarm_date = result_list[0].alarm_date
# But if the catalog does not have a valid one, replace it
# with the start date.
if alarm_date is None or alarm_date < periodicity_start_date:
alarm_date = periodicity_start_date
# Check if it is valid.
periodicity_stop_date = self.getPeriodicityStopDate()
if periodicity_stop_date is not None \
and alarm_date >= periodicity_stop_date:
alarm_date = None
else:
# convert the date to the user provided timezone
alarm_zone = periodicity_start_date.timezone()
alarm_date = alarm_date.toZone(alarm_zone)
# But if the catalog does not have a valid one, replace it
# with the start date.
if alarm_date is None or alarm_date < periodicity_start_date:
alarm_date = periodicity_start_date
# Check if it is valid.
periodicity_stop_date = self.getPeriodicityStopDate()
if periodicity_stop_date is not None \
and alarm_date >= periodicity_stop_date:
alarm_date = None
else:
# convert the date to the user provided timezone
alarm_zone = periodicity_start_date.timezone()
alarm_date = alarm_date.toZone(alarm_zone)
return alarm_date
# 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