From c0bc367b86488e27a6723d74571a48a13f548582 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 10 Mar 2005 04:57:22 +0000 Subject: [PATCH] * src/AddSpouse.py (select_spouse_clicked): Prevent adding child of the family as a spouse in that family. svn: r4154 --- ChangeLog | 2 ++ src/AddSpouse.py | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e255dc032..29eead76f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,8 @@ * src/EditPlace.py: Typo. * src/FamilyView.py: Correct constants for birth relationship. + * src/AddSpouse.py (select_spouse_clicked): Prevent adding child + of the family as a spouse in that family. 2005-03-09 Don Allingham * src/NameEdit.py: assign date on close diff --git a/src/AddSpouse.py b/src/AddSpouse.py index 8ac47c728..676ddd92a 100644 --- a/src/AddSpouse.py +++ b/src/AddSpouse.py @@ -55,6 +55,7 @@ import PeopleModel import Date import Marriage import NameDisplay +from QuestionDialog import ErrorDialog #------------------------------------------------------------------------- # @@ -245,10 +246,18 @@ class AddSpouse: # don't do anything if the marriage already exists for f in self.person.get_family_handle_list(): fam = self.db.get_family_from_handle(f) - if spouse_id == fam.get_mother_handle() or \ - spouse_id == fam.get_father_handle(): - Utils.destroy_passed_object(obj) - return + if fam: + if spouse_id in \ + (fam.get_mother_handle(),fam.get_father_handle()): + ErrorDialog(_("Error adding a spouse"), + _("The spouse is already present in this family")) + Utils.destroy_passed_object(obj) + return + if spouse_id in fam.get_child_handle_list(): + ErrorDialog(_("Error adding a spouse"), + _("A person cannot be linked as his/her own parent")) + Utils.destroy_passed_object(obj) + return trans = self.db.transaction_begin()