From 03e5d710f68a01d5444a7bc1d0eb7247eb2426b4 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Mon, 14 Mar 2022 18:44:35 +0800 Subject: [PATCH] [assistant-stock-transaction] better Dr/Cr imbalance error message --- gnucash/gnome/assistant-stock-transaction.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gnucash/gnome/assistant-stock-transaction.cpp b/gnucash/gnome/assistant-stock-transaction.cpp index 636bcaed0c..8b6b7b9198 100644 --- a/gnucash/gnome/assistant-stock-transaction.cpp +++ b/gnucash/gnome/assistant-stock-transaction.cpp @@ -751,7 +751,17 @@ refresh_page_finish (StockTransactionInfo *info) } if (!gnc_numeric_equal (debit, credit)) - add_error_str (errors, N_("Debits and credits are not balanced")); + { + auto imbalance_str = N_("Total Debits of %s does not balance with total Credits of %s."); + auto print_info = gnc_commodity_print_info (info->currency, true); + auto debit_str = g_strdup (xaccPrintAmount (debit, print_info)); + auto credit_str = g_strdup (xaccPrintAmount (credit, print_info)); + auto error_str = g_strdup_printf (_(imbalance_str), debit_str, credit_str); + errors.emplace_back (error_str); + g_free (error_str); + g_free (credit_str); + g_free (debit_str); + } if (errors.empty()) {