5054: ID format conversion creates duplicates

svn: r17885
This commit is contained in:
Michiel Nauta 2011-07-01 11:23:53 +00:00
parent 17cb8d8fe8
commit 5cd666ca53
2 changed files with 8 additions and 5 deletions

View File

@ -775,12 +775,12 @@ class GrampsParser(UpdateCallback):
:rtype: str
"""
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):
gramps_ids[gramps_id] = find_next_gramps_id()
gramps_ids[id_] = find_next_gramps_id()
else:
gramps_ids[gramps_id] = gramps_id
return gramps_ids[gramps_id]
gramps_ids[id_] = gramps_id
return gramps_ids[id_]
def parse(self, ifile, linecount=0, personcount=0):
"""

View File

@ -199,7 +199,10 @@ class ReorderIds(tool.BatchTool):
newgramps_id = prefix % int(index)
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:
dups.append(obj.get_handle())
else: