From c29763c6f2fbcbd6e95ec090df6be54a0667b48d Mon Sep 17 00:00:00 2001 From: Tim G L Lyons Date: Fri, 6 Apr 2012 17:15:34 +0000 Subject: [PATCH] 0005667: Merging notes with citation references fails (also merge media) svn: r19251 --- src/Merge/mergemedia.py | 7 ++++++- src/Merge/mergenote.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Merge/mergemedia.py b/src/Merge/mergemedia.py index 83b77fb92..63991154f 100644 --- a/src/Merge/mergemedia.py +++ b/src/Merge/mergemedia.py @@ -29,7 +29,7 @@ Provide merge capabilities for media objects. # Gramps modules # #------------------------------------------------------------------------- -from gen.lib import Person, Family, Event, Source, Place +from gen.lib import Person, Family, Event, Source, Citation, Place from gen.db import DbTxn from gen.ggettext import sgettext as _ import const @@ -211,6 +211,11 @@ class MergeMediaQuery(object): assert(source.has_media_reference(old_handle)) source.replace_media_references(old_handle, new_handle) self.database.commit_source(source, trans) + elif class_name == Citation.__name__: + citation = self.database.get_citation_from_handle(handle) + assert(citation.has_media_reference(old_handle)) + citation.replace_media_references(old_handle, new_handle) + self.database.commit_citation(citation, trans) elif class_name == Place.__name__: place = self.database.get_place_from_handle(handle) assert(place.has_media_reference(old_handle)) diff --git a/src/Merge/mergenote.py b/src/Merge/mergenote.py index f362801fe..1d2226e40 100644 --- a/src/Merge/mergenote.py +++ b/src/Merge/mergenote.py @@ -29,7 +29,7 @@ Provide merge capabilities for notes. # Gramps modules # #------------------------------------------------------------------------- -from gen.lib import (Person, Family, Event, Place, Source, Repository, +from gen.lib import (Person, Family, Event, Place, Source, Citation, Repository, MediaObject) from gen.db import DbTxn from gen.ggettext import sgettext as _ @@ -224,6 +224,11 @@ class MergeNoteQuery(object): assert(source.has_note_reference(old_handle)) source.replace_note_references(old_handle, new_handle) self.database.commit_source(source, trans) + elif class_name == Citation.__name__: + citation = self.database.get_citation_from_handle(handle) + assert(citation.has_note_reference(old_handle)) + citation.replace_note_references(old_handle, new_handle) + self.database.commit_citation(citation, trans) elif class_name == Place.__name__: place = self.database.get_place_from_handle(handle) assert(place.has_note_reference(old_handle))