Commit Graph

198 Commits

Author SHA1 Message Date
Christopher Lam
02bb981daa [test-extras] upgrade env-transfer-foreign to update pricedb 2018-06-16 14:18:30 +08:00
Robert Fewell
1f14d0f629 In qof_scan_date returns valid date when day and month are 0
If you start typing a date in the register with the enable autoreadonly
option starting with a 0, gdate complains when trying to create a valid
date.
2018-06-09 15:04:27 +01:00
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
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
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
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
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
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
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
40a266fc62 One more catch-by-value error. 2018-04-14 16:03:04 -07:00
John Ralls
01420adb99 Bug 772776 - VERY large queries (over 11000 fields in IN clause) slow...
down GnuCash

Replace with joins or subqueries. Affords a 20% speedup on Windows.
2018-04-14 10:18:01 -07:00
Geert Janssens
dcfc1280bd Base invoice posted status on the presence of a posted transaction rather than a posted account
Bills and invoices that are posted and subsequently unposted again still store their
posted account internally as a convenience to the user (upon reposting the old
account will be offered by default) so it's not a reliable test for the posted state.
The posted transaction on the other hand is guaranteed to only exist when the invoice is
posted. This should fix a slew of small and perhaps larger side effects, such as
a posted bill still appearing as editable, critical warnings when creating new bills/invoices
and so on.
2018-04-14 18:46:26 +02:00
John Ralls
4a97269e4b Correct a g_log_level in test_gnc_pricedb_lookup_day. 2018-04-12 15:17:01 -07:00
John Ralls
85cc574d50 Prevent throw in gnc-pricedb.
If a price lookup is given an invalid time64/timespec (i.e. INT64_MAX)
then just return NULL instead of trying to find the nearest price.
2018-04-12 15:17:01 -07:00
John Ralls
16ba1e39b1 Bug 795080 - Some dates reset to 01/01/1970
An odd corner case: BST apparently came off of DST at 23:00 26 Oct 2014,
so midnight that day was ambiguous about being DST or not; that causes
the local_date_time constructor to throw in spite of the tm.is_dst element
being 0 (meaning pick standard time).

Instead of just failing in that case, try constructing a local_date_time
three hours later then adjust it back three hours. If *that* doesn't work
then throw a std::invalid argument.
2018-04-12 15:17:01 -07:00
John Ralls
c05aeb85ec Merge Bill Nottingham's exception type fix into unstable. 2018-04-09 15:12:56 -07:00
John Ralls
7a0f0d57c8 Bug 782144 - git-master - Save Corrupts Data File / Not Open Data File
After much thrashing this turned out to be caused by a date string
with a 3-digit year and that caused an unexpected boost::bad_cast
exception from boost::posix_time::time_from_string().

To prevent that and anything like it, pre-parse the string with
regular expressions to classify them and split out the timezone
if there is one. If neither (perhaps eventually none) of the
regexes match throw std::invalid_argument. The C function will
catch this and return 0.
2018-04-08 17:37:39 -07:00
Bill Nottingham
434dd9520c Adjust catch syntax to avoid GCC8 warnings. 2018-04-03 22:02:44 -04:00
John Ralls
f084fc67f7 Catch guid_syntax_exception in build_bayes. 2018-03-31 17:11:36 -07:00
Geert Janssens
4053f2ca53 Fix read and write of business counters and counter_formats
These are book options, but not stored under the default options frame (sigh)
So add exception code to properly access them.
2018-03-31 18:27:43 +02:00
Geert Janssens
d6a5cc9feb Merge branch 'imap-editor-fix' of https://github.com/Bob-IT/gnucash into unstable 2018-03-31 17:09:45 +02:00
Christopher Lam
f910d931f7 gncInvoice: complete removal gncInvoiceDateExists 2018-03-31 05:35:49 +08:00
Christopher Lam
b99dee1736 Replace gncInvoiceDateExists to gncInvoiceIsPosted
This commit partially reverts commit 862956a760 which exported
gncInvoiceDateExists. Remove this API and use gncInvoiceIsPosted
instead.
2018-03-31 05:35:49 +08:00
John Ralls
a23f103ebb Bug 794730 - SIGSEGV when entering an exchange rate, Part 2
91f4b19 changed the test for gncInvoiceDateExists from date != 0
to date != INT64_MAX, which isn't backwards compatible, so test
for both. But the submitted file had a posted date of -1 so
gncInvoiceIsPosted returned true anyway. That's not consistent with
the logic in dialog-invoice.c, which checked gncInvoicePostedAcc != NULL,
a better test. The result was that the "Post" button lit up but
gncInvoicePost returned immediately, doing nothing, so change
gncInvoiceIsPosted to use gncInvoicePostedAcc instead.
2018-03-30 11:19:51 -07:00
Robert Fewell
255d7194d8 Fix the gtests for the changes made to ImapInfo structure 2018-03-29 17:57:24 +01:00
Robert Fewell
6c43c3afe0 Fix Imap Editor to reflect the changes in kvp paths
There were several problems that broke the Imap Editor that have been
fixed due to kvp changes. The import-map-bayes entries were being added
to the tree view based on the number token entries squared. Retrieving
import-map entries resulted in an empty list and also deleting entries
from the tree view failed.
2018-03-29 17:32:57 +01:00
fell
9b8901248c Merge branch 'maint' into unstable 2018-03-15 18:12:03 +01:00
fell
fdfa6f528c Merge branch 'maint' into unstable 2018-03-10 11:06:59 +01:00
John Ralls
867fdce4e4 Gcc-4.8 doesn't have std::codecvt.
Use boost::locale::conv::utf_to_utf instead.
2018-03-09 16:28:00 -08:00
John Ralls
c3180ab374 Operator << fix. 2018-03-09 13:07:29 -08:00
John Ralls
5520fae838 Bug 793941 - 2.7.4: test failure on i686: 59 - test-gnc-timezone
Don't test before 1916, that's not a common GnuCash use-case.
2018-03-06 09:56:13 -08:00
John Ralls
36d729652b Speed up GUID equality comparison. 2018-03-06 09:48:38 -08:00
Geert Janssens
e2d69b174e Merge branch 'master' of https://github.com/nielsegberts/gnucash into unstable 2018-03-05 16:54:24 +01:00
Christopher Lam
4f98391a27 test-TR: unit tests
initial attempt
2018-03-01 20:55:17 +08:00