r18376 - gnucash/trunk/src/backend/xml - Partly fix broken data file backward compatibility where SX recurrence would disappear.

Christian Stimming cstim at code.gnucash.org
Wed Oct 7 16:45:00 EDT 2009


Author: cstim
Date: 2009-10-07 16:45:00 -0400 (Wed, 07 Oct 2009)
New Revision: 18376
Trac: http://svn.gnucash.org/trac/changeset/18376

Modified:
   gnucash/trunk/src/backend/xml/gnc-recurrence-xml-v2.c
Log:
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".

Modified: gnucash/trunk/src/backend/xml/gnc-recurrence-xml-v2.c
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-recurrence-xml-v2.c	2009-10-07 14:21:39 UTC (rev 18375)
+++ gnucash/trunk/src/backend/xml/gnc-recurrence-xml-v2.c	2009-10-07 20:45:00 UTC (rev 18376)
@@ -143,7 +143,16 @@
     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;
 }



More information about the gnucash-changes mailing list