* src/register/ledger-core/split-register-load.c -- set the txn

currency based on the currency of the "default account"


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7549 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2002-11-25 02:38:10 +00:00
parent f2c9bc2a16
commit 1081387a8d
2 changed files with 19 additions and 1 deletions

View File

@ -15,6 +15,9 @@
* src/gnome-utils/exchange-dialog.glade -- New dialog to deal with
exchanges from "within the register", but here because it is
relatively generic.
* src/register/ledger-core/split-register-load.c -- set the txn
currency based on the currency of the "default account"
2002-11-24 David Hampton <hampton@employees.org>

View File

@ -175,13 +175,28 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
if (blank_split == NULL)
{
Transaction *trans;
gnc_commodity * currency = NULL;
/* Determine the proper currency to use for this transaction.
* if default_account != NULL and default_account->commodity is
* a currency, then use that. Otherwise use the default currency.
*/
if (default_account != NULL) {
gnc_commodity * commodity = xaccAccountGetCommodity (default_account);
if (commodity) {
const char * namespace = gnc_commodity_get_namespace (commodity);
if (!safe_strcmp (namespace, GNC_COMMODITY_NS_ISO) ||
!safe_strcmp (namespace, GNC_COMMODITY_NS_LEGACY))
currency = commodity;
}
}
gnc_suspend_gui_refresh ();
trans = xaccMallocTransaction (gnc_get_current_book ());
xaccTransBeginEdit (trans);
xaccTransSetCurrency (trans, gnc_default_currency ()); /* is this lame? */
xaccTransSetCurrency (trans, currency ? currency : gnc_default_currency ());
xaccTransSetDateSecs (trans, info->last_date_entered);
blank_split = xaccMallocSplit (gnc_get_current_book ());
xaccTransAppendSplit (trans, blank_split);