ScrubCurrency

John Ralls jralls at ceridwen.us
Mon Nov 1 23:02:01 EDT 2010


I've been whacking away at the immense number of WARN messages generated by "make check" in backend/xml/test the last couple of days. A large portion of them are ultimately due to the xml in test-files/xml2 being really close to the schema of xml1... but there are a couple of other issues as well:

There was a major hole in xaccTransactionScrubCurrency wherein a transaction which had no currency element would have its splits checked for deprecated currency elements, a combination of a deprecated and a current element, or neither, but not just a current element, which is rather the obvious place to look. I've fixed that (scrub will now look at all of the splits and pick the most-used commodity among them). So far so good...

Except that ScrubCurrency wants to replace the "quantity" element with the value of the "value" element. This isn't right for a bunch of use cases (stock splits, for one). I can only guess that it's because of a change in the way the elements were used back in 2002 when the format originally changed, but it's not the right thing to do now. That wouldn't ordinarily warrant a mention, but I ifdeffed out the code in Scrub.c (it's the last bit of the last function, if anyone wants to look), but the amounts are still getting screwed up. I'll eventually figure out why.

What's significant is that when I tried to transfer 100 shares of FOO from one FOO-denominated account to another using the Transfer menu item, the dialog told me that one account had to be a cash account.

What's the reason for that limitation?

The other big issue is that there's a test that splits a file up into its component elements and then loads them one by one. It doesn't like the currency-free transactions because there aren't any accounts to get the currencies from.  If I fix the files so that there are commodity elements in the transactions, then it won't exercise xaccTransactionScrubCurrency during the more realistic load test. I think that the break-the-file-apart approach is a dumb and unrealistic test. Does anyone object to my removing it?

Last, it appears that scrub runs every time a file is loaded, and that Actions>Check & Repair also runs it. Did I miss something, or is Check & Repair superfluous?

Regards,
John Ralls



More information about the gnucash-devel mailing list