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);
|
xaccTransAppendSplit (trans, split);
|
||||||
split -> acc = (struct _account *) peer_acc;
|
split -> acc = (struct _account *) peer_acc;
|
||||||
xaccInsertSplit (peer_acc, split);
|
xaccInsertSplit (peer_acc, split);
|
||||||
|
|
||||||
|
/* duplicate many of the attributes in the credit split */
|
||||||
split->damount = -num_shares;
|
split->damount = -num_shares;
|
||||||
split->share_price = share_price;
|
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 {
|
} else {
|
||||||
|
@ -467,31 +467,47 @@ xaccTransSetDate (Transaction *trans, int day, int mon, int year)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xaccTransSetNum (Transaction *trans, char *xnum)
|
xaccTransSetNum (Transaction *trans, const char *xnum)
|
||||||
{
|
{
|
||||||
if (trans->num) free (trans->num);
|
if (trans->num) free (trans->num);
|
||||||
trans->num = strdup (xnum);
|
trans->num = strdup (xnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xaccTransSetDescription (Transaction *trans, char *desc)
|
xaccTransSetDescription (Transaction *trans, const char *desc)
|
||||||
{
|
{
|
||||||
if (trans->description) free (trans->description);
|
if (trans->description) free (trans->description);
|
||||||
trans->description = strdup (desc);
|
trans->description = strdup (desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xaccTransSetMemo (Transaction *trans, char *memo)
|
xaccTransSetMemo (Transaction *trans, const char *memo)
|
||||||
{
|
{
|
||||||
if (trans->credit_split.memo) free (trans->credit_split.memo);
|
if (trans->credit_split.memo) free (trans->credit_split.memo);
|
||||||
trans->credit_split.memo = strdup (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
|
void
|
||||||
xaccTransSetAction (Transaction *trans, char *actn)
|
xaccTransSetAction (Transaction *trans, const char *actn)
|
||||||
{
|
{
|
||||||
if (trans->credit_split.action) free (trans->credit_split.action);
|
if (trans->credit_split.action) free (trans->credit_split.action);
|
||||||
trans->credit_split.action = strdup (actn);
|
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
|
void
|
||||||
@ -504,14 +520,14 @@ xaccTransSetReconcile (Transaction *trans, char recn)
|
|||||||
\********************************************************************/
|
\********************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
xaccSplitSetMemo (Split *split, char *memo)
|
xaccSplitSetMemo (Split *split, const char *memo)
|
||||||
{
|
{
|
||||||
if (split->memo) free (split->memo);
|
if (split->memo) free (split->memo);
|
||||||
split->memo = strdup (memo);
|
split->memo = strdup (memo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xaccSplitSetAction (Split *split, char *actn)
|
xaccSplitSetAction (Split *split, const char *actn)
|
||||||
{
|
{
|
||||||
if (split->action) free (split->action);
|
if (split->action) free (split->action);
|
||||||
split->action = strdup (actn);
|
split->action = strdup (actn);
|
||||||
|
Loading…
Reference in New Issue
Block a user