* src/SelectChild.py (on_save_child_clicked): Corrections.

svn: r3096
This commit is contained in:
Alex Roitman 2004-04-22 01:48:47 +00:00
parent c518c0fd66
commit cd5e0d9a37
2 changed files with 16 additions and 7 deletions

View File

@ -1,3 +1,6 @@
2004-04-21 Alex Roitman <shura@alex.neuro.umn.edu>
* src/SelectChild.py (on_save_child_clicked): Corrections.
2004-04-20 Alex Roitman <shura@alex.neuro.umn.edu>
* src/ChooseParents.py: Disallow selecting self as a parent.

View File

@ -277,6 +277,12 @@ class SelectChild:
id = idlist[0]
select_child = self.db.get_person(id)
if self.person.get_id() == id:
ErrorDialog(_("Error selecting a child"),
_("A person cannot be linked as his/her own child"),
self.top)
return
if self.family == None:
self.family = self.db.new_family()
self.person.add_family_id(self.family.get_id())
@ -285,8 +291,14 @@ class SelectChild:
else:
self.family.set_mother_id(self.person)
if id in (self.family.get_father_id(),self.family.get_mother_id()):
ErrorDialog(_("Error selecting a child"),
_("A person cannot be linked as his/her own child"),
self.top)
return
self.family.add_child_id(select_child.get_id())
mrel = const.child_relations.find_value(self.mrel.get_text())
mother = self.db.find_person_from_id(self.family.get_mother_id())
if mother and mother.get_gender() != RelLib.Person.female:
@ -301,12 +313,6 @@ class SelectChild:
select_child.add_parent_family_id(self.family.get_id(),mrel,frel)
if id in (self.family.get_father_id(),self.family.get_mother_id()):
ErrorDialog(_("Error selecting a child"),
_("A person cannot be linked as his/her own child"),
self.top)
return
trans = self.db.start_transaction()
self.db.commit_person(select_child,trans)
self.db.add_transaction(trans)