Suport FTM 2017 Gedcom tags on import

Bug #10285
FTM adds subordinate PLAC and OBJE data to INDI.ADDR which is
non-standard.  So treat it as a Residence Event, instead of an
Address.
FTM puts _DATE and _TEXT tags subordinate to OBJE, also non-standard.
This commit is contained in:
prculley 2017-12-12 16:06:16 -06:00 committed by Nick Hall
parent 59e367acf9
commit aa2a451f23
3 changed files with 44 additions and 12 deletions

View File

@ -1,7 +1,7 @@
0 HEAD
1 SOUR FTM
2 VERS Family Tree Maker (22.0.0.1410)
2 NAME Family Tree Maker for Windows
1 SOUR Tester
2 VERS 1.0
2 NAME The Tester
2 CORP Ancestry.com
3 ADDR 360 W 4800 N
4 CONT Provo, UT 84604

View File

@ -3,7 +3,7 @@
"http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
<database xmlns="http://gramps-project.org/xml/1.7.1/">
<header>
<created date="2016-10-23" version="5.0.0-alpha1"/>
<created date="2017-12-19" version="5.0.0-alpha3"/>
<researcher>
<resname>The Subm /Tester/</resname>
<resaddr>123 Main St.</resaddr>
@ -109,12 +109,12 @@
<source handle="_0000000300000003" change="1" id="S0000">
<stitle>Import from imp_FTM_LINK.ged</stitle>
<sauthor>The Tester</sauthor>
<srcattribute type="Approved system identification" value="FTM"/>
<srcattribute type="Version number of software product" value="Family Tree Maker (22.0.0.1410)"/>
<srcattribute type="Name of software product" value="Family Tree Maker for Windows"/>
<srcattribute type="Approved system identification" value="Tester"/>
<srcattribute type="Version number of software product" value="1.0"/>
<srcattribute type="Name of software product" value="The Tester"/>
<srcattribute type="Name of source data" value="FTM Source data"/>
<srcattribute type="Copyright of source data" value="Copyright 2999"/>
<srcattribute type="Generated By" value="Family Tree Maker for Windows Family Tree Maker (22.0.0.1410)"/>
<srcattribute type="Generated By" value="The Tester 1.0"/>
<srcattribute type="Creation date of GEDCOM" value="2016-03-01"/>
<srcattribute type="Character set and version" value="UTF-8 1.1"/>
<srcattribute type="GEDCOM version" value="5.5"/>
@ -206,7 +206,8 @@
Only one phone number supported Line 9: 3 PHON (800) 705-7000
Line ignored as not understood Line 15: 2 DATE 1111-01-01
GEDCOM FORM should be in uppercase Line 26: 2 FORM Lineage-Linked</text>
GEDCOM FORM should be in uppercase Line 26: 2 FORM Lineage-Linked
</text>
<style name="fontface" value="Monospace">
<range start="0" end="344"/>
</style>
@ -214,7 +215,8 @@ GEDCOM FORM should be in uppercase Line 26:
<note handle="_0000000600000006" change="1" id="N0001" type="GEDCOM import">
<text>Records not imported into SUBM (Submitter): (@SUBM@) The Subm /Tester/:
Only one phone number supported Line 35: 1 PHON 800-871-3401</text>
Only one phone number supported Line 35: 1 PHON 800-871-3401
</text>
<style name="fontface" value="Monospace">
<range start="0" end="173"/>
</style>
@ -234,7 +236,8 @@ Only one phone number supported Line 35:
<note handle="_0000001700000017" change="1" id="N0005" type="GEDCOM import">
<text>Records not imported into REPO (repository) Gramps ID R0002:
Only one phone number supported Line 93: 1 PHON 800-765-4321</text>
Only one phone number supported Line 93: 1 PHON 800-765-4321
</text>
<style name="fontface" value="Monospace">
<range start="0" end="162"/>
</style>

View File

@ -272,6 +272,8 @@ TOKEN__PHOTO = 132
TOKEN__LINK = 133
TOKEN__PRIM = 134
TOKEN__JUST = 135
TOKEN__TEXT = 136
TOKEN__DATE = 137
TOKENS = {
"_ADPN" : TOKEN__ADPN,
@ -282,7 +284,7 @@ TOKENS = {
"_CAT" : TOKEN_IGNORE,
"_CHUR" : TOKEN_IGNORE,
"_COMM" : TOKEN__COMM,
"_DATE" : TOKEN_IGNORE,
"_DATE" : TOKEN__DATE,
"_DATE2" : TOKEN_IGNORE,
"_DETAIL" : TOKEN_IGNORE,
"_EMAIL" : TOKEN_EMAIL,
@ -315,6 +317,7 @@ TOKENS = {
"_SCHEMA" : TOKEN__SCHEMA,
"_SSHOW" : TOKEN_IGNORE,
"_STAT" : TOKEN__STAT,
"_TEXT" : TOKEN__TEXT,
"_TODO" : TOKEN__TODO,
"_TYPE" : TOKEN_TYPE,
"_UID" : TOKEN__UID,
@ -1186,6 +1189,7 @@ class GedLine:
_MAP_DATA = {
TOKEN_UNKNOWN : GedLine.calc_unknown,
TOKEN_DATE : GedLine.calc_date,
TOKEN__DATE : GedLine.calc_date,
TOKEN_SEX : GedLine.calc_sex,
TOKEN_NOTE : GedLine.calc_note,
TOKEN_NCHI : GedLine.calc_nchi,
@ -2490,7 +2494,9 @@ class GedcomParser(UpdateCallback):
TOKEN_TITL : self.__obje_title,
TOKEN_FILE : self.__obje_file, # de-facto extension
TOKEN_TEXT : self.__obje_text, # FTM extension
TOKEN__TEXT : self.__obje_text, # FTM 2017 extension
TOKEN_DATE : self.__obje_date, # FTM extension
TOKEN__DATE : self.__obje_date, # FTM 2017 extension
TOKEN_NOTE : self.__obje_note,
TOKEN_RNOTE : self.__obje_note,
TOKEN_SOUR : self.__obje_sour,
@ -4081,6 +4087,9 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
if self.is_ftw:
self.__person_resi(line, state)
return
free_form = line.data
sub_state = CurrentState(level=state.level + 1)
@ -4092,6 +4101,26 @@ class GedcomParser(UpdateCallback):
self.__merge_address(free_form, sub_state.addr, line, state)
state.person.add_address(sub_state.addr)
def __person_resi(self, line, state):
"""
Parses GEDCOM ADDR tag, subordinate to the INDI tag, when sourced by
FTM. We treat this as a RESI event, because FTM puts standard event
details below the ADDR line.
n ADDR <ADDRESS_LINE> {0:1}
+1 <<EVENT_DETAIL>> {0:1} p.*
@param line: The current line in GedLine format
@type line: GedLine
@param state: The current state
@type state: CurrentState
"""
self.backoff = True # reprocess the current ADDR line
line.level += 1 # as if it was next level down
event_ref = self.__build_event_pair(state, EventType.RESIDENCE,
self.event_parse_tbl, '')
state.person.add_event_ref(event_ref)
def __person_phon(self, line, state):
"""
n PHON <PHONE_NUMBER> {0:3}