gnucash maint: Update to previous commit for Tax Options Dialog

Robert Fewell bobit at code.gnucash.org
Thu Sep 24 12:47:13 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/9ef405a3 (commit)
	from  https://github.com/Gnucash/gnucash/commit/7f7ae2ef (commit)



commit 9ef405a358a99f3edbba5b0a6b2d93adf4f77134
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Sep 24 17:43:13 2020 +0100

    Update to previous commit for Tax Options Dialog
    
    Use xaccAccountTypeGetFundamental instead of specifying all account
    types.

diff --git a/gnucash/gnome/dialog-tax-info.c b/gnucash/gnome/dialog-tax-info.c
index 3f18765fd..8dba81e09 100644
--- a/gnucash/gnome/dialog-tax-info.c
+++ b/gnucash/gnome/dialog-tax-info.c
@@ -573,23 +573,17 @@ gnc_tax_info_dialog_account_filter_func (Account *account,
         gpointer data)
 {
     TaxInfoDialog *dialog = data;
+    GNCAccountType fund_acct_type = xaccAccountTypeGetFundamental (xaccAccountGetType (account));
     gboolean included = FALSE;
 
     if ((dialog->account_type == ACCT_TYPE_INCOME) ||
-            (dialog->account_type == ACCT_TYPE_EXPENSE))
+        (dialog->account_type == ACCT_TYPE_EXPENSE))
         included = (xaccAccountGetType (account) == dialog->account_type);
     else if (dialog->account_type == ACCT_TYPE_ASSET)
-        included = ((xaccAccountGetType (account) == ACCT_TYPE_BANK) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_CASH) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_ASSET) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_STOCK) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_MUTUAL) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_RECEIVABLE));
+        included = (ACCT_TYPE_ASSET == fund_acct_type);
     else if (dialog->account_type == ACCT_TYPE_LIABILITY)
-        included = ((xaccAccountGetType (account) == ACCT_TYPE_CREDIT) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_LIABILITY) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_EQUITY) ||
-                    (xaccAccountGetType (account) == ACCT_TYPE_PAYABLE));
+        included = ((ACCT_TYPE_LIABILITY == fund_acct_type) ||
+                    (ACCT_TYPE_EQUITY == fund_acct_type));
     else
         included = FALSE;
     return included;
@@ -890,25 +884,16 @@ gnc_tax_info_set_acct (TaxInfoDialog *ti_dialog, Account *account)
     if (account == NULL)
         return;
 
-    ti_dialog->account_type = xaccAccountGetType (account);
+    ti_dialog->account_type = xaccAccountTypeGetFundamental (xaccAccountGetType (account));
 
     if (ti_dialog->account_type == ACCT_TYPE_INCOME)
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ti_dialog->income_radio), TRUE);
     else if (ti_dialog->account_type == ACCT_TYPE_EXPENSE)
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ti_dialog->expense_radio), TRUE);
-    else if ((ti_dialog->account_type == ACCT_TYPE_ASSET) ||
-             (ti_dialog->account_type == ACCT_TYPE_BANK) ||
-             (ti_dialog->account_type == ACCT_TYPE_CASH) ||
-             (ti_dialog->account_type == ACCT_TYPE_STOCK) ||
-             (ti_dialog->account_type == ACCT_TYPE_MUTUAL) ||
-             (ti_dialog->account_type == ACCT_TYPE_RECEIVABLE))
+    else if (ti_dialog->account_type == ACCT_TYPE_ASSET)
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ti_dialog->asset_radio), TRUE);
     else if ((ti_dialog->account_type == ACCT_TYPE_LIABILITY) ||
-             (ti_dialog->account_type == ACCT_TYPE_EQUITY) ||
-             (ti_dialog->account_type == ACCT_TYPE_CREDIT) ||
-             (ti_dialog->account_type == ACCT_TYPE_PAYABLE))
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ti_dialog->liab_eq_radio), TRUE);
-    else if (ti_dialog->account_type == ACCT_TYPE_EQUITY)
+             (ti_dialog->account_type == ACCT_TYPE_EQUITY))
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(ti_dialog->liab_eq_radio), TRUE);
     else
         return;



Summary of changes:
 gnucash/gnome/dialog-tax-info.c | 31 ++++++++-----------------------
 1 file changed, 8 insertions(+), 23 deletions(-)



More information about the gnucash-changes mailing list