6.5. Known problems

KVP. At the moment, I'm monitoring how KVP values are to be merged. Only Split uses a KVP get_fcn, set_fcn pair at the moment.

Incomplete QofSetterFunc. Without a usable QofAccessFunc : QofSetterFunc pair, qof_book_merge will be unable to process certain GnuCash object parameters.

GncCommodity and QOF. The system used for commodities does not follow the object handling and identification system (GUID's, Entities, etc.) that the other parts of GnuCash use. The API really should be ported over. This would allow us to get rid of the commodity table routines defined in v1.8

As a result, qof_book_merge does not currently handle commodities.

A problem arises in Transaction where a transaction is voided. There are three QofAccessFunc routines for each part of the void but only one function that could be used as a QofSetterFunc which sets all three values, as well as a second set function that undoes the void operation.

Invoice: unable to set the due date - no set_fcn?

Lots are also potential problems - this will need to be monitored.

Comparisons without a GUID match. qof_book_mergeUpdateRule only sets a failed match if ALL objects fail to match. When absolute is FALSE, all suitable target objects are compared and mergeResult is not set until all targets have been checked. The closest match is identified using a difference rank. This avoids using non-generic tests for object similarities. difference has a maximum value of the total number of comparable parameters and the value closest to zero is used. In the case of a tie, it is currently first-come-first-served. This needs to be improved.

In the following table, when the specified object is merged, data in the specified struct member variables will not be read, compared or set. Existing values in the target QofBook will not be changed. Where the object is QOF compatible, if the object is new (MERGE_NEW) the listed variable will be set to the default value given in the table.

Table 6-1. Struct members (Engine) without set_fcn, get_fcn pairs

TypeNameDefaultReason / Plan
Account
gnc_commodity*commodityNULLIncompatible with QOF
AccountGroupparent, childrenNULLOutstanding issue
SplitList*splitsNULLOutstanding issue
LotList*lotsNULLOutstanding issue
GNCPolicy*policyxaccGetFIFOPolicy()Unknown - does this need to be fixed?
FreqSpec
All members incompatible with QOFOutstanding issue
AccountGroup
All members incompatible with QOFOutstanding issue
SchedXactions
XXX this whole file is crufty, it doesn't really use entities in the most efficient/best way: no foreach, no QOF-compatible members.Outstanding issue
Split
Split*gains_splitNULLMay need a call to xaccSplitDetermineGainStatus - please report any issues
Transaction
gnc_commodity*common_currencyNULLOutstanding issue with gnc_commodity types
GSList*splitsNULLUnresolved.
Lot
Incomplete QOF registration needs to be fixedPending
Price
gnc_commodity*commodityset in GncPriceDBunresolved - please report any issues
gnc_commodity*currencyset in GncPriceDBunresolved - please report any issues

Table 6-2. Struct members (Business) without set_fcn, get_fcn pairs

TypeNameDefaultReason / Plan
gncAddress
QofEntity*parentNULLNeeds work, possibly using a bolt-on tidy-up function after the Commit.
gncCustomer
GncAddress*addrgncAddressCreate, using the customer object as parentUnresolved - could conflict in a merge.
gnc_commodity*currencyundefinedUnresolved.
GSList*jobsNULLunresolved
GncAddress*shipaddrgncAddressCreate (book, &cust->inst.entity)Resolved - could still conflict in a merge, monitoring.
gncEmployee
GncAddress*addrgncAddressCreate (book, &cust->inst.entity)Resolved - could still conflict in a merge, monitoring.
gnc_commodity*currencyundefinedUnresolved.
gncEntry
QofInstanceinstset by create:OK
GList*i_tax_valuesundefinedUnresolved.
gncInvoice
GncOwnerownerundefinedUnresolved, gncOwner has no set_fcn.
GncOwnerbilltoGNC_OWNER_CUSTOMERUnresolved, gncOwner has no set_fcn.
gnc_commodity*currencyundefinedUnresolved.
gncJob
GncOwnerownerundefinedUnresolved, gncOwner has no set_fcn.
gncOrder
GncOwnerownerundefinedUnresolved, gncOwner has no set_fcn.
GList*entriesundefinedInternal variable, not to be set.

Design problems. A brief note about books & sessions: A book encapsulates the datasets manipulated by GnuCash. A book holds the actual data. By contrast, the session mediates the connection between a book (the thing that lives in virtual memory in the local process) and the datastore (the place where book data lives permanently, e.g., file, database).

In the current design, a session may hold multiple books. For now, exactly what this means is somewhat vague, and code in various places makes some implicit assumptions: first, only one book is 'current' and open for editing. Next, its assumed that all of the books in a session are related in some way. i.e. that they are all earlier accounting periods of the currently open book. In particular, the backends probably make that assumption, in order to store the different accounting periods in a clump so that one can be found, given another.