gnucash maint: [assistant-stock-transaction] show stock acct when capitalizing fees
Christopher Lam
clam at code.gnucash.org
Mon Aug 22 00:35:03 EDT 2022
Updated via https://github.com/Gnucash/gnucash/commit/2c5a5a04 (commit)
from https://github.com/Gnucash/gnucash/commit/ff4c656b (commit)
commit 2c5a5a04855ef134dd068ab5fd3406d87764e14b
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Mon Aug 22 12:21:28 2022 +0800
[assistant-stock-transaction] show stock acct when capitalizing fees
...in final page summary table.
The ignore_account bool is thus not used anymore, and can be removed.
diff --git a/gnucash/gnome/assistant-stock-transaction.cpp b/gnucash/gnome/assistant-stock-transaction.cpp
index e8283585f..5763143ba 100644
--- a/gnucash/gnome/assistant-stock-transaction.cpp
+++ b/gnucash/gnome/assistant-stock-transaction.cpp
@@ -633,8 +633,7 @@ add_error_str (StringVec& errors, const char* str)
static void
check_page (GtkListStore *list, gnc_numeric& debit, gnc_numeric& credit,
FieldMask splitfield, Account *acct, GtkWidget *memo, GtkWidget *gae,
- gnc_commodity *comm, bool ignore_account,
- const char* page, StringVec& errors)
+ gnc_commodity *comm, const char* page, StringVec& errors)
{
if (splitfield == FieldMask::DISABLED)
return;
@@ -678,9 +677,7 @@ check_page (GtkListStore *list, gnc_numeric& debit, gnc_numeric& credit,
auto memostr_escaped = g_markup_escape_text (memostr, -1);
const gchar *acctstr;
- if (ignore_account)
- acctstr = "";
- else if (acct)
+ if (acct)
acctstr = xaccAccountGetName (acct);
else if ((splitfield & FieldMask::ALLOW_ZERO) && gnc_numeric_zero_p (amount))
acctstr = "";
@@ -768,24 +765,24 @@ to ensure proper recording."), new_date_str, last_split_date_str);
check_page (list, debit, credit, info->txn_type->stock_value, info->acct,
info->stock_memo_edit, info->stock_value_edit, info->currency,
- false, NC_ ("Stock Assistant: Page name", "stock value"), errors);
+ NC_ ("Stock Assistant: Page name", "stock value"), errors);
check_page (list, debit, credit, info->txn_type->cash_value,
gas_account (info->cash_account), info->cash_memo_edit,
- info->cash_value, info->currency, false,
+ info->cash_value, info->currency,
NC_ ("Stock Assistant: Page name", "cash"), errors);
+ auto capitalize_fees = gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (info->capitalize_fees_checkbox));
check_page (list, debit, credit, info->txn_type->fees_value,
- gas_account (info->fees_account), info->fees_memo_edit,
- info->fees_value, info->currency,
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
- (info->capitalize_fees_checkbox)),
+ capitalize_fees ? info->acct : gas_account (info->fees_account),
+ info->fees_memo_edit, info->fees_value, info->currency,
NC_ ("Stock Assistant: Page name", "fees"), errors);
check_page (list, debit, credit, info->txn_type->dividend_value,
gas_account (info->dividend_account),
info->dividend_memo_edit, info->dividend_value, info->currency,
- false, NC_ ("Stock Assistant: Page name", "dividend"), errors);
+ NC_ ("Stock Assistant: Page name", "dividend"), errors);
// the next two checks will involve the two capgains splits:
// income side and stock side. The capgains_value ^
@@ -796,12 +793,12 @@ to ensure proper recording."), new_date_str, last_split_date_str);
check_page (list, debit, credit, info->txn_type->capgains_value,
gas_account (info->capgains_account),
info->capgains_memo_edit, info->capgains_value, info->currency,
- false, NC_ ("Stock Assistant: Page name", "capital gains"), errors);
+ NC_ ("Stock Assistant: Page name", "capital gains"), errors);
check_page (list, debit, credit,
info->txn_type->capgains_value ^ (FieldMask::ENABLED_CREDIT | FieldMask::ENABLED_DEBIT),
info->acct, info->capgains_memo_edit, info->capgains_value,
- info->currency, false,
+ info->currency,
NC_ ("Stock Assistant: Page name", "capital gains"), errors);
}
Summary of changes:
gnucash/gnome/assistant-stock-transaction.cpp | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
More information about the gnucash-changes
mailing list