5027: After export to XML and Import into new DB all surnames become primary
svn: r17819
This commit is contained in:
parent
0fa4b5a5ad
commit
f7aea3022d
@ -1554,7 +1554,7 @@ class GrampsParser(UpdateCallback):
|
|||||||
def start_surname(self, attrs):
|
def start_surname(self, attrs):
|
||||||
self.surname = gen.lib.Surname()
|
self.surname = gen.lib.Surname()
|
||||||
self.surname.set_prefix(attrs.get("prefix", ""))
|
self.surname.set_prefix(attrs.get("prefix", ""))
|
||||||
self.surname.set_primary(bool(attrs.get("prim", 1)))
|
self.surname.set_primary(attrs.get("prim", "1") == "1")
|
||||||
self.surname.set_connector(attrs.get("connector", ""))
|
self.surname.set_connector(attrs.get("connector", ""))
|
||||||
origin_type = attrs.get("derivation", "")
|
origin_type = attrs.get("derivation", "")
|
||||||
self.surname.origintype.set_from_xml_str(origin_type)
|
self.surname.origintype.set_from_xml_str(origin_type)
|
||||||
@ -2621,8 +2621,11 @@ class GrampsParser(UpdateCallback):
|
|||||||
self.surname = None
|
self.surname = None
|
||||||
|
|
||||||
def stop_surname(self, tag):
|
def stop_surname(self, tag):
|
||||||
|
"""Add surname to name, validating only one primary."""
|
||||||
if self.name:
|
if self.name:
|
||||||
self.surname.set_surname(tag)
|
self.surname.set_surname(tag)
|
||||||
|
if any(sname.get_primary() for sname in self.name.get_surname_list()):
|
||||||
|
self.surname.set_primary(False)
|
||||||
self.name.add_surname(self.surname)
|
self.name.add_surname(self.surname)
|
||||||
self.surname = None
|
self.surname = None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user