Fix Gedcom import so it doesn't create completely empty Birth events (#799)

Fixes #10145

Note: a completely empty birth event is removed by Check and Repair; this is wrong in that sometimes we know a person is born, but not date/place. In Gedcom this is indicated by "1 BIRT Y" lines.

So this PR adds a description to the birth event. This is not an issue for other event types, the C&R tool sees the non-default type and leaves it alone, but birth is the default type.
This commit is contained in:
Paul Culley 2019-03-17 00:51:15 -05:00 committed by Sam Manzi
parent 9a398cbcfd
commit 450217a636
2 changed files with 5 additions and 1 deletions

View File

@ -163,6 +163,7 @@
</event> </event>
<event handle="_0000005500000055" change="1" id="E0026"> <event handle="_0000005500000055" change="1" id="E0026">
<type>Birth</type> <type>Birth</type>
<description>No Date Information</description>
</event> </event>
<event handle="_0000005600000056" change="1" id="E0027"> <event handle="_0000005600000056" change="1" id="E0027">
<type>Death</type> <type>Death</type>
@ -1703,7 +1704,7 @@ Unknown tag Line 1109:
<range start="0" end="163"/> <range start="0" end="163"/>
</style> </style>
</note> </note>
<note handle="_000000f9000000f9" change="1551799781" id="N0036" type="General"> <note handle="_000000f9000000f9" change="1551800790" id="N0036" type="General">
<text>Objects referenced by this note were missing in a file imported on 12/25/1999 12:00:00 AM.</text> <text>Objects referenced by this note were missing in a file imported on 12/25/1999 12:00:00 AM.</text>
</note> </note>
</notes> </notes>

View File

@ -7827,6 +7827,9 @@ class GedcomParser(UpdateCallback):
sub_state.pf = self.place_parser sub_state.pf = self.place_parser
self.__parse_level(sub_state, event_map, self.__undefined) self.__parse_level(sub_state, event_map, self.__undefined)
if(description == 'Y' and event.date.is_empty() and
event.type == EventType.BIRTH and not event.place):
event.set_description(_("No Date Information"))
state.msg += sub_state.msg state.msg += sub_state.msg
self.__add_place(event, sub_state) self.__add_place(event, sub_state)