* src/RelLib/_Person.py (_remove_handle_references): When removing a place dont delete the whole LdsOrd but only unset its place reference.

* src/plugins/Check.py (check_place_references): Add checks for LdsOrd inside Person and Family



svn: r7658
This commit is contained in:
Martin Hawlisch
2006-11-20 15:26:38 +00:00
parent e6edf76240
commit 6123c67283
3 changed files with 35 additions and 6 deletions

View File

@ -677,11 +677,36 @@ class CheckIntegrity:
self.invalid_person_references.append(key)
def check_place_references(self):
plist = self.db.get_person_handles()
flist = self.db.get_family_handles()
elist = self.db.get_event_handles()
self.progress.set_pass(_('Looking for place reference problems'),
len(elist))
len(elist)+len(plist)+len(flist))
# check persons -> the LdsOrd references a place
for key in plist:
person = self.db.get_person_from_handle(key)
for ordinance in person.lds_ord_list:
place_handle = ordinance.get_place_handle()
if place_handle:
place = self.db.get_place_from_handle(place_handle)
if not place:
# The referenced place does not exist in the database
ordinance.set_place_handle("")
self.db.commit_person(person,self.trans)
self.invalid_place_references.append(key)
# check families -> the LdsOrd references a place
for key in flist:
family = self.db.get_family_from_handle(key)
for ordinance in family.lds_ord_list:
place_handle = ordinance.get_place_handle()
if place_handle:
place = self.db.get_place_from_handle(place_handle)
if not place:
# The referenced place does not exist in the database
ordinance.set_place_handle("")
self.db.commit_family(family,self.trans)
self.invalid_place_references.append(key)
# check events
for key in elist:
event = self.db.get_event_from_handle(key)
place_handle = event.get_place_handle()