Commit Graph

363 Commits

Author SHA1 Message Date
John Ralls
cdcb230a31 Don't look for backend libraries in old autotools subdirs.
Partly addresses Bug 794526
2018-06-07 17:38:04 -07:00
Potuz
e3e1464a01 Bug 794617 - Can't compile with -DWITH_GNUCASH=NO due to scm-gnome-utils
Pricedb.go doesn't need gnc-gnome-utils and we don't need WebKit or
gwenhywfar-gtk3 if we have no GUI.
2018-06-07 14:17:49 -07:00
John Ralls
333a14c0fd Fix ubuntu build failure.
%$^%$ C++11 initializer list behavior.
2018-06-02 17:57:42 -07:00
John Ralls
3b3074c28d Bug 796117 - Connecting 3.1 to an existing mysql db drops all data
Provide a backup recovery function that instead of dropping primaries
and restoring backups merges the primaries and backups. This should
handle a worst-case safe-save failure where the backup tables don't
have a complete set of rows for some reason.
2018-06-02 16:21:49 -07:00
John Ralls
f8045b2735 A wee bit of C++ style. 2018-06-02 16:21:05 -07:00
John Ralls
537fd995a3 Ensure full precision of doubles is saved to SQL.
std::iostream's operator<<(double) uses only 6 digits of precision
by default. We want 12 digits when saving.
2018-06-02 16:20:36 -07:00
John Ralls
9db60ca63c Make float database operations more consistent.
We don't use floats in GnuCash, we use doubles (and those as little as
possible), but dbd-sqlite3 is broken in that it stores only floats.
Simply casting floats to doubles introduces bogus additional digits
that can cause round-trip tests to fail. Instead convert floats to
doubles by multiplying by 10E6, rounding, then dividing by 10E6.
2018-06-02 16:16:41 -07:00
John Ralls
3e052e8dac [DBI Backend] Rework backup-table management.
Removes a public function, GncDbiSqlConnection::table_manage_backup that
should have been private in the first place.

Better encapsulates table renames and drops with private functions and
handles cases where there exist some primary tables and some backup tables.
2018-06-01 14:50:41 -07:00
John Ralls
e23769f078 [DBI Backend] If there's a set error value use that to set the backend error. 2018-06-01 14:13:11 -07:00
John Ralls
f504e39d78 Correct the type of error variables.
C++ doesn't like interchanging enums and ints.
2018-06-01 14:13:11 -07:00
John Ralls
464fdeeb26 [DBI Backend] Remove unused TableOpTypes. 2018-06-01 14:13:10 -07:00
John Ralls
74cbde2d4f normalize date formats the C++ way. 2018-05-28 08:56:01 -07:00
John Ralls
174752e28c Merge Bill Nottingham's 'bad-dates' into maint 2018-05-26 18:10:02 -07:00
John Ralls
aa08689371 Merge Paul Wassi's "Fix Permanent Storage" PR into maint. 2018-05-26 16:35:58 -07:00
John Ralls
243bf8afce Bug 796369 - Notes lost or perhaps just not displaying when using...
SQLite backend.

Release Note: This bug caused data loss if you saved your SQLite3
database to a different file or database.

The problem is that in SQLite3 (though not in MySQL or PgSQL) the
subquery ((SELECT DISTINCT guid FROM transactions)) (note the double
parentheses) returns only the first guid in the subquery's results.

Some transactions are loaded by special queries and those queries are
also used to retrieve the transaction's slots so they weren't affected.
2018-05-25 12:58:39 -07:00
John Ralls
5708707f6c Fix misplaced try block that caused unhandled exception if year out of range. 2018-05-25 09:19:12 -07:00
Paul Wassi
396c955fd5 Fix permanent storage of vendor details.
Since the data types did not match for the billterms and taxtable,
those references/guids were not saved to the database.
2018-05-25 01:56:14 +02:00
Geert Janssens
fcabf6bb96 A more detailed revision of gncEntry and gncInvoice related rounding
First change is to ensure gncEntry rounding is consistent. Internally
calculated values in the entry are never rounded. Consumers of
gncEntry's calculated values can request them either rounded or not.

Next use a pragmatical approach for calculating values on invoices based on
the entry values: do the rounding such that we never
create an unbalanced transaction while posting
That means
- round each entry's net value before summing them in net total
- accumulate all tax totals on invoice level per tax account before rounding
  and round before before summing them in a global tax total

Hopefully this will catch a few more rounding issues in this area.

A complete solution can only offered if we allow users to manually correct
tax entries. This requires changes to user interface and data format
so that's not going to happen in gnucash 3.x.
2018-05-24 18:53:15 +02:00
Bill Nottingham
8b1b25aee5 Modify date formatters to strip out certian specifiers.
strptime/strftime supports various modifiers to their parameters.

 'E' and 'O': alternate locale-specific formats
 (used in default format for Persian, Oriya, Azerbaijani)
 '-': padding
 (used in default format for Czech)

GnuCash passes dates as integer y/m/d without using locale-specific
formats, so we need to strip out 'E' and 'O' from the format when
scanning dates or determining separators in gnc-date.

None of '-', 'E', or 'O' are supported by boost (and '-' causes
errors), so strip them out from formatters in gnc-datetime as well.

See https://bugzilla.gnome.org/show_bug.cgi?id=795247.
2018-05-22 23:37:22 -04:00
Geert Janssens
2e8df1984a Improve rounding for invoice entry values
This will probably need more refinement because the multiplications
are still missing rounding methods, but the changes in this commit
will already allow guile code to correctly create entries.
2018-05-19 20:25:13 +02:00
Christopher Lam
97ab1b19fe test-date-utilities.scm: to SRFI64
Clearer syntax helped find flawed test - while set-tm:mday directly
accepts 1-31, set-tm:mon accepts 0-11 to represent 1-12, therefore
must minus 1. set-tm:year accepts 92 to represent 1992, therefore must
minus 1900.
2018-05-10 22:21:55 +08:00
Christopher Lam
13f31e0691 test-extras.scm: (logging-and) is obsolete
Use the much nicer SRFI-64 forms instead.
2018-05-10 22:21:55 +08:00
Christopher Lam
5e0fc04f7b test-extras.scm: remove dead code
These functions are never used through code.
2018-05-10 22:21:55 +08:00
Christopher Lam
c6032ac6ed srfi64-extras.scm: centralize (gnc:test-runner)
This is good enough to be used widely.
2018-05-10 13:19:03 +08:00
Christopher Lam
dda6730c44 utilities.scm: centralize and modernize addto!
(define-macro) is discouraged in most scheme forms. Change
to (define-syntax), and centralize common macro to utilities.scm
2018-05-10 13:19:03 +08:00
Christopher Lam
4a27285edd html-utilities.scm: new home (gnc:html-render-options-changed)
We want to sanitize render-options-changed, therefore it must return
an html-object. Unfortunately this is not accessible to
app-utils/options.scm. If we move this function to
report-system/html-utilities.scm, it can access html-objects.

Also rename it to gnc:html-render-options-changed
2018-05-10 13:19:03 +08:00
Geert Janssens
1f3cf845c4 Work around a conflict between gcc 8.0 and swig 3.0
The swig 3.0 generated python wrappers trigger a warning converted into an error issued
by gcc 8.0 for using strncpy as follows:
strncpy(buff, "swig_ptr: ", 10);
The reason is this call will truncate the trailing null byte from the string.
This appears to have been fixed in swig master already but that's not released yet
so let disable the warning when compiling the swig wrappers until it is.
2018-05-09 22:18:29 +02:00
gnucash-dev
8b3a874418 Fix typo 2018-05-04 10:04:52 -07:00
Geert Janssens
a9f35ed7ae Lowercase cmake commands
A huge bikeshed fest but it distracted me enough to do it anyway.
2018-05-03 23:18:15 +02:00
Geert Janssens
0c6b92959a Get metadata migration working again when upgrading from 2.6 to 3.1
Due to a typo the old GNC_DOT_DIR path was wrong
($HOME.gnucash instead of $HOME/.gnucash)
2018-04-30 20:59:25 +02:00
Geert Janssens
b761b5a0dc Bug 795377 - Reads and saves Gnucash 2.6.19 XML file, then can't reread it, due to bad date in old file
This commit contains another round of cleanups in the
timespec to time64 conversion. There were a number of
false assumptions that time64 = 0 would be a bad date
in the xml parser. This commit corrects enough of them to
eliminate the bug. Further cleanup is probably advised but
can be done at a later stage.
2018-04-28 12:19:28 +02:00
John Ralls
9c4469d039 Bug 795405 - All Dates in Price Database Off-By-One After 3.0 Upgrade
Also Bug 791825 - Accounting Period dates off by 1.
The DST start/end dates were reversed *and* the DST offset had the wrong
sign in Windows, resulting in the effective timezone always being one to
the west off (i.e. PDT was -9 and PST was -8).
2018-04-27 15:00:28 -07:00
John Ralls
83e993fb80 Add a TimeZoneProvider::dump().
Because gdb can't always see clearly inside m_zone_vector.
2018-04-27 14:16:49 -07:00
John Ralls
f6855bc0f8 Rename zone_vector to m_zone_vector.
To comply with coding spec.
2018-04-27 14:16:49 -07:00
Geert Janssens
d69cdaebf2 Add new test source to distribution list 2018-04-27 09:55:58 +02:00
Geert Janssens
74fd6e046b Add a few unit tests for qofquerycore 2018-04-26 23:06:36 +02:00
Geert Janssens
c71204628d Bug 795031 - 3.0 Crashes on loading when opening 2.6.19 file 2018-04-26 23:06:36 +02:00
Geert Janssens
4aadfbe636 Bug 795040 - GnuCash crashes when searching for a newly created bill 2018-04-26 23:06:35 +02:00
John Ralls
0106a771d0 Bug 795039 - Crash on startup using Technicolor Style sheet in report
Take 3: Catch encoding exceptions from trying to read a string into
Scheme using scm_from_utf8_string and try again using
scm_from_locale_string. If that throws too, give up and log a
warning.
2018-04-26 13:01:00 -07:00
John Ralls
c443160737 Fix Travis failures from transcoding fixes. 2018-04-23 14:02:24 -07:00
John Ralls
14c30344c2 Work around libstdc++ weirdness with codecvt destructor. 2018-04-22 16:51:01 -07:00
John Ralls
35cd165bec Bug 795134 - Improper handle of unicode character in username
Part 1: gnc-filename-utils didn't manage the encoding differences
between Windows (UTF16) and GLib (UTF-8).
2018-04-22 13:55:36 -07:00
Geert Janssens
451bbd53d9 Fix another date test
This may fix this crasher bug on windows:
https://bugzilla.gnome.org/show_bug.cgi?id=795040
However on linux it only fixes a warning so I can't be sure
until after the next nightly.
2018-04-18 19:07:30 +02:00
John Ralls
cad6bb4272 Bug 792105 - Startup takes several minutes, take two.
First, remove the unnecessary locale push & pop on <CT_TIME64>load.

Second, the registry accesses were caused by using g_win32_get_locale
to convert the Microsoft locale strings to POSIX ones. We don't care
what kind of string we get as long as we can pass it back to setlocale,
so remove that.

Third, gnc_push/pop_locale were used only in backend/dbi in a
very limited way and did much more than was necessary, so
convert them to C++ inlines in gnc-backend-dbi.hpp that does
only what we need them to.
2018-04-17 16:32:45 -07:00
John Ralls
39aecb7610 Bug 794936 - 3.0 does not open previously saved sqlite3 files...
properly - corrupted business data

Turned out to be a pointer/value mismatch between <CT_NUMERIC>load()
and most of the setter functions, so the address was getting set
as the value.
2018-04-17 16:32:44 -07:00
Geert Janssens
3138229cf6 A few whitespace fixups 2018-04-17 23:04:21 +02:00
Geert Janssens
06db9bcf2b Fix crash when loading sql book with posted transactions
This crash started to appear as of commit 80dbb9940b because the sequence
of split loading has changed as a result of the query optimizations.
Invoice transactions get loaded before the general transaction loading happens.
However because of this, when an invoice transaction was encountered again
during general transaction loading, it was (correctly) not created again
AND (incorrectly) not opened for subsequent editing. This caused
an assert to fail when the splits for this transaction are loaded
shortly afterwards. The solution is simply to ensure all transactions
are opened for editing during the general transaction loading call.
2018-04-17 23:04:21 +02:00
Geert Janssens
80dbb9940b Fix a couple of warnings introduced by commit 01420adb99
In addition make the code really use an inner join if no additional conditions are set
which gives better performance on at least postgresql
2018-04-17 19:45:39 +02:00
Geert Janssens
87f94abc8d Bug 794916 - Fails to find environment file at startup when installation prefix is '/opt' 2018-04-16 23:25:37 +02:00
John Ralls
40a266fc62 One more catch-by-value error. 2018-04-14 16:03:04 -07:00