Include death anniversaries as an option in the birthdays report
Added the optional ability to list the anniversry of peoples deaths in the birthday and anniversary report Resolves #3540
This commit is contained in:
parent
d6e9d62fad
commit
51a7ad9483
@ -92,10 +92,11 @@ class BirthdayReport(Report):
|
||||
self.relationships = mgobn('relationships')
|
||||
self.year = mgobn('year')
|
||||
self.country = mgobn('country')
|
||||
self.anniversaries = mgobn('anniversaries')
|
||||
self.maiden_name = mgobn('maiden_name')
|
||||
self.alive = mgobn('alive')
|
||||
self.birthdays = mgobn('birthdays')
|
||||
self.anniversaries = mgobn('anniversaries')
|
||||
self.death_anniversaries = mgobn('death_anniversaries')
|
||||
self.text1 = mgobn('text1')
|
||||
self.text2 = mgobn('text2')
|
||||
self.text3 = mgobn('text3')
|
||||
@ -406,6 +407,45 @@ class BirthdayReport(Report):
|
||||
if (self.alive and alive1 and alive2) or not self.alive:
|
||||
self.add_day_item(text, month, day, spouse)
|
||||
|
||||
death_ref = person.get_death_ref()
|
||||
death_date = None
|
||||
if death_ref:
|
||||
death_event = self.database.get_event_from_handle(death_ref.ref)
|
||||
death_date = death_event.get_date_object()
|
||||
|
||||
if (self.death_anniversaries and death_date is not None and death_date.is_valid()):
|
||||
death_date = gregorian(death_date)
|
||||
|
||||
year = death_date.get_year()
|
||||
month = death_date.get_month()
|
||||
day = death_date.get_day()
|
||||
|
||||
nyears = self.year - year
|
||||
|
||||
comment = ""
|
||||
if self.relationships:
|
||||
relation = rel_calc.get_one_relationship(
|
||||
self.database,
|
||||
self.center_person,
|
||||
person,
|
||||
olocale=self._locale)
|
||||
if relation:
|
||||
# FIXME this won't work for RTL languages
|
||||
comment = " --- %s" % relation
|
||||
yeartxt = ""
|
||||
if self.showyear:
|
||||
yeartxt = "(%s) " % year
|
||||
if nyears == 0:
|
||||
text = _('✝ {person}, death {relation}').format(person=short_name,relation=comment)
|
||||
else:
|
||||
text = ngettext('✝ {year}{person}, {age}{relation}',
|
||||
'✝ {year}{person}, {age}{relation}',
|
||||
nyears).format(year=yeartxt,
|
||||
person=short_name,
|
||||
age=nyears,
|
||||
relation=comment)
|
||||
self.add_day_item(text, month, day, person)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# BirthdayOptions
|
||||
@ -517,6 +557,10 @@ class BirthdayOptions(MenuReportOptions):
|
||||
anniversaries.set_help(_("Whether to include anniversaries"))
|
||||
menu.add_option(category_name, "anniversaries", anniversaries)
|
||||
|
||||
death_anniversaries = BooleanOption(_("Include death anniversaries"), True)
|
||||
death_anniversaries.set_help(_("Whether to include anniversaries of death"))
|
||||
menu.add_option(category_name, "death_anniversaries", death_anniversaries)
|
||||
|
||||
show_relships = BooleanOption(
|
||||
_("Include relationship to center person"), False)
|
||||
show_relships.set_help(
|
||||
|
Loading…
Reference in New Issue
Block a user