Export functionality

Phil Longstaff plongstaff at rogers.com
Sun May 24 13:11:17 EDT 2009

On May 24, 2009 12:35:25 am Derek Atkins wrote:
> Quoting Phil Longstaff <plongstaff at rogers.com>:
> > Export functionality is broken.  Trying to export invoices, for example,
> > crashes.  In addition, although it purports to export to XML, it will, in
> > fact, try to create an SQLite3 db because it just uses a filename.
> >
> > What should we do with this?  Fix for 2.4?  Remove?
> Well, crashing is ALWAYS bad.
> The fact that it creates a SQLite DB is DEFINITELY a bug.
> That's irregardless of the question of whether we should continue to
> enable "export Invoice".   Personally I think the QSF stuff should
> be expunged.  But that doesn't override the fact that saving to a file
> causes a Sqlite DB to get created...  Which as I said is definitely a bug.

I know what the problem is, but not what the best solution is.  To export, the 
business plugin creates a new session for the qsf file, then uses qof to copy 
the invoice collection to the new session.  Qof works its way recursively down 
the invoice, copying each referenced object.  The main copy function, 
qof_instance_foreach_copy(), used to copy a QofParam from the source object, 
assumes that each param has a basic type (char, int, guid, date, ...) or is a 
QofInstance.  The problem comes with gncOwner (gncEntryBillTo) which is none 
of the above.  The crash comes when trying to cast a gncOwner to be a 

1) Expand qof params to know about structs, where a struct is a grouping of 
basic types/QofInstances.
2) Let qof_instance_foreach_copy know about gncOwner (ugly!)
3) Make gncOwner be a QofInstance (don't like this one either)
4) Just get rid of export?

I think #1 is what's needed.  I'll see what I can do.


More information about the gnucash-devel mailing list