7931: Fix check and repair tool for empty placerefs
This commit is contained in:
parent
b22b66877e
commit
4c71006c9d
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user