gnucash stable: Multiple changes pushed
Robert Fewell
bobit at code.gnucash.org
Fri May 24 05:03:33 EDT 2024
Updated via https://github.com/Gnucash/gnucash/commit/b34a8b0a (commit)
via https://github.com/Gnucash/gnucash/commit/bc5cac4a (commit)
from https://github.com/Gnucash/gnucash/commit/48185684 (commit)
commit b34a8b0add3e386304638f047f19c6a4335a1ae0
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Wed May 15 11:06:46 2024 +0100
Bug 798822 - Move to blank transaction
If the move to blank action is used when a register is displayed in
REG_STYLE_JOURNAL, the resulting highlighted cell is the split 'action'
cell. In all other register styles it is the 'date' cell so test for
the register style and decrement the vcell_loc.virt_row by one to move
to the 'date' cell.
diff --git a/gnucash/gnome/gnc-split-reg.c b/gnucash/gnome/gnc-split-reg.c
index ed612032a0..c29b17ce55 100644
--- a/gnucash/gnome/gnc-split-reg.c
+++ b/gnucash/gnome/gnc-split-reg.c
@@ -1738,8 +1738,12 @@ gnc_split_reg_jump_to_blank (GNCSplitReg *gsr)
}
if (gnc_split_register_get_split_virt_loc (reg, blank, &vcell_loc))
- gnucash_register_goto_virt_cell (gsr->reg, vcell_loc);
+ {
+ if ((vcell_loc.virt_row > 1) && (reg->style == REG_STYLE_JOURNAL))
+ vcell_loc.virt_row--; // highlight the date field
+ gnucash_register_goto_virt_cell (gsr->reg, vcell_loc);
+ }
gnc_ledger_display_refresh (gsr->ledger);
LEAVE(" ");
}
commit bc5cac4aa2348250db9ec02561588d09aab14ab9
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Wed May 15 10:46:06 2024 +0100
Bug 799298 - Shortcut Ctrl-G does not work in the General Journal register for the default date value
The split list in the General Journal register contains the blank
splits of other open registers which the GUI hides in
split-register-load.c. As they are not entered, the entered date value
is 0 and they will be listed before any split with the default date
value. If such a split is used, nothing will happen.
To fix this use the same test to ignore these blank splits.
diff --git a/gnucash/gnome/gnc-plugin-page-register.cpp b/gnucash/gnome/gnc-plugin-page-register.cpp
index 92732a4be3..061339572d 100644
--- a/gnucash/gnome/gnc-plugin-page-register.cpp
+++ b/gnucash/gnome/gnc-plugin-page-register.cpp
@@ -4674,6 +4674,15 @@ gnc_plugin_page_register_cmd_blank_transaction (GSimpleAction *simple,
LEAVE (" ");
}
+static bool
+find_after_date (Split *split, time64* find_date)
+{
+ auto trans = xaccSplitGetParent (split);
+ return !(xaccSplitGetAccount (split) != nullptr &&
+ xaccTransGetDate (trans) >= *find_date &&
+ xaccTransCountSplits (trans) != 1);
+}
+
static void
gnc_plugin_page_register_cmd_goto_date (GSimpleAction *simple,
GVariant *paramter,
@@ -4689,6 +4698,7 @@ gnc_plugin_page_register_cmd_goto_date (GSimpleAction *simple,
g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
auto date = input_date (window, _("Go to Date"), _("Go to Date"));
+
if (!date)
{
LEAVE ("goto_date cancelled");
@@ -4700,14 +4710,14 @@ gnc_plugin_page_register_cmd_goto_date (GSimpleAction *simple,
splits = g_list_copy (qof_query_run (query));
splits = g_list_sort (splits, (GCompareFunc)xaccSplitOrder);
- for (GList *lp = splits; lp; lp = lp->next)
- {
- if (xaccTransGetDate (xaccSplitGetParent (GNC_SPLIT(lp->data))) >= date.value())
- {
- gnc_split_reg_jump_to_split (gsr, GNC_SPLIT(lp->data));
- break;
- }
- }
+ // if gl register, there could be blank splits from other open registers
+ // included in split list so check for and ignore them
+ auto it = g_list_find_custom (splits, &date.value(), (GCompareFunc)find_after_date);
+
+ if (it)
+ gnc_split_reg_jump_to_split (gsr, GNC_SPLIT(it->data));
+ else
+ gnc_split_reg_jump_to_blank (gsr);
g_list_free (splits);
LEAVE (" ");
Summary of changes:
gnucash/gnome/gnc-plugin-page-register.cpp | 26 ++++++++++++++++++--------
gnucash/gnome/gnc-split-reg.c | 6 +++++-
2 files changed, 23 insertions(+), 9 deletions(-)
More information about the gnucash-changes
mailing list