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
| Type | Name | Default | Reason / Plan |
|---|---|---|---|
| Account | |||
| gnc_commodity* | commodity | NULL | Incompatible with QOF |
| AccountGroup | parent, children | NULL | Outstanding issue |
| SplitList* | splits | NULL | Outstanding issue |
| LotList* | lots | NULL | Outstanding issue |
| GNCPolicy* | policy | xaccGetFIFOPolicy() | Unknown - does this need to be fixed? |
| FreqSpec | |||
| All members incompatible with QOF | Outstanding issue | ||
| AccountGroup | |||
| All members incompatible with QOF | Outstanding 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_split | NULL | May need a call to xaccSplitDetermineGainStatus - please report any issues |
| Transaction | |||
| gnc_commodity* | common_currency | NULL | Outstanding issue with gnc_commodity types |
| GSList* | splits | NULL | Unresolved. |
| Lot | |||
| Incomplete QOF registration needs to be fixed | Pending | ||
| Price | |||
| gnc_commodity* | commodity | set in GncPriceDB | unresolved - please report any issues |
| gnc_commodity* | currency | set in GncPriceDB | unresolved - please report any issues |
Table 6-2. Struct members (Business) without set_fcn, get_fcn pairs
| Type | Name | Default | Reason / Plan |
|---|---|---|---|
| gncAddress | |||
| QofEntity* | parent | NULL | Needs work, possibly using a bolt-on tidy-up function after the Commit. |
| gncCustomer | |||
| GncAddress* | addr | gncAddressCreate, using the customer object as parent | Unresolved - could conflict in a merge. |
| gnc_commodity* | currency | undefined | Unresolved. |
| GSList* | jobs | NULL | unresolved |
| GncAddress* | shipaddr | gncAddressCreate (book, &cust->inst.entity) | Resolved - could still conflict in a merge, monitoring. |
| gncEmployee | |||
| GncAddress* | addr | gncAddressCreate (book, &cust->inst.entity) | Resolved - could still conflict in a merge, monitoring. |
| gnc_commodity* | currency | undefined | Unresolved. |
| gncEntry | |||
| QofInstance | inst | set by create: | OK |
| GList* | i_tax_values | undefined | Unresolved. |
| gncInvoice | |||
| GncOwner | owner | undefined | Unresolved, gncOwner has no set_fcn. |
| GncOwner | billto | GNC_OWNER_CUSTOMER | Unresolved, gncOwner has no set_fcn. |
| gnc_commodity* | currency | undefined | Unresolved. |
| gncJob | |||
| GncOwner | owner | undefined | Unresolved, gncOwner has no set_fcn. |
| gncOrder | |||
| GncOwner | owner | undefined | Unresolved, gncOwner has no set_fcn. |
| GList* | entries | undefined | Internal 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.