* 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

@ -6,6 +6,10 @@
2006-11-20 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/RelLib/_Family.py (get_sourcref_child_list): The ChildRefs were missing
here. This now removes deleted Sources from ChildRefs.
* 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
2006-11-19 Don Allingham <don@gramps-project.org>
* src/Utils.py: probably_alive should onlyuse primary events

View File

@ -243,9 +243,9 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
if handle not in handle_list ]
self.parent_family_list = new_list
elif classname == 'Place':
new_list = [ordinance for ordinance in self.lds_ord_list
if ordinance.place not in handle_list]
self.lds_ord_list = new_list
for ordinance in self.lds_ord_list:
if ordinance.place in handle_list:
ordinance.place = None
def _replace_handle_reference(self, classname, old_handle, new_handle):
if classname == 'Event':

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()