7089: same bug in 3 more reports
Port r23211-r23213 from gramps34. svn: r23214
This commit is contained in:
parent
08dc8ffc53
commit
659f1bec17
@ -1869,3 +1869,10 @@ def lookup_calendar(calendar):
|
||||
return pos
|
||||
raise AttributeError("invalid calendar: '%s'" % calendar)
|
||||
|
||||
def gregorian(date):
|
||||
"""Convert given date to gregorian. Doesn't modify the original object."""
|
||||
if date.get_calendar() != Date.CAL_GREGORIAN:
|
||||
date = Date(date)
|
||||
date.convert_calendar(Date.CAL_GREGORIAN)
|
||||
return date
|
||||
|
||||
|
@ -54,6 +54,7 @@ from gramps.gen.plug.report import stdoptions
|
||||
from gramps.gen.utils.alive import probably_alive
|
||||
from gramps.gen.datehandler import displayer as _dd, long_days
|
||||
from gramps.gen.lib import Date, EventRoleType, EventType, Name, NameType, Person, Surname
|
||||
from gramps.gen.lib.date import gregorian
|
||||
|
||||
import gramps.plugins.lib.libholiday as libholiday
|
||||
from gramps.plugins.lib.libholiday import g2iso
|
||||
@ -285,6 +286,8 @@ class Calendar(Report):
|
||||
birth_date = birth_event.get_date_object()
|
||||
|
||||
if (self.birthdays and birth_date is not None and birth_date.is_valid()):
|
||||
birth_date = gregorian(birth_date)
|
||||
|
||||
year = birth_date.get_year()
|
||||
month = birth_date.get_month()
|
||||
day = birth_date.get_day()
|
||||
@ -366,6 +369,8 @@ class Calendar(Report):
|
||||
event_obj = event.get_date_object()
|
||||
|
||||
if event_obj.is_valid():
|
||||
event_obj = gregorian(event_obj)
|
||||
|
||||
year = event_obj.get_year()
|
||||
month = event_obj.get_month()
|
||||
day = event_obj.get_day()
|
||||
|
@ -46,7 +46,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
# Person and relation types
|
||||
from gramps.gen.lib import Person, FamilyRelType, EventType, EventRoleType
|
||||
from gramps.gen.lib.date import Date
|
||||
from gramps.gen.lib.date import Date, gregorian
|
||||
# gender and report type names
|
||||
from gramps.gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
|
||||
FONT_SANS_SERIF, FONT_SERIF,
|
||||
@ -669,6 +669,8 @@ class Extract(object):
|
||||
if birth:
|
||||
birthdate = birth.get_date_object()
|
||||
if birthdate.get_year_valid():
|
||||
birthdate = gregorian(birthdate)
|
||||
|
||||
year = birthdate.get_year()
|
||||
if not (year >= year_from and year <= year_to):
|
||||
continue
|
||||
@ -677,8 +679,11 @@ class Extract(object):
|
||||
death = self.get_death(person)
|
||||
if death:
|
||||
deathdate = death.get_date_object()
|
||||
if deathdate.get_year_valid() and deathdate.get_year() < year_from:
|
||||
continue
|
||||
if deathdate.get_year_valid():
|
||||
deathdate = gregorian(deathdate)
|
||||
|
||||
if deathdate.get_year() < year_from:
|
||||
continue
|
||||
if not no_years:
|
||||
# do not accept people who are not known to be in range
|
||||
continue
|
||||
|
@ -42,6 +42,7 @@ from gramps.gen.const import URL_HOMEPAGE
|
||||
from gramps.gen.display.name import displayer as global_name_display
|
||||
from gramps.gen.errors import ReportError
|
||||
from gramps.gen.lib import NameType, EventType, Name, Date, Person, Surname
|
||||
from gramps.gen.lib.date import gregorian
|
||||
from gramps.gen.relationship import get_relationship_calculator
|
||||
from gramps.gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
|
||||
FONT_SERIF, PARA_ALIGN_RIGHT,
|
||||
@ -277,6 +278,8 @@ class BirthdayReport(Report):
|
||||
birth_date = birth_event.get_date_object()
|
||||
|
||||
if (self.birthdays and birth_date is not None and birth_date.is_valid()):
|
||||
birth_date = gregorian(birth_date)
|
||||
|
||||
year = birth_date.get_year()
|
||||
month = birth_date.get_month()
|
||||
day = birth_date.get_day()
|
||||
@ -364,6 +367,8 @@ class BirthdayReport(Report):
|
||||
for event_ref in fam.get_event_ref_list():
|
||||
event = self.database.get_event_from_handle(event_ref.ref)
|
||||
event_obj = event.get_date_object()
|
||||
if event_obj is not Date.EMPTY and event_obj.is_valid():
|
||||
event_obj = gregorian(event_obj)
|
||||
year = event_obj.get_year()
|
||||
month = event_obj.get_month()
|
||||
day = event_obj.get_day()
|
||||
|
@ -71,6 +71,8 @@ from gramps.plugins.lib.libhtml import Html, xml_lang
|
||||
from gramps.plugins.lib.libhtmlconst import _CHARACTER_SETS, _CC, _COPY_OPTIONS
|
||||
from gramps.gui.pluginmanager import GuiPluginManager
|
||||
|
||||
from gramps.gen.lib.date import gregorian
|
||||
|
||||
# import styled notes from
|
||||
# src/plugins/lib/libhtmlbackend.py
|
||||
from gramps.plugins.lib.libhtmlbackend import HtmlBackend
|
||||
@ -1727,10 +1729,3 @@ def get_day_list(event_date, holiday_list, bday_anniv_list):
|
||||
|
||||
# return to its caller calendar_build()
|
||||
return day_list
|
||||
|
||||
def gregorian(date):
|
||||
"""Convert given date to gregorian. Doesn't modify the original object."""
|
||||
if date.get_calendar() != Date.CAL_GREGORIAN:
|
||||
date = Date(date)
|
||||
date.convert_calendar(Date.CAL_GREGORIAN)
|
||||
return date
|
||||
|
Loading…
Reference in New Issue
Block a user