Make sure surnames are saved in a way that makes sense:
* no empty surnames if more than one * one primary surname Clean up whitespace svn: r16444
This commit is contained in:
parent
0f15f446e9
commit
92f3ec3dfe
@ -839,7 +839,21 @@ class EditPerson(EditPrimary):
|
||||
"enter data or cancel the edit."))
|
||||
self.ok_button.set_sensitive(True)
|
||||
return
|
||||
# fix surname problems
|
||||
for name in [self.obj.get_primary_name()] + self.obj.get_alternate_names():
|
||||
if len(name.get_surname_list()) > 1:
|
||||
newlist = [surn for surn in name.get_surname_list() if not surn.is_empty()]
|
||||
if len(newlist) != len(name.get_surname_list()):
|
||||
name.set_surname_list(newlist)
|
||||
if len(name.get_surname_list()) == 0:
|
||||
name.set_surname_list([gen.lib.Surname()])
|
||||
try:
|
||||
primind = [surn.get_primary() for surn in name.get_surname_list()].index(True)
|
||||
except ValueError:
|
||||
primind = 0 # no match
|
||||
name.set_primary_surname(primind)
|
||||
|
||||
# fix ide problems
|
||||
(uses_dupe_id, id) = self._uses_duplicate_id()
|
||||
if uses_dupe_id:
|
||||
prim_object = self.get_from_gramps_id(id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user