diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index e255dc032..29eead76f 100644 --- a/gramps2/ChangeLog +++ b/gramps2/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/gramps2/src/AddSpouse.py b/gramps2/src/AddSpouse.py index 8ac47c728..676ddd92a 100644 --- a/gramps2/src/AddSpouse.py +++ b/gramps2/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()