Example code pointers (was: Re: Freecoins conduit (again))
Christian Stimming
stimming at tuhh.de
Fri Dec 5 02:22:13 CST 2003
Will McDonald schrieb:
> In that case, is there someone who can help me (point me to existing code
> or provide sample function calls) fulfill the ambitious desires of "I
> have a transaction I'd like to commit now, please" and "Please to be showing
> me all the transactions that happened today" and "Good sir, may I
> inquire as to what accounts you currently possess"? :)
> Hell, I can even promise to document (for some value of "document")
> everything that I do so that future generations can learn from my
> failure.
Some example code about "how to commit a new transaction" can be found
in each of the importer modules. You have to bear in mind that each
importer module has two steps of importing one transaction: Firstly, a
new transaction is created and filled with the data to be imported, and
secondly if this transaction was confirmed to be a new transaction (as
opposed to a detected duplicate of an existing transaction) then the
transaction is actually committed into gnucash.
The second step is done with the common "generic importer", where the
code in question is in src/import-export/import-backend.c in the
function gnc_import_trans_clist() .
The first step is different in each importer module; for HBCI (and
MT940), it is done in src/import-export/hbci/gnc-hbci-gettrans.c in
function trans_list_cb() which is called from gnc_hbci_gettrans_final()
on each list element by list_HBCI_Transaction_foreach. For OFX this is
done in src/import-export/ofx/gnc-ofx-import.c in ofx_proc_transaction_cb().
The QIF importer is separated from the other modules, because the
(older) code that is still in use was designed before the common generic
importer was designed. Actually there are two QIF directories. However
the newer one was never finished, so the older one is still in use and
it doesn't use the generic importer code.
Maybe it helps if you include these pointers in some developer
documentation. Did you run 'make doc' already? It uses doxygen to create
a HTML API documentation although I forgot the destination directory.
The main page of that documentation can also be edited in
src/doc/mainpage.txt.
Christian
More information about the gnucash-devel
mailing list