diff --git a/gnucash/gnome/gnc-plugin-page-register.cpp b/gnucash/gnome/gnc-plugin-page-register.cpp index f8f3843ffc6..533260e97a8 100644 --- a/gnucash/gnome/gnc-plugin-page-register.cpp +++ b/gnucash/gnome/gnc-plugin-page-register.cpp @@ -4897,6 +4897,10 @@ jump_multiple_splits_by_single_account (Account *account, Split *split) other_split = s; } + // Jump to the same account so that the right warning is triggered + if (!other_split) + other_split = split; + return other_split; } @@ -4938,6 +4942,10 @@ jump_multiple_splits_by_value (Account *account, Split *split, gboolean largest) other_split = s; } + // Jump to the same account so that the right warning is triggered + if (!other_split) + other_split = split; + return other_split; } @@ -5039,6 +5047,20 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple, } if (other_split == NULL) { + GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(window), + (GtkDialogFlags)(GTK_DIALOG_MODAL + | GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_MESSAGE_ERROR, + GTK_BUTTONS_NONE, + "%s", + _("Unable to jump to other account")); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog), + "%s", _("This transaction involves more than one other account. Select a specific split to jump to that account.")); + gtk_dialog_add_button (GTK_DIALOG(dialog), _("_OK"), GTK_RESPONSE_OK); + gnc_dialog_run (GTK_DIALOG(dialog), GNC_PREF_WARN_REG_TRANS_JUMP_MULTIPLE_SPLITS); + gtk_widget_destroy (dialog); + LEAVE ("no split (2)"); return; } @@ -5054,6 +5076,20 @@ gnc_plugin_page_register_cmd_jump (GSimpleAction *simple, if (account == leader) { + GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(window), + (GtkDialogFlags)(GTK_DIALOG_MODAL + | GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_MESSAGE_ERROR, + GTK_BUTTONS_NONE, + "%s", + _("Unable to jump to other account")); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog), + "%s", _("This transaction only involves the current account so there is no other account to jump to.")); + gtk_dialog_add_button (GTK_DIALOG(dialog), _("_OK"), GTK_RESPONSE_OK); + gnc_dialog_run (GTK_DIALOG(dialog), GNC_PREF_WARN_REG_TRANS_JUMP_SINGLE_ACCOUNT); + gtk_widget_destroy (dialog); + LEAVE ("register open for account"); return; } diff --git a/gnucash/gschemas/org.gnucash.GnuCash.warnings.gschema.xml.in b/gnucash/gschemas/org.gnucash.GnuCash.warnings.gschema.xml.in index 8db0304cd7e..253553124cc 100644 --- a/gnucash/gschemas/org.gnucash.GnuCash.warnings.gschema.xml.in +++ b/gnucash/gschemas/org.gnucash.GnuCash.warnings.gschema.xml.in @@ -124,6 +124,16 @@ Commit changes to a transaction This dialog is presented when you attempt to move out of a modified transaction. The changed data must be either saved or discarded. + + 0 + Jump when there are multiple other accounts + This dialog is presented when you are unable to jump on a transaction because it has splits for multiple other accounts. A specific split must be selected to jump to the other account. + + + 0 + Jump when there are no other accounts + This dialog is presented when you are unable to jump on a transaction because it only has splits for the current account. + @@ -247,5 +257,15 @@ Commit changes to a transaction This dialog is presented when you attempt to move out of a modified transaction. The changed data must be either saved or discarded. + + 0 + Jump when there are multiple other accounts + This dialog is presented when you are unable to jump on a transaction because it has splits for multiple other accounts. A specific split must be selected to jump to the other account. + + + 0 + Jump when there are no other accounts + This dialog is presented when you are unable to jump on a transaction because it only has splits for the current account. +