gnucash maint: Fix broken exchange rate edits when using trading accounts.

John Ralls jralls at code.gnucash.org
Tue Dec 8 18:28:21 EST 2015


Updated	 via  https://github.com/Gnucash/gnucash/commit/243bfd1e (commit)
	from  https://github.com/Gnucash/gnucash/commit/7e7b02af (commit)



commit 243bfd1e722474926db52a8d8ec8bacfeb8560a6
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Dec 8 15:26:39 2015 -0800

    Fix broken exchange rate edits when using trading accounts.
    
    Reverts an erroneous change that was part of 6e14137.

diff --git a/src/gnome-utils/dialog-transfer.c b/src/gnome-utils/dialog-transfer.c
index a17b7f3..7826e6b 100644
--- a/src/gnome-utils/dialog-transfer.c
+++ b/src/gnome-utils/dialog-transfer.c
@@ -2429,7 +2429,6 @@ gboolean gnc_xfer_dialog_run_exchange_dialog(
     gboolean swap_amounts = FALSE;
     gnc_commodity *txn_cur = xaccTransGetCurrency(txn);
     gnc_commodity *reg_com = xaccAccountGetCommodity(reg_acc);
-    gnc_numeric dialog_rate = *exch_rate;
 
     g_return_val_if_fail(txn_cur, TRUE);
 
@@ -2491,14 +2490,13 @@ gboolean gnc_xfer_dialog_run_exchange_dialog(
         gnc_xfer_dialog_select_to_currency(xfer, txn_cur);
         gnc_xfer_dialog_select_from_currency(xfer, xfer_com);
         if (!gnc_numeric_zero_p(*exch_rate))
-            dialog_rate = gnc_numeric_invert(*exch_rate);
+            *exch_rate = gnc_numeric_invert(*exch_rate);
         amount = gnc_numeric_neg(amount);
     }
     else
     {
         gnc_xfer_dialog_select_to_currency(xfer, xfer_com);
         gnc_xfer_dialog_select_from_currency(xfer, txn_cur);
-
         if (xaccTransUseTradingAccounts ( txn ))
             amount = gnc_numeric_neg(amount);
     }
@@ -2520,6 +2518,9 @@ gboolean gnc_xfer_dialog_run_exchange_dialog(
     /* and run it... */
     if (gnc_xfer_dialog_run_until_done(xfer) == FALSE)
         return TRUE;
+    /* If we inverted the rate for the dialog, invert it back. */
+    if (swap_amounts)
+        *exch_rate = gnc_numeric_invert(*exch_rate);
 
     return FALSE;
 }



Summary of changes:
 src/gnome-utils/dialog-transfer.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list