3278: [Records plugin] Mariage calculation should only work with event_role=Family or primary

svn: r13456
This commit is contained in:
Jérôme Rapinat 2009-10-29 11:44:32 +00:00
parent 4c93a08c14
commit 0757d0821c

View File

@ -34,7 +34,8 @@ from TransUtils import sgettext as _
# GRAMPS modules
#
#------------------------------------------------------------------------
from gen.lib import ChildRefType, Date, EventType, Name
import gen.lib
from gen.lib import ChildRefType, Date, EventType, Name, EventRoleType
from gen.plug.docgen import FontStyle, ParagraphStyle, FONT_SANS_SERIF
from BasicUtils import name_displayer
from gen.plug import Gramplet
@ -136,9 +137,13 @@ def _find_records(db, filter, callname):
divorce_date = None
for event_ref in family.get_event_ref_list():
event = db.get_event_from_handle(event_ref.ref)
if event.get_type() == EventType.MARRIAGE:
if event.get_type() == gen.lib.EventType.MARRIAGE and \
(event_ref.get_role() == gen.lib.EventRoleType.FAMILY or
event_ref.get_role() == gen.lib.EventRoleType.PRIMARY ):
marriage_date = event.get_date_object()
elif event.get_type() == EventType.DIVORCE:
elif event.get_type() == gen.lib.EventType.DIVORCE and \
(event_ref.get_role() == gen.lib.EventRoleType.FAMILY or
event_ref.get_role() == gen.lib.EventRoleType.PRIMARY ):
divorce_date = event.get_date_object()
if _good_date(marriage_date):
@ -220,9 +225,13 @@ def _find_records(db, filter, callname):
divorce_date = None
for event_ref in family.get_event_ref_list():
event = db.get_event_from_handle(event_ref.ref)
if event.get_type() == EventType.MARRIAGE:
if event.get_type() == gen.lib.EventType.MARRIAGE and \
(event_ref.get_role() == gen.lib.EventRoleType.FAMILY or
event_ref.get_role() == gen.lib.EventRoleType.PRIMARY ):
marriage_date = event.get_date_object()
elif event.get_type() == EventType.DIVORCE:
if event and event.get_type() == gen.lib.EventType.DIVORCE and \
(event_ref.get_role() == gen.lib.EventRoleType.FAMILY or
event_ref.get_role() == gen.lib.EventRoleType.PRIMARY ):
divorce_date = event.get_date_object()
father_death_date = _find_death_date(db, father)