From 96a9dda07e69be8af3330011eadcc2dac226009a Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 26 Nov 2006 22:34:02 +0000 Subject: [PATCH] * src/Merge/_MergePerson.py: fixed check_for_child function to handle childrefs svn: r7713 --- ChangeLog | 1 + src/Merge/_MergePerson.py | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91ec98400..b8c285478 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ 2006-11-26 Don Allingham + * src/Merge/_MergePerson.py: fixed check_for_child function to handle childrefs * po/gramps.pot: updated 2006-11-26 Alex Roitman diff --git a/src/Merge/_MergePerson.py b/src/Merge/_MergePerson.py index 8fb7aca84..243d83a3e 100644 --- a/src/Merge/_MergePerson.py +++ b/src/Merge/_MergePerson.py @@ -83,7 +83,6 @@ class PersonCompare(ManagedWindow.ManagedWindow): GrampsDisplay.help('adv-merge-people') def merge(self,obj): - if check_for_spouse(self.p1,self.p2): QuestionDialog.ErrorDialog( _("Cannot merge people"), @@ -245,10 +244,10 @@ def check_for_spouse(p1, p2): def check_for_child(p1, p2): fs1 = sets.Set(p1.get_family_handle_list()) - fp1 = sets.Set(map(lambda x: x[0], p1.get_parent_family_handle_list())) + fp1 = sets.Set(p1.get_parent_family_handle_list()) fs2 = sets.Set(p2.get_family_handle_list()) - fp2 = sets.Set(map(lambda x: x[0], p2.get_parent_family_handle_list())) + fp2 = sets.Set(p2.get_parent_family_handle_list()) return len(fs1.intersection(fp2)) != 0 or len(fs2.intersection(fp1)) @@ -261,6 +260,21 @@ class MergePeopleUI(ManagedWindow.ManagedWindow): def __init__(self, dbstate, uistate, person1, person2, update=None): + if check_for_spouse(person1, person2): + QuestionDialog.ErrorDialog( + _("Cannot merge people"), + _("Spouses cannot be merged. To merge these people, " + "you must first break the relationship between them.")) + return + + if check_for_child(person1, person2): + QuestionDialog.ErrorDialog( + _("Cannot merge people"), + _("A parent and child cannot be merged. To merge these " + "people, you must first break the relationship between " + "them.")) + return + ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__) glade = gtk.glade.XML(const.merge_glade, 'merge_people') @@ -329,7 +343,7 @@ class MergePeople: self.db = db self.p1 = person1 self.p2 = person2 - + def copy_note(self,one,two): text1 = one.get_note() text2 = two.get_note() @@ -369,6 +383,7 @@ class MergePeople: Finally, the merged person is delete from the database and the entire transaction is committed. """ + self.debug_person(self.p1, "P1") self.debug_person(self.p2, "P2")