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

Geert Janssens janssens-geert at telenet.be
Fri Nov 18 16:59:05 EST 2011


On vrijdag 18 november 2011, Christian Stimming wrote:
> Dear Geert,
> 
> does this commit also mean that a 2.4.x gnucash cannot load and
> subsequently save KVP slots of invoices? That's, err, unfortunate.
Rats, I didn't think of that... But yes, the 2.4 xml code doesn't support kvp 
slots for invoices. It was only partly implemented. Oddly enough the sql 
backend did implement them properly. That's why I didn't notice at first.

> It
> means you cannot use invoice KVP as long as the XML file claims it can be
> read by 2.4.x without loosing information. If this is true but we still
> want to add a new data field to invoices, we would better change the XML
> structure directly so that an older gnucash will refuse to load the file
> altogether. That's still better than silently loosing data upon loading in
> 2.4.x...

Yes that's probably true. Quite unfortunate though...

Would it be a reasonable compromise to implement the invoice kvp parts in 2.4 
xml backend instead ? I know that would only move the problem to 2.2.x, but I 
don't think we support backward compatibility over past two major releases. 
The kvp I'm introducing is only relevant if you really do use credit notes. If 
you stick to invoices only, it doesn't matter if the kvp is present or not, or 
even if it's lost in a save by an older version of gnucash.

So:
- if no credit note is in the data file:
  2.2 can work on the file, but will lose any invoice kvp potentially created 
  by 2.6
  2.4 can work on the file, and will keep any invoice kvp already present, but 
  won't create new ones.
  2.6 will create invoice kvps and obviously knows how to save and use them
- if there is a credit note in the data file (meaning the file was created
  with at least 2.6)
  2.2 will lose the credit note kvp, but going back two major releases is not
  supported anyway.
  2.4 will honor the invoice kvps, but will interpret credit notes as negative
  invoices (probably, I still have to evaluate the impact and implement some
  restrictions in this version)
  2.6 fully works with invoice kvps.

Implementing invoice kvp support in 2.4 is trivial. I can simply backport this 
commit and part of an earlier commit (for the qof accessor functions) and it's 
done.

Geert


More information about the gnucash-devel mailing list