r21577 - gnucash/trunk/src/backend/xml - Fix xml backend to load and save invoice kvp values.

Geert Janssens gjanssens at code.gnucash.org
Fri Nov 18 05:26:02 EST 2011


Author: gjanssens
Date: 2011-11-18 05:26:02 -0500 (Fri, 18 Nov 2011)
New Revision: 21577
Trac: http://svn.gnucash.org/trac/changeset/21577

Modified:
   gnucash/trunk/src/backend/xml/gnc-invoice-xml-v2.c
Log:
Fix xml backend to load and save invoice kvp values.

Modified: gnucash/trunk/src/backend/xml/gnc-invoice-xml-v2.c
===================================================================
--- gnucash/trunk/src/backend/xml/gnc-invoice-xml-v2.c	2011-11-17 22:29:57 UTC (rev 21576)
+++ gnucash/trunk/src/backend/xml/gnc-invoice-xml-v2.c	2011-11-18 10:26:02 UTC (rev 21577)
@@ -90,6 +90,7 @@
 invoice_dom_tree_create (GncInvoice *invoice)
 {
     xmlNodePtr ret;
+    kvp_frame *kf;
     Timespec ts;
     Transaction *txn;
     GNCLot *lot;
@@ -156,6 +157,16 @@
     if (! gnc_numeric_zero_p (amt))
         xmlAddChild (ret, gnc_numeric_to_dom_tree (invoice_tochargeamt_string, &amt));
 
+    kf = qof_instance_get_slots (QOF_INSTANCE(invoice));
+    if (kf)
+    {
+        xmlNodePtr kvpnode = kvp_frame_to_dom_tree(invoice_slots_string, kf);
+        if (kvpnode)
+        {
+            xmlAddChild(ret, kvpnode);
+        }
+    }
+
     return ret;
 }
 
@@ -396,7 +407,10 @@
 static gboolean
 invoice_slots_handler (xmlNodePtr node, gpointer invoice_pdata)
 {
-    return TRUE;
+    struct invoice_pdata *pdata = invoice_pdata;
+
+    return dom_tree_to_kvp_frame_given
+           (node, xaccAccountGetSlots (pdata->invoice));
 }
 
 static struct dom_tree_handler invoice_handlers_v2[] =



More information about the gnucash-changes mailing list