7931: Fix check and repair tool for empty placerefs

This commit is contained in:
Enno Borgsteede 2014-09-25 22:06:55 +01:00 committed by Nick Hall
parent b22b66877e
commit 4c71006c9d

View File

@ -1246,8 +1246,14 @@ class CheckIntegrity(object):
for bkey in llist:
key = handle2internal(bkey)
self.progress.step()
none_handle = False
newlist = []
place = self.db.get_place_from_handle(key)
for placeref in place.get_placeref_list():
newlist.append(placeref)
if placeref.ref is None:
none_handle = True
placeref.ref = create_id()
parent_place = self.db.get_place_from_handle(placeref.ref)
if not parent_place:
# The referenced place does not exist in the database
@ -1260,6 +1266,9 @@ class CheckIntegrity(object):
{'gid' : place.gramps_id,
'hand' : placeref.ref})
self.invalid_place_references.add(key)
if none_handle:
place.set_placeref_list(newlist);
self.db.commit_place(place, self.trans)
# check persons -> the LdsOrd references a place
for bkey in plist: