Replace the lot-split and peer_guid properties with accessor functions.

The properties weren't backwards compatible with existing books, nor
would they work in the multiple-peers case.
This commit is contained in:
John Ralls 2015-05-31 17:59:01 -07:00
parent db5317f80f
commit d86a0b2378
3 changed files with 491 additions and 462 deletions

File diff suppressed because it is too large Load Diff

View File

@ -356,6 +356,29 @@ Split * xaccSplitLookup (const GncGUID *guid, QofBook *book);
/* Get a GList of unique transactions containing the given list of Splits. */
GList *xaccSplitListGetUniqueTransactions(const GList *splits);
/*################## Added for Reg2 #################*/
/** Add a peer split to this split's lot-split list.
* @param other_split: The split whose guid to add
* @param timestamp: The time to be recorded for the split.
*/
void xaccSplitAddPeerSplit (Split *split, const Split *other_split,
const time64 timestamp);
/** Does this split have peers?
*/
gboolean xaccSplitHasPeers (const Split *split);
/** Report if a split is a peer of this one.
* @param other_split: The split to test for being a peer of this one.
* @return: True if other_split is registered as a peer of this one.
*/
gboolean xaccSplitIsPeerSplit (const Split *split, const Split *other_split);
/** Remove a peer split from this split's lot-split list.
* @param other_split: The split whose guid to remove
*/
void xaccSplitRemovePeerSplit (Split *split, const Split *other_split);
/** Merge the other_split's peer splits into split's peers.
* @param other_split: The split donating the peer splits.
*/
void xaccSplitMergePeerSplits (Split *split, const Split *other_split);
/**
* The xaccSplitGetOtherSplit() is a convenience routine that returns

View File

@ -404,16 +404,8 @@ xaccSplitAssignToLot (Split *split, GNCLot *lot)
/* Set the lot-split and peer_guid properties on the two
* splits to indicate that they're linked.
*/
qof_instance_set (QOF_INSTANCE (split),
"lot-split", now,
"peer_guid", xaccSplitGetGUID (new_split),
NULL);
qof_instance_set (QOF_INSTANCE (new_split),
"lot-split", now,
"peer_guid", xaccSplitGetGUID (split),
NULL);
xaccSplitAddPeerSplit(split, new_split, now);
xaccSplitAddPeerSplit(new_split, split, now);
xaccAccountInsertSplit (acc, new_split);
xaccTransAppendSplit (trans, new_split);
/* Set the amount and value after the split is in the transaction