gnucash maint: Bug 759859 - Reconcilation does not convert transactions' currency to the main one making reconcilation impossible.
John Ralls
jralls at code.gnucash.org
Sat Dec 26 18:34:19 EST 2015
Updated via https://github.com/Gnucash/gnucash/commit/8838cee7 (commit)
from https://github.com/Gnucash/gnucash/commit/ac149b7d (commit)
commit 8838cee7cabe62c0300660f685e8070e9989c78e
Author: Grzegorz Milka <grzegorzmilka at gmail.com>
Date: Sat Dec 26 15:34:01 2015 -0800
Bug 759859 - Reconcilation does not convert transactions' currency to the main one making reconcilation impossible.
Disable the Include subaccounts checkbox if there are descendant accounts with different commodities.
diff --git a/src/gnome/gtkbuilder/window-reconcile.glade b/src/gnome/gtkbuilder/window-reconcile.glade
index 9c90f0b..7e26057 100644
--- a/src/gnome/gtkbuilder/window-reconcile.glade
+++ b/src/gnome/gtkbuilder/window-reconcile.glade
@@ -96,6 +96,8 @@
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="gnc_start_recn_children_changed"/>
+ <property name="tooltip_text" translatable="yes">Include all descendant accounts in the reconcile. All of them must use the same commodity as this one.</property>
+
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/src/gnome/window-reconcile.c b/src/gnome/window-reconcile.c
index f29b5ad..6813161 100644
--- a/src/gnome/window-reconcile.c
+++ b/src/gnome/window-reconcile.c
@@ -175,6 +175,41 @@ static GtkActionEntry recnWindow_actions [];
/** The number of actions provided by the main window. */
static guint recnWindow_n_actions;
+static gpointer
+commodity_compare(Account *account, gpointer user_data) {
+ gboolean equal = gnc_commodity_equiv (xaccAccountGetCommodity (account),
+ (gnc_commodity*) user_data);
+
+ return equal ? NULL : account;
+}
+
+
+/********************************************************************\
+ * has_account_different_commodities *
+ * *
+ * Args: parent account - the account to look in *
+ * Return: true if there exists a subaccount with different *
+ * commodity then the parent account. *
+\********************************************************************/
+static gboolean
+has_account_different_commodities(const Account *account)
+{
+ gnc_commodity *parent_commodity;
+ gpointer result;
+
+ if (account == NULL)
+ return FALSE;
+
+ parent_commodity = xaccAccountGetCommodity (account);
+
+ result = gnc_account_foreach_descendant_until (account,
+ commodity_compare,
+ parent_commodity);
+
+ return result != NULL;
+}
+
+
/********************************************************************\
* recnRefresh *
* refreshes the transactions in the reconcile window *
@@ -658,6 +693,7 @@ startRecnWindow(GtkWidget *parent, Account *account,
gboolean auto_interest_xfer_option;
GNCPrintAmountInfo print_info;
gnc_numeric ending;
+ gboolean has_uniform_currency;
char *title;
int result;
@@ -675,7 +711,8 @@ startRecnWindow(GtkWidget *parent, Account *account,
auto_interest_xfer_option =
gnc_recn_interest_xfer_get_auto_interest_xfer_allowed( account );
- data.include_children = xaccAccountGetReconcileChildrenStatus(account);
+ data.include_children = !has_account_different_commodities(account) &&
+ xaccAccountGetReconcileChildrenStatus(account);
ending = gnc_ui_account_get_reconciled_balance(account,
data.include_children);
@@ -1586,6 +1623,7 @@ RecnWindow *
recnWindow (GtkWidget *parent, Account *account)
{
gnc_numeric new_ending;
+ gboolean enable_subaccounts;
time64 statement_date;
if (account == NULL)
@@ -1603,9 +1641,11 @@ recnWindow (GtkWidget *parent, Account *account)
gnc_get_reconcile_info (account, &new_ending, &statement_date);
+ enable_subaccounts = !has_account_different_commodities(account);
/* Popup a little window to prompt the user to enter the
* ending balance for his/her bank statement */
- if (!startRecnWindow (parent, account, &new_ending, &statement_date, TRUE))
+ if (!startRecnWindow (parent, account, &new_ending, &statement_date,
+ enable_subaccounts))
return NULL;
return recnWindowWithBalance (parent, account, new_ending, statement_date);
Summary of changes:
src/gnome/gtkbuilder/window-reconcile.glade | 2 ++
src/gnome/window-reconcile.c | 44 +++++++++++++++++++++++++++--
2 files changed, 44 insertions(+), 2 deletions(-)
More information about the gnucash-changes
mailing list