mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Splits can now keep track of their own rollback state.
The Split <-> Account and Split <-> Transaction relationships are now
treated as properties of the Split. In terms of the BeginEdit/CommitEdit
block, Splits are subordinate to Transactions. There is no public
BeginEdit/CommitEdit block for Splits; changes to Splits should be wrapped
in their Transaction's Edit-block.
In the case of the Split <-> Account relationship, the call to
xaccSplitSetAccount() will be immediately visible from
xaccSplitGetAccount(), but the Account does not learn about the
Split until and if the edit is committed.
In the case of the Split <-> Transaction relationship, calling
xaccSplitSetParent() will immediately add the Split to the
Transactions split list. This is because the Split's Transaction
owns the reference to the Split. However, see the Transaction.c
patch for how to distinguish pre-edit state from in-edit state.
In both cases, events are not generated until the edits are committed.
Most of this new logic is in an engine-private helper xaccSplitCommitEdit(),
which is called from xaccTransCommitEdit().
Incidental:
Increased error-checking in xaccSplitSetValue().
Internalize a Transaction Begin/Commit edit-block in every setter func.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13457 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -75,10 +75,11 @@ struct split_s
|
||||
QofInstance inst;
|
||||
|
||||
Account *acc; /* back-pointer to debited/credited account */
|
||||
|
||||
Account *orig_acc;
|
||||
GNCLot *lot; /* back-pointer to debited/credited lot */
|
||||
|
||||
Transaction *parent; /* parent of split */
|
||||
Transaction *orig_parent;
|
||||
|
||||
/* The memo field is an arbitrary user-assiged value.
|
||||
* It is intended to hold a short (zero to forty character) string
|
||||
@@ -150,10 +151,11 @@ Split * xaccSplitClone (const Split *s);
|
||||
|
||||
Split *xaccDupeSplit (const Split *s);
|
||||
G_INLINE_FUNC void mark_split (Split *s);
|
||||
G_INLINE_FUNC void gen_event (const Split *split);
|
||||
|
||||
void xaccSplitVoid(Split *split);
|
||||
void xaccSplitUnvoid(Split *split);
|
||||
void xaccSplitCommitEdit(Split *s);
|
||||
void xaccSplitRollbackEdit(Split *s);
|
||||
|
||||
/* Compute the value of a list of splits in the given currency,
|
||||
* excluding the skip_me split. */
|
||||
|
||||
Reference in New Issue
Block a user