5054: ID format conversion creates duplicates

svn: r17884
This commit is contained in:
Michiel Nauta 2011-07-01 11:22:37 +00:00
parent 838d7845e1
commit cb3d1f8ce5
2 changed files with 8 additions and 5 deletions

View File

@ -775,12 +775,12 @@ class GrampsParser(UpdateCallback):
:rtype: str :rtype: str
""" """
gramps_id = id2user_format(id_) gramps_id = id2user_format(id_)
if gramps_id is None or not gramps_ids.get(gramps_id): if gramps_id is None or not gramps_ids.get(id_):
if gramps_id is None or self.db.has_gramps_id(key, gramps_id): if gramps_id is None or self.db.has_gramps_id(key, gramps_id):
gramps_ids[gramps_id] = find_next_gramps_id() gramps_ids[id_] = find_next_gramps_id()
else: else:
gramps_ids[gramps_id] = gramps_id gramps_ids[id_] = gramps_id
return gramps_ids[gramps_id] return gramps_ids[id_]
def parse(self, ifile, linecount=0, personcount=0): def parse(self, ifile, linecount=0, personcount=0):
""" """

View File

@ -199,7 +199,10 @@ class ReorderIds(tool.BatchTool):
newgramps_id = prefix % int(index) newgramps_id = prefix % int(index)
if newgramps_id == gramps_id: if newgramps_id == gramps_id:
newids[newgramps_id] = gramps_id if newgramps_id in newids:
dups.append(obj.get_handle())
else:
newids[newgramps_id] = gramps_id
elif find_from_id(newgramps_id) is not None: elif find_from_id(newgramps_id) is not None:
dups.append(obj.get_handle()) dups.append(obj.get_handle())
else: else: