mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug #613502: Summary bar total display uses wrong currency
Patch by Ajay Thomas: I have attached a proposed patch for this bug. It would work in all cases wherein the user enters the currency of the book to be different from the default report currency. For Example: Suppose the user set the default report and account default currency (through GnuCash preferences dialog) to be USD. If user creates a new account hierarchy (new book) with the currency as INR, The summary bar would be displayed as: -Grand Total in INR -TOTAL_SINGLE_MODE in INR ( any accounts within the book which has amount in INR) -OTHER CURRENCIES (if accounts within the book belong to other currencies) The new account hierarchy dialog creates a new book or adds accounts to an already existing account tree. This summary bar will display the book default currency for all books created after applying the patch. My change sets the currency of the new book as the commodity of the root account of the book. Earlier, the user entered currency for the newly created book was not saved as an attribute in the book or root account. I have tested the patch with 3 test cases by: 1. creating a new book with currency different from the default currency ( both account default and report default currency within the report) . 2. using an existing book to setup an account hierarchy which sets a new default currency for the book ( it merges the existing account tree with the newly created book) 3. Already existing books summary bars work the same way as before. BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20568 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
4046046172
commit
944fe15782
@ -385,8 +385,14 @@ gnc_main_window_summary_refresh (GNCMainSummary * summary)
|
|||||||
GList *current;
|
GList *current;
|
||||||
GNCSummarybarOptions options;
|
GNCSummarybarOptions options;
|
||||||
|
|
||||||
options.default_currency = gnc_default_report_currency ();
|
|
||||||
|
|
||||||
|
root = gnc_get_current_root_account ();
|
||||||
|
options.default_currency = xaccAccountGetCommodity(root);
|
||||||
|
if(options.default_currency == NULL)
|
||||||
|
{
|
||||||
|
options.default_currency = gnc_default_currency ();
|
||||||
|
}
|
||||||
|
|
||||||
options.euro = gnc_gconf_get_bool(GCONF_GENERAL, KEY_ENABLE_EURO, NULL);
|
options.euro = gnc_gconf_get_bool(GCONF_GENERAL, KEY_ENABLE_EURO, NULL);
|
||||||
options.grand_total =
|
options.grand_total =
|
||||||
gnc_gconf_get_bool(GCONF_SECTION, KEY_GRAND_TOTAL, NULL);
|
gnc_gconf_get_bool(GCONF_SECTION, KEY_GRAND_TOTAL, NULL);
|
||||||
@ -407,7 +413,6 @@ gnc_main_window_summary_refresh (GNCMainSummary * summary)
|
|||||||
gnc_ui_get_currency_accumulator (¤cy_list, options.default_currency,
|
gnc_ui_get_currency_accumulator (¤cy_list, options.default_currency,
|
||||||
TOTAL_SINGLE);
|
TOTAL_SINGLE);
|
||||||
|
|
||||||
root = gnc_get_current_root_account ();
|
|
||||||
gnc_ui_accounts_recurse(root, ¤cy_list, options);
|
gnc_ui_accounts_recurse(root, ¤cy_list, options);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1009,13 +1009,18 @@ on_finish (GtkAssistant *gtkassistant,
|
|||||||
hierarchy_data *data)
|
hierarchy_data *data)
|
||||||
{
|
{
|
||||||
GncHierarchyAssistantFinishedCallback when_completed;
|
GncHierarchyAssistantFinishedCallback when_completed;
|
||||||
|
gnc_commodity *com;
|
||||||
|
Account * root;
|
||||||
ENTER (" ");
|
ENTER (" ");
|
||||||
|
com = gnc_currency_edit_get_currency (GNC_CURRENCY_EDIT(data->currency_selector));
|
||||||
|
|
||||||
if (data->our_account_tree)
|
if (data->our_account_tree)
|
||||||
{
|
{
|
||||||
gnc_account_foreach_descendant (data->our_account_tree,
|
gnc_account_foreach_descendant (data->our_account_tree,
|
||||||
(AccountCb)starting_balance_helper,
|
(AccountCb)starting_balance_helper,
|
||||||
data);
|
data);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete before we suspend GUI events, and then muck with the model,
|
// delete before we suspend GUI events, and then muck with the model,
|
||||||
@ -1027,12 +1032,17 @@ on_finish (GtkAssistant *gtkassistant,
|
|||||||
gnc_suspend_gui_refresh ();
|
gnc_suspend_gui_refresh ();
|
||||||
|
|
||||||
account_trees_merge(gnc_get_current_root_account(), data->our_account_tree);
|
account_trees_merge(gnc_get_current_root_account(), data->our_account_tree);
|
||||||
|
|
||||||
delete_our_account_tree (data);
|
delete_our_account_tree (data);
|
||||||
|
|
||||||
when_completed = data->when_completed;
|
when_completed = data->when_completed;
|
||||||
g_free(data);
|
g_free(data);
|
||||||
|
|
||||||
|
root = gnc_get_current_root_account();
|
||||||
|
xaccAccountSetCommodity(root, com);
|
||||||
|
|
||||||
gnc_resume_gui_refresh ();
|
gnc_resume_gui_refresh ();
|
||||||
|
|
||||||
if (when_completed)
|
if (when_completed)
|
||||||
{
|
{
|
||||||
(*when_completed)();
|
(*when_completed)();
|
||||||
|
Loading…
Reference in New Issue
Block a user