mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
keep single-split transactions in sync
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@509 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
52a912652c
commit
c18bd0b3db
@ -676,8 +676,15 @@ readTransaction( int fd, Account *acc, int token )
|
||||
xaccTransAppendSplit (trans, split);
|
||||
split -> acc = (struct _account *) peer_acc;
|
||||
xaccInsertSplit (peer_acc, split);
|
||||
|
||||
/* duplicate many of the attributes in the credit split */
|
||||
split->damount = -num_shares;
|
||||
split->share_price = share_price;
|
||||
split->reconciled = trans->credit_split.reconciled;
|
||||
free (split->memo);
|
||||
split->memo = strdup (trans->credit_split.memo);
|
||||
free (split->action);
|
||||
split->action = strdup (trans->credit_split.action);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -467,31 +467,47 @@ xaccTransSetDate (Transaction *trans, int day, int mon, int year)
|
||||
}
|
||||
|
||||
void
|
||||
xaccTransSetNum (Transaction *trans, char *xnum)
|
||||
xaccTransSetNum (Transaction *trans, const char *xnum)
|
||||
{
|
||||
if (trans->num) free (trans->num);
|
||||
trans->num = strdup (xnum);
|
||||
}
|
||||
|
||||
void
|
||||
xaccTransSetDescription (Transaction *trans, char *desc)
|
||||
xaccTransSetDescription (Transaction *trans, const char *desc)
|
||||
{
|
||||
if (trans->description) free (trans->description);
|
||||
trans->description = strdup (desc);
|
||||
}
|
||||
|
||||
void
|
||||
xaccTransSetMemo (Transaction *trans, char *memo)
|
||||
xaccTransSetMemo (Transaction *trans, const char *memo)
|
||||
{
|
||||
if (trans->credit_split.memo) free (trans->credit_split.memo);
|
||||
trans->credit_split.memo = strdup (memo);
|
||||
|
||||
/* if there is only one split, then keep memos in sync. */
|
||||
if (trans->debit_splits) {
|
||||
if (0x0 == trans->debit_splits[1]) {
|
||||
free (trans->debit_splits[0]->memo);
|
||||
trans->debit_splits[0]->memo = strdup (memo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xaccTransSetAction (Transaction *trans, char *actn)
|
||||
xaccTransSetAction (Transaction *trans, const char *actn)
|
||||
{
|
||||
if (trans->credit_split.action) free (trans->credit_split.action);
|
||||
trans->credit_split.action = strdup (actn);
|
||||
|
||||
/* if there is only one split, then keep action in sync. */
|
||||
if (trans->debit_splits) {
|
||||
if (0x0 == trans->debit_splits[1]) {
|
||||
free (trans->debit_splits[0]->action);
|
||||
trans->debit_splits[0]->action = strdup (actn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -504,14 +520,14 @@ xaccTransSetReconcile (Transaction *trans, char recn)
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
xaccSplitSetMemo (Split *split, char *memo)
|
||||
xaccSplitSetMemo (Split *split, const char *memo)
|
||||
{
|
||||
if (split->memo) free (split->memo);
|
||||
split->memo = strdup (memo);
|
||||
}
|
||||
|
||||
void
|
||||
xaccSplitSetAction (Split *split, char *actn)
|
||||
xaccSplitSetAction (Split *split, const char *actn)
|
||||
{
|
||||
if (split->action) free (split->action);
|
||||
split->action = strdup (actn);
|
||||
|
Loading…
Reference in New Issue
Block a user