2007-09-26 James G. Sack <jgsack@san.rr.com>

* src/plugins/Check.py: same sex marriage need not be CIVIL_UNION, bug #1245
	This includes the 8374 commit which was not present in trunk (??)


svn: r9011
This commit is contained in:
Benny Malengier 2007-09-26 08:10:19 +00:00
parent bb2350ce9a
commit 1bcc55c733
2 changed files with 28 additions and 43 deletions

View File

@ -1,3 +1,7 @@
2007-09-26 James G. Sack <jgsack@san.rr.com>
* src/plugins/Check.py: same sex marriage need not be CIVIL_UNION, bug #1245
This includes the 8374 commit which was not present in trunk (??)
2007-09-26 Benny Malengier <benny.malengier@gramps-project.org>
* src/Selectors/_SelectNote.py:a note selector for the reports
* src/Selectors/Makefile.am: add selectNote

View File

@ -574,58 +574,39 @@ class CheckIntegrity:
self.db.remove_family(family_handle,self.trans)
def check_parent_relationships(self):
"""Repair father=female or mother=male in hetero families
"""
fhandle_list = self.db.get_family_handles()
self.progress.set_pass(_('Looking for broken parent relationships'),
len(fhandle_list))
for family_handle in fhandle_list:
self.progress.step()
family = self.db.get_family_from_handle(family_handle)
mother_handle = family.get_mother_handle()
father_handle = family.get_father_handle()
father = None
if father_handle:
father = self.db.get_person_from_handle(father_handle)
mother = None
if mother_handle:
mother = self.db.get_person_from_handle(mother_handle)
rel_type = family.get_relationship()
if not father_handle and not mother_handle:
continue
elif not father_handle:
if mother and mother.get_gender() == RelLib.Person.MALE:
# No father set and mother is male
family.set_father_handle(mother_handle)
family.set_mother_handle(None)
self.db.commit_family(family,self.trans)
elif not mother_handle:
if father and father.get_gender() == RelLib.Person.FEMALE:
# No mother set and father is female
family.set_mother_handle(father_handle)
family.set_father_handle(None)
self.db.commit_family(family,self.trans)
father_handle = family.get_father_handle()
if father_handle:
fgender = self.db.get_person_from_handle(father_handle
).get_gender()
else:
fgender = father.get_gender()
mgender = mother.get_gender()
if rel_type != RelLib.FamilyRelType.CIVIL_UNION:
if fgender == mgender and fgender != RelLib.Person.UNKNOWN:
family.set_relationship(RelLib.FamilyRelType.CIVIL_UNION)
self.fam_rel.append(family_handle)
self.db.commit_family(family,self.trans)
elif fgender == RelLib.Person.FEMALE or mgender == RelLib.Person.MALE:
family.set_father_handle(mother_handle)
family.set_mother_handle(father_handle)
self.fam_rel.append(family_handle)
self.db.commit_family(family,self.trans)
elif fgender != mgender:
family.set_relationship(RelLib.FamilyRelType.UNKNOWN)
self.fam_rel.append(family_handle)
if fgender == RelLib.Person.FEMALE or mgender == RelLib.Person.MALE:
family.set_father_handle(mother_handle)
family.set_mother_handle(father_handle)
self.db.commit_family(family,self.trans)
fgender = None
mother_handle = family.get_mother_handle()
if mother_handle:
mgender = self.db.get_person_from_handle(mother_handle
).get_gender()
else:
mgender = None
if (fgender == RelLib.Person.FEMALE \
or mgender == RelLib.Person.MALE) \
and fgender != mgender:
# swap. note: (at most) one handle may be None
family.set_father_handle(mother_handle)
family.set_mother_handle(father_handle)
self.db.commit_family(family,self.trans)
self.fam_rel.append(family_handle)
def check_events(self):
self.progress.set_pass(_('Looking for event problems'),