#2810 Edit existing shared note can break GEDCOM

v4.2.3
open
nobody
None
5
2010-05-23
2010-05-23
Phil
No

Editing a shared note where the number of lines in the note changes does not work properly.

Environment: PhpGedView 4.2.3; Ubuntu 10.0 (Lusty Lynx); XAMPP
1.7.3a; PHP Version 5.3.1; MySQL version 5.1.41; Access over local lan
using FireFox 3.6.3 from Windows XP SP3; Basic (default) install all
around, except added a couple of languages in PhpGedView. For this bug, I do not think any of that other than the PhpGedView version are likely to be important.

If one or more lines are deleted from the end of the note, and updates accepted, it looks like the note was not even editted. If lines are removed from the middle of the note, the following lines 'move up' to replace the deleted lines, but the old lines that were at the end of the note are also left behind. Example:
Starting:
test note
line 1
line 2
line 3
line 4
Change to:
test note
line 3
line 4
Results:
test note
line 3
line 4
line 3
line 4
Line 1 and 2 were deleted, during processing line 3 replaced line 1, line 4 replaced line 2, but the original line 3 and 4 were 'left in place'. This case does not actually break the GEDCOM, but a minor variaion does.

An existing note has a CHAN structure appended (4 lines: CHAN DATE TIME _PGVU). Sample:
0 @N1@ NOTE test note
1 CONT line 1
1 CHAN
2 DATE 23 MAY 2010
3 TIME 00:48:35
2 _pgvu me

Editing shows only the first 2 lines of that, and adding a single line to show:
test note
line 1
added line
results in:
0 @N1@ NOTE test note
1 CONT line 1
1 CONT added line
2 DATE 23 MAY 2010
3 TIME 00:48:35
2 _pgvu me
1 CHAN
2 DATE 23 MAY 2010
3 TIME 00:55:52
2 _pgvu me
because the update processing wrote '1 CONT added line' over top of '1 CHAN', then because it could not find an existing CHAN structure, appended a complete new structure to the end of the note. THAT breaks the GEDCOM.

The problem appears to be edit_interface.php starting about line 1388 where existing gedlines are replaced by newlines (inside the "if (!empty($NOTE))" code block. That needs to split gedlines so that all and only the NOTE, CONT, CONC lines are replaced by the new content, then the remaining note (structure) lines appended back on the end of the result. There is similar code in some other places as well.

That chunk of code could also be considerably smarter about using CONT versus CONC lines. If you just let the input window word wrap for you, you can end up with VERY long lines, that should be broken using CONC. On edit (or display), those CONC lines should be joined back together so they can be edited as a single long line / paragraph.
The CHAN structure is a reasonable extension, but according to the way I read the GEDCOM 5.5.1 (draft) specification, a NOTE structure does not include a change structure. page 37 of ged551-5.pdf I got from the PhpGedView web site someplace (can not find the link now though).

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks