[r23522]Bug 632588 - Scrub doesn't fix missing currency

So assign the currency from the first split (that belongs to an account.)

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/2.4@23531 57a11ea4-9604-0410-9ed3-97b8803252fd
2.4
John Ralls 13 years ago
parent 559d780c37
commit d368dfa531

@ -1089,7 +1089,7 @@ xaccTransScrubCurrency (Transaction *trans)
SplitList *node;
char guid_str[GUID_ENCODING_LENGTH+1];
guid_to_string_buff(xaccTransGetGUID(trans), guid_str);
PWARN ("no common transaction currency found for trans=\"%s\" (%s)",
PWARN ("no common transaction currency found for trans=\"%s\" (%s);",
trans->description, guid_str);
for (node = trans->splits; node; node = node->next)
@ -1101,9 +1101,15 @@ xaccTransScrubCurrency (Transaction *trans)
}
else
{
PWARN (" split=\"%s\" account=\"%s\" commodity=\"%s\"",
gnc_commodity *currency = xaccAccountGetCommodity(split->acc);
PWARN ("setting to split=\"%s\" account=\"%s\" commodity=\"%s\"",
split->memo, xaccAccountGetName(split->acc),
gnc_commodity_get_mnemonic(xaccAccountGetCommodity(split->acc)));
gnc_commodity_get_mnemonic(currency));
xaccTransBeginEdit (trans);
xaccTransSetCurrency (trans, currency);
xaccTransCommitEdit (trans);
return;
}
}
}

Loading…
Cancel
Save