mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
fixes to handle the transfer-from field correctly
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1118 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
6a42823adb
commit
0134b8c372
@ -338,23 +338,39 @@ printf ("save split is %p \n", split);
|
|||||||
* display, we just reparent the indicated split, its it,
|
* display, we just reparent the indicated split, its it,
|
||||||
* and that's that. For a two-line display, we want to reparent
|
* and that's that. For a two-line display, we want to reparent
|
||||||
* the "other" split, but only if there is one ...
|
* the "other" split, but only if there is one ...
|
||||||
|
* XFRM is the straight split, MXFRM is the mirrored split.
|
||||||
*/
|
*/
|
||||||
if (MOD_XFRM & changed) {
|
if (MOD_XFRM & changed) {
|
||||||
Account *old_acc=NULL, *new_acc=NULL;
|
|
||||||
Split *split_to_modify = NULL;
|
Split *split_to_modify = NULL;
|
||||||
|
|
||||||
if ((REG_MULTI_LINE == style) ||
|
split_to_modify = split;
|
||||||
(REG_SINGLE_DYNAMIC == style) ||
|
|
||||||
(REG_DOUBLE_DYNAMIC == style))
|
|
||||||
{
|
|
||||||
split_to_modify = split;
|
|
||||||
} else {
|
|
||||||
split_to_modify = xaccGetOtherSplit(split);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* split to modify may be null if its a mutli-split transaction,
|
/* split to modify may be null if its a mutli-split transaction,
|
||||||
* and a single-line or two-line display. Then do nothing */
|
* and a single-line or two-line display. Then do nothing */
|
||||||
if (split_to_modify) {
|
if (split_to_modify) {
|
||||||
|
Account *old_acc=NULL, *new_acc=NULL;
|
||||||
|
|
||||||
|
/* do some reparenting. Insertion into new account will automatically
|
||||||
|
* delete from the old account */
|
||||||
|
old_acc = xaccSplitGetAccount (split_to_modify);
|
||||||
|
new_acc = xaccGetAccountByName (trans, reg->xfrmCell->cell.value);
|
||||||
|
xaccAccountInsertSplit (new_acc, split_to_modify);
|
||||||
|
|
||||||
|
/* make sure any open windows of the old account get redrawn */
|
||||||
|
xaccAccountDisplayRefresh (old_acc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MOD_MXFRM & changed) {
|
||||||
|
Split *split_to_modify = NULL;
|
||||||
|
|
||||||
|
split_to_modify = xaccGetOtherSplit(split);
|
||||||
|
|
||||||
|
/* split to modify may be null if its a mutli-split transaction,
|
||||||
|
* and a single-line or two-line display. Then do nothing */
|
||||||
|
if (split_to_modify) {
|
||||||
|
Account *old_acc=NULL, *new_acc=NULL;
|
||||||
|
|
||||||
/* do some reparenting. Insertion into new account will automatically
|
/* do some reparenting. Insertion into new account will automatically
|
||||||
* delete from the old account */
|
* delete from the old account */
|
||||||
old_acc = xaccSplitGetAccount (split_to_modify);
|
old_acc = xaccSplitGetAccount (split_to_modify);
|
||||||
@ -446,6 +462,7 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit)
|
|||||||
xaccSetComboCellValue (reg->actionCell, "");
|
xaccSetComboCellValue (reg->actionCell, "");
|
||||||
xaccSetBasicCellValue (reg->memoCell, "");
|
xaccSetBasicCellValue (reg->memoCell, "");
|
||||||
xaccSetComboCellValue (reg->xfrmCell, "");
|
xaccSetComboCellValue (reg->xfrmCell, "");
|
||||||
|
xaccSetComboCellValue (reg->mxfrmCell, "");
|
||||||
xaccSetDebCredCellValue (reg->debitCell,
|
xaccSetDebCredCellValue (reg->debitCell,
|
||||||
reg->creditCell, 0.0);
|
reg->creditCell, 0.0);
|
||||||
xaccSetDebCredCellValue (reg->ndebitCell,
|
xaccSetDebCredCellValue (reg->ndebitCell,
|
||||||
@ -489,21 +506,18 @@ xaccSRLoadTransEntry (SplitRegister *reg, Split *split, int do_commit)
|
|||||||
* For a multi-line display, show the account for each member split.
|
* For a multi-line display, show the account for each member split.
|
||||||
* For a one or two-line display, show the other account, but only
|
* For a one or two-line display, show the other account, but only
|
||||||
* if there are exactly two splits.
|
* if there are exactly two splits.
|
||||||
|
* xfrm is the "straight" display, "mxfrm" is the "mirrored" display.
|
||||||
*/
|
*/
|
||||||
if ((REG_MULTI_LINE == style) ||
|
accname = xaccAccountGetName (xaccSplitGetAccount (split));
|
||||||
(REG_SINGLE_DYNAMIC == style) ||
|
xaccSetComboCellValue (reg->xfrmCell, accname);
|
||||||
(REG_DOUBLE_DYNAMIC == style))
|
|
||||||
{
|
{
|
||||||
accname = xaccAccountGetName (xaccSplitGetAccount (split));
|
|
||||||
xaccSetComboCellValue (reg->xfrmCell, accname);
|
|
||||||
} else {
|
|
||||||
Split *s = xaccGetOtherSplit (split);
|
Split *s = xaccGetOtherSplit (split);
|
||||||
if (s) {
|
if (s) {
|
||||||
accname = xaccAccountGetName (xaccSplitGetAccount (s));
|
accname = xaccAccountGetName (xaccSplitGetAccount (s));
|
||||||
} else {
|
} else {
|
||||||
accname = SPLIT_STR;
|
accname = SPLIT_STR;
|
||||||
}
|
}
|
||||||
xaccSetComboCellValue (reg->xfrmCell, accname);
|
xaccSetComboCellValue (reg->mxfrmCell, accname);
|
||||||
}
|
}
|
||||||
|
|
||||||
xaccSetBasicCellValue (reg->memoCell, xaccSplitGetMemo (split));
|
xaccSetBasicCellValue (reg->memoCell, xaccSplitGetMemo (split));
|
||||||
|
@ -60,11 +60,15 @@
|
|||||||
#define NCRED_CELL 14
|
#define NCRED_CELL 14
|
||||||
#define NDEBT_CELL 15
|
#define NDEBT_CELL 15
|
||||||
|
|
||||||
|
/* MXFRM is the "mirrored" transfer-from account */
|
||||||
|
#define MXFRM_CELL 16
|
||||||
|
|
||||||
|
|
||||||
#define DATE_CELL_WIDTH 11
|
#define DATE_CELL_WIDTH 11
|
||||||
#define NUM_CELL_WIDTH 7
|
#define NUM_CELL_WIDTH 7
|
||||||
#define ACTN_CELL_WIDTH 7
|
#define ACTN_CELL_WIDTH 7
|
||||||
#define XFRM_CELL_WIDTH 14
|
#define XFRM_CELL_WIDTH 14
|
||||||
|
#define MXFRM_CELL_WIDTH 14
|
||||||
#define XTO_CELL_WIDTH 14
|
#define XTO_CELL_WIDTH 14
|
||||||
#define DESC_CELL_WIDTH 29
|
#define DESC_CELL_WIDTH 29
|
||||||
#define MEMO_CELL_WIDTH 29
|
#define MEMO_CELL_WIDTH 29
|
||||||
@ -102,6 +106,7 @@ configLabels (SplitRegister *reg)
|
|||||||
LABEL (NUM, NUM_STR);
|
LABEL (NUM, NUM_STR);
|
||||||
LABEL (ACTN, NUM_STR);
|
LABEL (ACTN, NUM_STR);
|
||||||
LABEL (XFRM, XFRM_STR);
|
LABEL (XFRM, XFRM_STR);
|
||||||
|
LABEL (MXFRM, XFRM_STR);
|
||||||
LABEL (XTO, XFTO_STR);
|
LABEL (XTO, XFTO_STR);
|
||||||
LABEL (DESC, DESC_STR);
|
LABEL (DESC, DESC_STR);
|
||||||
LABEL (MEMO, DESC_STR);
|
LABEL (MEMO, DESC_STR);
|
||||||
@ -238,7 +243,7 @@ configLayout (SplitRegister *reg)
|
|||||||
curs = reg->single_cursor;
|
curs = reg->single_cursor;
|
||||||
FANCY (DATE, date, 0, 0);
|
FANCY (DATE, date, 0, 0);
|
||||||
BASIC (NUM, num, 1, 0);
|
BASIC (NUM, num, 1, 0);
|
||||||
FANCY (XFRM, xfrm, 2, 0);
|
FANCY (MXFRM, mxfrm, 2, 0);
|
||||||
FANCY (DESC, desc, 3, 0);
|
FANCY (DESC, desc, 3, 0);
|
||||||
BASIC (RECN, recn, 4, 0);
|
BASIC (RECN, recn, 4, 0);
|
||||||
FANCY (DEBT, debit, 5, 0);
|
FANCY (DEBT, debit, 5, 0);
|
||||||
@ -255,7 +260,7 @@ configLayout (SplitRegister *reg)
|
|||||||
FANCY (BALN, balance, 7, 0);
|
FANCY (BALN, balance, 7, 0);
|
||||||
|
|
||||||
FANCY (ACTN, action, 1, 1);
|
FANCY (ACTN, action, 1, 1);
|
||||||
FANCY (XFRM, xfrm, 2, 1);
|
FANCY (MXFRM, mxfrm, 2, 1);
|
||||||
BASIC (MEMO, memo, 3, 1);
|
BASIC (MEMO, memo, 3, 1);
|
||||||
|
|
||||||
curs = reg->trans_cursor;
|
curs = reg->trans_cursor;
|
||||||
@ -282,7 +287,7 @@ configLayout (SplitRegister *reg)
|
|||||||
curs = reg->single_cursor;
|
curs = reg->single_cursor;
|
||||||
FANCY (DATE, date, 0, 0);
|
FANCY (DATE, date, 0, 0);
|
||||||
BASIC (NUM, num, 1, 0);
|
BASIC (NUM, num, 1, 0);
|
||||||
FANCY (XFRM, xfrm, 2, 0);
|
FANCY (MXFRM, mxfrm, 2, 0);
|
||||||
FANCY (DESC, desc, 3, 0);
|
FANCY (DESC, desc, 3, 0);
|
||||||
BASIC (RECN, recn, 4, 0);
|
BASIC (RECN, recn, 4, 0);
|
||||||
FANCY (DEBT, debit, 5, 0);
|
FANCY (DEBT, debit, 5, 0);
|
||||||
@ -306,7 +311,7 @@ configLayout (SplitRegister *reg)
|
|||||||
FANCY (BALN, balance, 10, 0);
|
FANCY (BALN, balance, 10, 0);
|
||||||
|
|
||||||
FANCY (ACTN, action, 1, 1);
|
FANCY (ACTN, action, 1, 1);
|
||||||
FANCY (XFRM, xfrm, 2, 1);
|
FANCY (MXFRM, mxfrm, 2, 1);
|
||||||
BASIC (MEMO, memo, 3, 1);
|
BASIC (MEMO, memo, 3, 1);
|
||||||
|
|
||||||
/* only the transaction cursor gets used */
|
/* only the transaction cursor gets used */
|
||||||
@ -539,6 +544,7 @@ xaccInitSplitRegister (SplitRegister *reg, int type)
|
|||||||
HDR (NUM);
|
HDR (NUM);
|
||||||
HDR (ACTN);
|
HDR (ACTN);
|
||||||
HDR (XFRM);
|
HDR (XFRM);
|
||||||
|
HDR (MXFRM);
|
||||||
HDR (XTO);
|
HDR (XTO);
|
||||||
HDR (DESC);
|
HDR (DESC);
|
||||||
HDR (MEMO);
|
HDR (MEMO);
|
||||||
@ -565,6 +571,7 @@ xaccInitSplitRegister (SplitRegister *reg, int type)
|
|||||||
NEW (balance, Price);
|
NEW (balance, Price);
|
||||||
|
|
||||||
NEW (xfrm, Combo);
|
NEW (xfrm, Combo);
|
||||||
|
NEW (mxfrm, Combo);
|
||||||
NEW (xto, Combo);
|
NEW (xto, Combo);
|
||||||
NEW (action, Combo);
|
NEW (action, Combo);
|
||||||
NEW (memo, Text);
|
NEW (memo, Text);
|
||||||
@ -743,6 +750,7 @@ xaccDestroySplitRegister (SplitRegister *reg)
|
|||||||
|
|
||||||
xaccDestroyComboCell (reg->actionCell);
|
xaccDestroyComboCell (reg->actionCell);
|
||||||
xaccDestroyComboCell (reg->xfrmCell);
|
xaccDestroyComboCell (reg->xfrmCell);
|
||||||
|
xaccDestroyComboCell (reg->mxfrmCell);
|
||||||
xaccDestroyComboCell (reg->xtoCell);
|
xaccDestroyComboCell (reg->xtoCell);
|
||||||
xaccDestroyBasicCell (reg->memoCell);
|
xaccDestroyBasicCell (reg->memoCell);
|
||||||
xaccDestroyPriceCell (reg->creditCell);
|
xaccDestroyPriceCell (reg->creditCell);
|
||||||
@ -762,6 +770,7 @@ xaccDestroySplitRegister (SplitRegister *reg)
|
|||||||
|
|
||||||
reg->actionCell = NULL;
|
reg->actionCell = NULL;
|
||||||
reg->xfrmCell = NULL;
|
reg->xfrmCell = NULL;
|
||||||
|
reg->mxfrmCell = NULL;
|
||||||
reg->xtoCell = NULL;
|
reg->xtoCell = NULL;
|
||||||
reg->memoCell = NULL;
|
reg->memoCell = NULL;
|
||||||
reg->creditCell = NULL;
|
reg->creditCell = NULL;
|
||||||
@ -785,19 +794,20 @@ xaccSplitRegisterGetChangeFlag (SplitRegister *reg)
|
|||||||
unsigned int changed = 0;
|
unsigned int changed = 0;
|
||||||
|
|
||||||
/* be careful to use bitwise ands and ors to assemble bit flag */
|
/* be careful to use bitwise ands and ors to assemble bit flag */
|
||||||
changed |= MOD_DATE & reg->dateCell->cell.changed;
|
changed |= MOD_DATE & reg->dateCell->cell.changed;
|
||||||
changed |= MOD_NUM & reg->numCell->changed;
|
changed |= MOD_NUM & reg->numCell->changed;
|
||||||
changed |= MOD_DESC & reg->descCell->cell.changed;
|
changed |= MOD_DESC & reg->descCell->cell.changed;
|
||||||
changed |= MOD_RECN & reg->recnCell->changed;
|
changed |= MOD_RECN & reg->recnCell->changed;
|
||||||
|
|
||||||
changed |= MOD_ACTN & reg->actionCell->cell.changed;
|
changed |= MOD_ACTN & reg->actionCell->cell.changed;
|
||||||
changed |= MOD_XFRM & reg->xfrmCell->cell.changed;
|
changed |= MOD_XFRM & reg->xfrmCell->cell.changed;
|
||||||
changed |= MOD_XTO & reg->xtoCell->cell.changed;
|
changed |= MOD_MXFRM & reg->mxfrmCell->cell.changed;
|
||||||
changed |= MOD_MEMO & reg->memoCell->changed;
|
changed |= MOD_XTO & reg->xtoCell->cell.changed;
|
||||||
changed |= MOD_AMNT & reg->creditCell->cell.changed;
|
changed |= MOD_MEMO & reg->memoCell->changed;
|
||||||
changed |= MOD_AMNT & reg->debitCell->cell.changed;
|
changed |= MOD_AMNT & reg->creditCell->cell.changed;
|
||||||
changed |= MOD_PRIC & reg->priceCell->cell.changed;
|
changed |= MOD_AMNT & reg->debitCell->cell.changed;
|
||||||
changed |= MOD_VALU & reg->valueCell->cell.changed;
|
changed |= MOD_PRIC & reg->priceCell->cell.changed;
|
||||||
|
changed |= MOD_VALU & reg->valueCell->cell.changed;
|
||||||
|
|
||||||
changed |= MOD_NAMNT & reg->ncreditCell->cell.changed;
|
changed |= MOD_NAMNT & reg->ncreditCell->cell.changed;
|
||||||
changed |= MOD_NAMNT & reg->ndebitCell->cell.changed;
|
changed |= MOD_NAMNT & reg->ndebitCell->cell.changed;
|
||||||
|
@ -96,14 +96,15 @@
|
|||||||
|
|
||||||
#define MOD_ACTN 0x0010
|
#define MOD_ACTN 0x0010
|
||||||
#define MOD_XFRM 0x0020
|
#define MOD_XFRM 0x0020
|
||||||
#define MOD_XTO 0x0040
|
#define MOD_MXFRM 0x0040
|
||||||
#define MOD_MEMO 0x0080
|
#define MOD_XTO 0x0080
|
||||||
#define MOD_AMNT 0x0100
|
#define MOD_MEMO 0x0100
|
||||||
#define MOD_NAMNT 0x0200
|
#define MOD_AMNT 0x0200
|
||||||
#define MOD_PRIC 0x0400
|
#define MOD_NAMNT 0x0400
|
||||||
#define MOD_VALU 0x0800
|
#define MOD_PRIC 0x0800
|
||||||
#define MOD_NEW 0x1000
|
#define MOD_VALU 0x1000
|
||||||
#define MOD_ALL 0x1fff
|
#define MOD_NEW 0x2000
|
||||||
|
#define MOD_ALL 0x3fff
|
||||||
|
|
||||||
/* The value of NUM_CELLS should be larger than the number of
|
/* The value of NUM_CELLS should be larger than the number of
|
||||||
* cells defined in the structure below!
|
* cells defined in the structure below!
|
||||||
@ -133,6 +134,7 @@ struct _SplitRegister {
|
|||||||
|
|
||||||
ComboCell * actionCell;
|
ComboCell * actionCell;
|
||||||
ComboCell * xfrmCell;
|
ComboCell * xfrmCell;
|
||||||
|
ComboCell * mxfrmCell;
|
||||||
ComboCell * xtoCell;
|
ComboCell * xtoCell;
|
||||||
BasicCell * memoCell;
|
BasicCell * memoCell;
|
||||||
PriceCell * creditCell;
|
PriceCell * creditCell;
|
||||||
|
Loading…
Reference in New Issue
Block a user