mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
When using "Jump" with more than two splits, expand the transaction
If there are more than two splits it may not be obvious why a transaction has been selected in the basic register mode, so expand the transaction to show the split that's in this register and also to indicate which split was followed to reach this transaction.
This commit is contained in:
parent
bdf7c36d7d
commit
c23d8cdf5b
@ -4985,6 +4985,8 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
|
||||
Account* account;
|
||||
Account* leader;
|
||||
Split* split;
|
||||
Split* other_split;
|
||||
gboolean multiple_splits;
|
||||
|
||||
ENTER ("(action %p, page %p)", simple, page);
|
||||
|
||||
@ -5013,6 +5015,9 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
|
||||
return;
|
||||
}
|
||||
|
||||
other_split = xaccSplitGetOtherSplit (split);
|
||||
multiple_splits = other_split == NULL;
|
||||
|
||||
leader = gnc_ledger_display_leader (priv->ledger);
|
||||
if (account == leader)
|
||||
{
|
||||
@ -5040,8 +5045,7 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
|
||||
return;
|
||||
}
|
||||
|
||||
Split* other_split = xaccSplitGetOtherSplit (split);
|
||||
if (other_split == NULL)
|
||||
if (multiple_splits)
|
||||
{
|
||||
other_split = jump_multiple_splits (account, split);
|
||||
}
|
||||
@ -5105,11 +5109,30 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple,
|
||||
gnc_main_window_open_page (GNC_MAIN_WINDOW (window), new_page);
|
||||
gsr = gnc_plugin_page_register_get_gsr (new_page);
|
||||
|
||||
SplitRegister *new_page_reg = gnc_ledger_display_get_split_register (gsr->ledger);
|
||||
gboolean jump_twice = FALSE;
|
||||
|
||||
/* Selecting the split (instead of just the transaction to open the "other"
|
||||
* account) requires jumping a second time after expanding the transaction,
|
||||
* in the basic and auto ledger modes.
|
||||
*/
|
||||
if (new_page_reg->style != REG_STYLE_JOURNAL)
|
||||
jump_twice = TRUE;
|
||||
|
||||
/* Test for visibility of split */
|
||||
if (gnc_split_reg_clear_filter_for_split (gsr, split))
|
||||
gnc_plugin_page_register_clear_current_filter (GNC_PLUGIN_PAGE(new_page));
|
||||
|
||||
gnc_split_reg_jump_to_split (gsr, split);
|
||||
|
||||
if (multiple_splits && jump_twice)
|
||||
{
|
||||
/* Expand the transaction for the basic and auto ledger to identify the
|
||||
* split in this register, but only if there are more than two splits.
|
||||
*/
|
||||
gnc_split_register_expand_current_trans (new_page_reg, TRUE);
|
||||
gnc_split_reg_jump_to_split (gsr, split);
|
||||
}
|
||||
LEAVE (" ");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user