mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 798568 - Transaction Copy/Paste problem
When transactions are copied and pasted to the blank transaction on a register in basic view the wrong split values are displayed. This is due to the blank split being used for the wrong side of the transaction. To fix this, record the copied anchor split index and use that to reference the blank split when the transaction is pasted.
This commit is contained in:
parent
521b9747e0
commit
35cd037326
@ -73,6 +73,7 @@ typedef struct
|
||||
};
|
||||
CursorClass cursor_class;
|
||||
GncGUID leader_guid;
|
||||
gint anchor_split_index;
|
||||
} ft_fs_store;
|
||||
|
||||
static ft_fs_store copied_item = { 0, { NULL } };
|
||||
@ -101,6 +102,7 @@ clear_copied_item()
|
||||
copied_item.ft = NULL;
|
||||
copied_item.cursor_class = CURSOR_CLASS_NONE;
|
||||
copied_item.leader_guid = *guid_null();
|
||||
copied_item.anchor_split_index = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -828,6 +830,7 @@ gnc_split_register_copy_current_internal (SplitRegister* reg,
|
||||
}
|
||||
|
||||
copied_item.leader_guid = info->default_account;
|
||||
copied_item.anchor_split_index = xaccTransGetSplitIndex (trans, split);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1082,7 +1085,11 @@ gnc_split_register_paste_current (SplitRegister* reg)
|
||||
if (trans == blank_trans)
|
||||
{
|
||||
/* In pasting, the blank split is deleted. Pick a new one. */
|
||||
blank_split = xaccTransGetSplit (trans, 0);
|
||||
gint anchor_split_index = copied_item.anchor_split_index;
|
||||
if (anchor_split_index > num_splits)
|
||||
anchor_split_index = 0;
|
||||
|
||||
blank_split = xaccTransGetSplit (trans, anchor_split_index);
|
||||
info->blank_split_guid = *xaccSplitGetGUID (blank_split);
|
||||
info->blank_split_edited = TRUE;
|
||||
info->auto_complete = FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user