Partly fix broken data file backward compatibility where SX recurrence would disappear.

In r17725 and r17751, I introduced the extra XML child element
<recurrence:weekend_adj>, but this means a gnucash-2.2.x cannot read
the SX recurrence of a >=2.3.x file anymore, which is bad. In order
to improve this broken backward compatibility for at least the common
case, we don't write out this XML element as long as it is only "none".

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18376 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming
2009-10-07 20:45:00 +00:00
parent 0ed35e5489
commit 018c467160

View File

@@ -143,7 +143,16 @@ recurrence_to_dom_tree(const gchar *tag, const Recurrence *r)
d = recurrenceGetDate(r);
xmlAddChild(n, gdate_to_dom_tree(recurrence_start, &d));
wadj = recurrenceGetWeekendAdjust(r);
xmlAddChild(n, text_to_dom_tree(recurrence_weekend_adj,
recurrenceWeekendAdjustToString(wadj)));
if (wadj != WEEKEND_ADJ_NONE)
{
/* In r17725 and r17751, I introduced this extra XML child
element, but this means a gnucash-2.2.x cannot read the SX
recurrence of a >=2.3.x file anymore, which is bad. In order
to improve this broken backward compatibility for most of the
cases, we don't write out this XML element as long as it is
only "none". */
xmlAddChild(n, text_to_dom_tree(recurrence_weekend_adj,
recurrenceWeekendAdjustToString(wadj)));
}
return n;
}