0005667: Merging notes with citation references fails (also merge media)

svn: r19252
This commit is contained in:
Tim G L Lyons 2012-04-06 17:16:54 +00:00
parent 26a8d1bf92
commit 5a642228c8
2 changed files with 12 additions and 2 deletions

View File

@ -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))

View File

@ -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))