gnucash master: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Mon Jan 3 19:25:45 EST 2022
Updated via https://github.com/Gnucash/gnucash/commit/f7ee6446 (commit)
via https://github.com/Gnucash/gnucash/commit/85a62c03 (commit)
from https://github.com/Gnucash/gnucash/commit/9d1c73f9 (commit)
commit f7ee644695fa15d23369096669ebbb7b90d639a3
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Jan 4 08:24:06 2022 +0800
Amendment to 73822f97a [1/2] use heuristics to scrub budget signs
Testing income<0 to conclude "none reversal" is likely a more sound
strategy than testing liability>0.
diff --git a/libgnucash/engine/ScrubBudget.c b/libgnucash/engine/ScrubBudget.c
index 614f946f7..c1834f062 100644
--- a/libgnucash/engine/ScrubBudget.c
+++ b/libgnucash/engine/ScrubBudget.c
@@ -113,7 +113,7 @@ heuristics_on_budget (GncBudget * budget, Account *root)
result =
heuristics.expense < 0 ? HEURISTICS_INC_EXP :
- heuristics.liability > 0 ? HEURISTICS_NONE :
+ heuristics.income < 0 ? HEURISTICS_NONE :
HEURISTICS_CREDIT_ACC;
LEAVE ("heuristics_on_budget %s: A(%d) L(%d) Inc(%d) Exp(%d) Eq(%d) = %d",
commit 85a62c03ea21dee19e1f1fac9d26736c14d86cfb
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Jan 4 08:21:57 2022 +0800
Amendment to 972fd4520 [2/3] remove backward-compatibility code
Error in removing backward compatibility code.
gnc_reverse_budget_balance (account, TRUE) should be simplified to
gnc_reverse_balance (account). The .scm code was simplified correctly,
but not the C code.
diff --git a/gnucash/gnome/gnc-budget-view.c b/gnucash/gnome/gnc-budget-view.c
index 05a037771..cb707ce71 100644
--- a/gnucash/gnome/gnc-budget-view.c
+++ b/gnucash/gnome/gnc-budget-view.c
@@ -1077,7 +1077,8 @@ gbv_get_accumulated_budget_amount (GncBudget *budget, Account *account, guint pe
else
info.total = gnc_budget_get_account_period_value (budget, account, period_num);
- info.total = gnc_numeric_neg (info.total);
+ if (gnc_reverse_balance (account))
+ info.total = gnc_numeric_neg (info.total);
return info.total;
}
@@ -1140,7 +1141,8 @@ budget_col_source (Account *account, GtkTreeViewColumn *col,
strcpy (amtbuff, "error");
else
{
- numeric = gnc_numeric_neg (numeric);
+ if (gnc_reverse_balance (account))
+ numeric = gnc_numeric_neg (numeric);
xaccSPrintAmount (amtbuff, numeric,
gnc_account_print_info (account, FALSE));
@@ -1190,7 +1192,8 @@ bgv_get_total_for_account (Account *account, GncBudget *budget, gnc_commodity *n
{
numeric = gbv_get_accumulated_budget_amount (budget, account, period_num);
- numeric = gnc_numeric_neg (numeric);
+ if (gnc_reverse_balance (account))
+ numeric = gnc_numeric_neg (numeric);
if (new_currency)
{
@@ -1217,7 +1220,8 @@ bgv_get_total_for_account (Account *account, GncBudget *budget, gnc_commodity *n
}
}
- total = gnc_numeric_neg (total);
+ if (gnc_reverse_balance (account))
+ total = gnc_numeric_neg (total);
return total;
}
@@ -1280,7 +1284,8 @@ budget_col_edited (Account *account, GtkTreeViewColumn *col,
gnc_budget_unset_account_period_value (priv->budget, account, period_num);
else
{
- numeric = gnc_numeric_neg (numeric);
+ if (gnc_reverse_balance (account))
+ numeric = gnc_numeric_neg (numeric);
gnc_budget_set_account_period_value (priv->budget, account, period_num,
numeric);
}
Summary of changes:
gnucash/gnome/gnc-budget-view.c | 15 ++++++++++-----
libgnucash/engine/ScrubBudget.c | 2 +-
2 files changed, 11 insertions(+), 6 deletions(-)
More information about the gnucash-changes
mailing list