2404: Note in EventRef in old style XML-data turned into Person note on import (by Michiel Doede Nauta <m.d.nauta(at)hetnet(dot)nl>)

svn: r11157
This commit is contained in:
Jérôme Rapinat 2008-10-19 09:17:02 +00:00
parent b25dbbd922
commit f04ea9d5be

View File

@ -1377,6 +1377,8 @@ class GrampsParser(UpdateCallback):
self.note = gen.lib.Note()
self.note.handle = Utils.create_id()
self.note.format = int(attrs.get('format', gen.lib.Note.FLOWED))
# The order in this long if-then statement should reflect the
# DTD: most deeply nested elements come first.
if self.source_ref:
self.note.type.set(gen.lib.NoteType.SOURCEREF)
self.note.private = self.source_ref.private
@ -1401,6 +1403,12 @@ class GrampsParser(UpdateCallback):
elif self.name:
self.note.type.set(gen.lib.NoteType.PERSONNAME)
self.note.private = self.name.private
elif self.eventref:
self.note.type.set(gen.lib.NoteType.EVENTREF)
self.note.private = self.eventref.private
elif self.reporef:
self.note.type.set(gen.lib.NoteType.REPOREF)
self.note.private = self.reporef.private
elif self.source:
self.note.type.set(gen.lib.NoteType.SOURCE)
self.note.private = self.source.private
@ -1422,15 +1430,9 @@ class GrampsParser(UpdateCallback):
elif self.placeobj:
self.note.type.set(gen.lib.NoteType.PLACE)
self.note.private = self.placeobj.private
elif self.eventref:
self.note.type.set(gen.lib.NoteType.EVENTREF)
self.note.private = self.eventref.private
elif self.repo:
self.note.type.set(gen.lib.NoteType.REPO)
self.note.private = self.repo.private
elif self.reporef:
self.note.type.set(gen.lib.NoteType.REPOREF)
self.note.private = self.reporef.private
self.db.add_note(self.note, self.trans)
#set correct change time
@ -1441,6 +1443,8 @@ class GrampsParser(UpdateCallback):
handle = attrs['hlink'].replace('_', '')
self.db.check_note_from_handle(handle, self.trans, set_gid = False)
# The order in this long if-then statement should reflect the
# DTD: most deeply nested elements come first.
if self.source_ref:
self.source_ref.add_note(handle)
elif self.address:
@ -1457,6 +1461,10 @@ class GrampsParser(UpdateCallback):
self.photo.add_note(handle)
elif self.name:
self.name.add_note(handle)
elif self.eventref:
self.eventref.add_note(handle)
elif self.reporef:
self.reporef.add_note(handle)
elif self.source:
self.source.add_note(handle)
elif self.event:
@ -1471,12 +1479,8 @@ class GrampsParser(UpdateCallback):
self.family.add_note(handle)
elif self.placeobj:
self.placeobj.add_note(handle)
elif self.eventref:
self.eventref.add_note(handle)
elif self.repo:
self.repo.add_note(handle)
elif self.reporef:
self.reporef.add_note(handle)
def start_sourceref(self, attrs):
self.source_ref = gen.lib.SourceRef()
@ -2219,6 +2223,8 @@ class GrampsParser(UpdateCallback):
self.note.set_styledtext(gen.lib.StyledText(text, self.note_tags))
# The order in this long if-then statement should reflect the
# DTD: most deeply nested elements come first.
if self.address:
self.address.add_note(self.note.handle)
elif self.ord:
@ -2233,6 +2239,10 @@ class GrampsParser(UpdateCallback):
self.photo.add_note(self.note.handle)
elif self.name:
self.name.add_note(self.note.handle)
elif self.eventref:
self.eventref.add_note(self.note.handle)
elif self.reporef:
self.reporef.add_note(self.note.handle)
elif self.source:
self.source.add_note(self.note.handle)
elif self.event:
@ -2247,12 +2257,8 @@ class GrampsParser(UpdateCallback):
self.family.add_note(self.note.handle)
elif self.placeobj:
self.placeobj.add_note(self.note.handle)
elif self.eventref:
self.eventref.add_note(self.note.handle)
elif self.repo:
self.repo.add_note(self.note.handle)
elif self.reporef:
self.reporef.add_note(self.note.handle)
self.db.commit_note(self.note, self.trans, self.note.get_change_time())
self.note = None