From 3e9026bba7b2497dd2e067c6d249af9a12c0a4a5 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 10 Dec 2003 02:07:05 +0000 Subject: [PATCH] * src/plugins/WriteGedcom.py (export_data): Correct researcher's PHON field; (write_person): Correct exported PHON fields. * src/plugins/ReadGedcom.py (parse_residence): Remove PHON field since it is taken care of by parse_address() now; (parse_address): Parse PHON field, provided it immediately follows ADDR structure. svn: r2489 --- ChangeLog | 6 ++++++ src/plugins/ReadGedcom.py | 9 ++++----- src/plugins/WriteGedcom.py | 8 +++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f664e3ae..f5da30fb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2003-12-09 Alex Roitman * doc/gramps-manual/ru/getstart.xml: Translation update. + * src/plugins/WriteGedcom.py (export_data): Correct researcher's + PHON field; (write_person): Correct exported PHON fields. + * src/plugins/ReadGedcom.py (parse_residence): Remove PHON field since + it is taken care of by parse_address() now; + (parse_address): Parse PHON field, provided it immediately follows + ADDR structure. 2003-12-08 Don Allingham * src/RelLib.py: Add phone to address, postal code and phone to diff --git a/src/plugins/ReadGedcom.py b/src/plugins/ReadGedcom.py index bf1fdf938..06c4fb39b 100644 --- a/src/plugins/ReadGedcom.py +++ b/src/plugins/ReadGedcom.py @@ -1054,8 +1054,6 @@ class GedcomParser: elif matches[1] == "PLAC": address.setStreet(matches[2]) self.parse_address(address,level+1) - elif matches[1] == "PHON": - pass elif matches[1] == "NOTE": note = self.parse_note(matches,address,level+1,note) else: @@ -1067,7 +1065,10 @@ class GedcomParser: while 1: matches = self.get_next() if int(matches[0]) < level: - self.backup() + if matches[1] == "PHON": + address.setPhone(matches[2]) + else: + self.backup() return elif matches[1] in [ "ADDR", "ADR1", "ADR2" ]: val = address.getStreet() @@ -1080,8 +1081,6 @@ class GedcomParser: address.setStreet(val) elif matches[1] == "CITY": address.setCity(matches[2]) - elif matches[1] == "PHON": - address.setNote(matches[2]) elif matches[1] == "STAE": address.setState(matches[2]) elif matches[1] == "POST": diff --git a/src/plugins/WriteGedcom.py b/src/plugins/WriteGedcom.py index b0b7e0842..a73a81e6d 100644 --- a/src/plugins/WriteGedcom.py +++ b/src/plugins/WriteGedcom.py @@ -630,11 +630,10 @@ class GedcomWriter: if owner.getCountry(): self.writeln("2 CONT %s" % self.cnvtxt(owner.getCountry())) cnt = 1 - if owner.getPhone(): - self.writeln("2 PHON %s" % self.cnvtxt(owner.getPhone())) - cnt = 1 if cnt == 0: self.writeln('2 CONT Not Provided') + if owner.getPhone(): + self.writeln("1 PHON %s" % self.cnvtxt(owner.getPhone())) else: self.writeln('1 ADDR Not Provided') self.writeln('2 CONT Not Provided') @@ -933,12 +932,15 @@ class GedcomWriter: self.writeln("3 POST %s" % self.cnvtxt(addr.getPostal())) if addr.getCountry(): self.writeln("3 CTRY %s" % self.cnvtxt(addr.getCountry())) + if addr.getPhone(): + self.writeln("2 PHON %s" % self.cnvtxt(addr.getPhone())) else: text = addr.getStreet() text = addr_append(text,addr.getCity()) text = addr_append(text,addr.getState()) text = addr_append(text,addr.getPostal()) text = addr_append(text,addr.getCountry()) + text = addr_append(text,addr.getPhone()) if text: self.writeln("2 PLAC %s" % string.replace(self.cnvtxt(text),'\r',' ')) if addr.getNote():