From 389732b8ea231d2ace672dbe08ee8d257d4badb7 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 22 Apr 2004 01:48:47 +0000 Subject: [PATCH] * src/SelectChild.py (on_save_child_clicked): Corrections. svn: r3096 --- gramps2/ChangeLog | 3 +++ gramps2/src/SelectChild.py | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index b39212b10..16216d0ba 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,6 @@ +2004-04-21 Alex Roitman + * src/SelectChild.py (on_save_child_clicked): Corrections. + 2004-04-20 Alex Roitman * src/ChooseParents.py: Disallow selecting self as a parent. diff --git a/gramps2/src/SelectChild.py b/gramps2/src/SelectChild.py index d7b2b1d4e..5f968b125 100644 --- a/gramps2/src/SelectChild.py +++ b/gramps2/src/SelectChild.py @@ -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)