Fixes the crash and also pauses after loading if there are load errors.
The load "protection" catches exceptions other than bad-date so that it's
real protection.
Check for unbalanced transactions (i.e. with only one account) and don't
try to match if there is; report the error in the error log space in the
assistant.
Don't proceed to finding duplicates if the new account tree hasn't been
created, there aren't any.
gnucash has historically supported storing passwords for database
backends with libsecret when HAVE_LIBSECRET is defined. The code is
still present, but support for detecting libsecret's availablity was not
ported over when the build system was converted to cmake. This change
restores the missing detection.
An extra XaccTransBeginEdit, never committed, for transactions that
the backend tried to load when they were already there. That made
the register think that something else had it open.
Instead of reporting an error and declining to load the file (XML)
or failing to enter a value (SQL) when a bad date is found in the
database, use a 0 time stamp (1970-01-01 00:00:00 UTC). Adds a warning
in SQL backends; there was one already in XML.
Unfortunately it turns out that we can't use filestreams because
they can't take path arguments containing Unicode on Windows.
Replace the filestream code with g_file_get_contents(), which
takes care of all of that Windows compatibility noise for us.
Note there is a debugging display which unexpectedly causes test
failure. Calling gncEntryGetDocValue for each entry, with any
combination of booleans, would cause the amounts to change slightly.
Previously whitespace was encoded onto SXML, but it seems to make
travis complain, i.e. on my branch no errors, however, on main Gnucash
branch would occasionally strip whitespace. This change will parse
XHTML and strip whitespace, which means some tests need amending.
This is technically a bug in the TR regarding book split-action
property. The reworked TR did not retrieve book split-action properly
which means it was always assuming split-action was #f for sorting.
This commit redefines sortkey-list to accept split-action? as a
parameter to generate the correct sortkeys. Unfortunately it will make
it more complicated; I'm not sure how to simplify.
1. Don't even check for price/exchange rate on template transactions,
there's no point.
2. Extract function get_transaction_currency:
a. Check all split commodities are valid, abort transaction creation if
not.
b. If the template transaction's currency isn't used by any of the
splits set the new transaction's currency to the first-found currency if
there is one, otherwise to the first-found commodity.
3. Fix a minor typo in a comment.
When you have specified a read only threshold, the date is silently
changed if it's beyond the threshold. There was already code to present
a dialog informing of this but was disabled so enable it.
Limit the range of the random value to 1..1000 to prevent overflows,
particularly in number-of-periods or number-of-years variables.
While we're at it, g_random_int and g_random_int_range return ints so
piping the result through gnc_double_to_numeric() doesn't make much
sense. That's removed, we just construct a gnc_numeric.