Skip to content

Commit

Permalink
[gnc-plugin-page-register] when reversing reversed txn, offer jump
Browse files Browse the repository at this point in the history
When reversing a transaction which is already reversed, offer a jump
to the reversal transaction.
  • Loading branch information
christopherlam committed Sep 26, 2021
1 parent c17d43b commit b8c9b1a
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions gnucash/gnome/gnc-plugin-page-register.c
Original file line number Diff line number Diff line change
Expand Up @@ -4072,13 +4072,6 @@ gnc_plugin_page_register_cmd_reverse_transaction (GtkAction* action,
if (trans == NULL)
return;

if (xaccTransGetReversedBy (trans))
{
gnc_error_dialog (GTK_WINDOW (window), "%s",
_ ("A reversing entry has already been created for this transaction."));
return;
}

split = gnc_split_register_get_current_split (reg);
account = xaccSplitGetAccount (split);

Expand All @@ -4088,6 +4081,17 @@ gnc_plugin_page_register_cmd_reverse_transaction (GtkAction* action,
return;
}

new_trans = xaccTransGetReversedBy (trans);
if (new_trans)
{
const char *rev = _("A reversing entry has already been created for this transaction.");
const char *jump = _("Jump to the transaction?");
if (gnc_verify_dialog (GTK_WINDOW (window), TRUE, "%s\n\n%s", rev, jump))
goto jump_to_trans;
else
return;
}

if (!gnc_dup_time64_dialog (window, _("Reverse Transaction"),
_("New Transaction Information"), &date))
{
Expand All @@ -4104,6 +4108,7 @@ gnc_plugin_page_register_cmd_reverse_transaction (GtkAction* action,

gnc_resume_gui_refresh();

jump_to_trans:
/* Now jump to new trans */
gsr = gnc_plugin_page_register_get_gsr (GNC_PLUGIN_PAGE (page));
split = xaccTransFindSplitByAccount(new_trans, account);
Expand Down

0 comments on commit b8c9b1a

Please sign in to comment.