AUDIT: r17462 - gnucash/trunk/src/gnome-utils - Bug #547335: Get the exchange rate dialog "to" amount working again when launched via the register instead of the menu.
Charles Day
cedayiv at cvs.gnucash.org
Mon Aug 11 17:55:50 EDT 2008
Author: cedayiv
Date: 2008-08-11 17:55:50 -0400 (Mon, 11 Aug 2008)
New Revision: 17462
Trac: http://svn.gnucash.org/trac/changeset/17462
Modified:
gnucash/trunk/src/gnome-utils/dialog-transfer.c
Log:
Bug #547335: Get the exchange rate dialog "to" amount working again when launched via the register instead of the menu.
BP
Modified: gnucash/trunk/src/gnome-utils/dialog-transfer.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-transfer.c 2008-08-09 11:52:23 UTC (rev 17461)
+++ gnucash/trunk/src/gnome-utils/dialog-transfer.c 2008-08-11 21:55:50 UTC (rev 17462)
@@ -834,6 +834,7 @@
GNCAmountEdit *amount_edit, *price_edit, *to_amount_edit;
gnc_numeric price, to_amount;
Account *account;
+ int scu = 0;
g_return_if_fail(xferData);
@@ -842,21 +843,23 @@
price_edit = GNC_AMOUNT_EDIT(xferData->price_edit);
to_amount_edit = GNC_AMOUNT_EDIT(xferData->to_amount_edit);
+ /* Determine the SCU (smallest commodity unit) of the "to" amount. */
account = gnc_transfer_dialog_get_selected_account(xferData, XFER_DIALOG_TO);
if (account == NULL)
account = gnc_transfer_dialog_get_selected_account(xferData,
XFER_DIALOG_FROM);
+ if (account != NULL)
+ scu = xaccAccountGetCommoditySCU(account);
+ else if (xferData->to_commodity != NULL)
+ scu = gnc_commodity_get_fraction(xferData->to_commodity);
/* Determine the amount to transfer. */
- if (account == NULL ||
- !gnc_amount_edit_evaluate(price_edit) ||
+ if (!gnc_amount_edit_evaluate(price_edit) ||
gnc_numeric_zero_p(price = gnc_amount_edit_get_amount(price_edit)))
to_amount = gnc_numeric_zero();
else
to_amount = gnc_numeric_mul(gnc_amount_edit_get_amount(amount_edit),
- price,
- xaccAccountGetCommoditySCU(account),
- GNC_RND_ROUND);
+ price, scu, GNC_RND_ROUND);
/* Update the dialog. */
gnc_amount_edit_set_amount(to_amount_edit, to_amount);
More information about the gnucash-changes
mailing list