Commit Graph

20228 Commits

Author SHA1 Message Date
John Ralls
4fe12f5422 Some more magic number replacements. 2018-09-21 14:32:03 -07:00
John Ralls
87533fe4bc Catch std::underflow_error as well as std::overflow_error.
Any operation that can overflow will throw an underflow if it's a
negative number. The C interface needs to catch both to prevent
unhandled exception crashes,
2018-09-21 14:28:49 -07:00
John Ralls
6d2ef90313 Fix a magic number. 2018-09-21 13:00:34 -07:00
John Ralls
dd10ac8bc7 Don't need NANOS_PER_SECOND anymore. 2018-09-21 13:00:19 -07:00
John Ralls
80a4591736 Bug 786708 - GnuCash won't load currency fractions larger than 1000000.
Also create larger fractions for the account dialog.
2018-09-21 12:59:50 -07:00
John Ralls
70bc472ffe Revert "[net-charts] deoptimize accounts-list"
This reverts commit 941acee04e. It did
indeed deoptimize creating a list of split-balances for time reports.
2018-09-20 17:25:44 -07:00
John Ralls
39575f2272 Bug 784420 - "Save changes on closing" window waits 2^32 seconds when...
"Time to wait for answer" is set 0.

Set minimum value of 1 for the save_on_close_adj.
Disable the associated spinner if the timeout is disabled.
Protect secs_to_save from rolling over if it's already 0.
2018-09-20 17:19:01 -07:00
John Ralls
77fb01db82 Merge branch Christoph Holterman's 'python-query-test' into maint 2018-09-20 10:56:01 -07:00
Christoph Holtermann
54cb3358ce add basic test for python query
add test for creating query object and setting search_for
related to Bug 796137 and fix in commit 1a7c5b9a32
2018-09-20 18:54:49 +02:00
John Ralls
2d565215cd Fix localedir relocation.
Since LOCALEDIR is now always absolute we need to see if there's a
prefix and if LOCALEDIR is a subdir of PREFIX instead.
2018-09-18 16:08:48 -07:00
John Ralls
59a6ebc33a Fix TravisCI build failure. 2018-09-18 15:07:47 -07:00
John Ralls
0cf42a75b3 Bug 796858 - TypeError: in method 'qof_query_int32_predicate',...
argument 2 of type 'gint32' on gnucash.gnucash_core.QueryInt32Predicate

Add gint32 to typemap.
Also replace a couple of PyString_ calls leftover from Py2.
2018-09-18 10:23:11 -07:00
Frank H. Ellenberger
10811b8a43 Redo of commit 586cd70 2018-09-18 12:31:44 +02:00
John Ralls
a20a803c8e Merge Chris Lam's 'maint-optimize-interval-charts' into maint. 2018-09-17 17:46:28 -07:00
John Ralls
766dc9b2d5 CMake: Test for & set WORDS_BIGENDIAN, set _GNU_SOURCE.
Got lost in transition from autotools.
2018-09-17 17:42:53 -07:00
Frank H. Ellenberger
586cd70432 Update Overview of README
based on https://lists.gnucash.org/pipermail/gnucash-devel/2018-September/042748.html

Additional changed "http" to "https", where available.
2018-09-17 22:18:00 +02:00
Christopher Lam
395b42d620 [average-balance] add styling to data table 2018-09-17 07:28:09 +08:00
Christopher Lam
ce58549506 [invoice] mark strings in options as translatable 2018-09-17 07:28:09 +08:00
Christopher Lam
ad361d1e69 [invoice] Add customer/vendor ID in client section
This aims, but does not completely fixes bug 430259 or 742086 which
would require data model changes. It upgrades invoice.scm to add the
customer/vendor/employee internal ID. Job invoices will display the
job owner's ID.
2018-09-17 07:28:09 +08:00
Christopher Lam
941acee04e [net-charts] deoptimize accounts-list
This aims to partially undo commit 8aed5c3f66.
2018-09-17 07:28:09 +08:00
Christopher Lam
77063afa73 [report-utilities] improve (gnc:account-get-comm-value-interval)
This commit will marginally speed up this function when
include-children? is #t. The original code would create a new query
for each descendant. This commit will create one query only for all
accounts when include-children? is #t. Unfortunately there is no
actual live code whereby include-children? is enabled. Anyway this
code is cleaned up.
2018-09-17 07:28:09 +08:00
Christopher Lam
984501e951 [report-utilities] improve (gnc:account-get-comm-balance-at-date)
This improves (gnc:account-get-comm-balance-at-date) to
use (xaccAccountBalanceAsOfDate) instead of cycling through a split
list.

This function is used in numerous charts and should speed them up
tremendously.
2018-09-17 07:28:09 +08:00
Christopher Lam
2832b8e63c [report-utilities] compact functions 2018-09-17 07:28:09 +08:00
Christopher Lam
381293655f [test-charts] also test income-expense-barchart amounts 2018-09-17 07:28:09 +08:00
Christopher Lam
9bba9474cb [test-charts] add daily txns and test range
This test (for net-worth-barchart only) adds daily transactions from
1/1/70 for 100 days, and aims to test the date ranges for net-charts
is accurate.
2018-09-17 07:28:09 +08:00
Christopher Lam
3e9cd1fc11 [test-extras] augment (gnc:options->sxml) to allow tag stripping
An html render containing a <script>...</script> tag will not
typically be parsable by sxml. This augmentation will strip an html
tag from the render. Therefore we can use

(gnc:options->sxml ... #:strip-tag "script")

which will strip off the whole <script> section from the render, which
should usually then be parsable. Note: this is not foolproof, and does
not support nested <script> tags, and it will strip quoted "</script>"
tags too, but should cover common cases.
2018-09-17 07:28:09 +08:00
Christopher Lam
867aa78f91 [test-charts] add SRFI-64 teardown function 2018-09-17 07:28:09 +08:00
John Ralls
83b1b8adfc Fix typos. 2018-09-16 13:05:49 -07:00
John Ralls
162605f505 Fix Windows binreloc executable finding.
Taking into account the behavior of
g_win32_get_package_installation_directory_of_module when the last
directory element either is or isn't "bin".
2018-09-16 12:36:04 -07:00
John Ralls
06d836e66b Fix cursor handling in the register.
Broken by over-aggressively capturing the selection.
2018-09-16 11:19:26 -07:00
Geert Janssens
5057703d30 Sql backend - show progress similar to how it's done for xml backend
That is let the percentage increase gradually. The current granularity is still
very rough, but at least it gives an indication of getting closer to fully
loading the data. The previous configuration on the other hand only suggested
something was happening but with no indication where in the load process
gnucash was.
2018-09-15 17:48:37 +02:00
Geert Janssens
5775662b52 Raise edit level of all accounts before loading transactions and splits
This prevents calling xaccAccountRecomputeBalanceInCurrency on each split that gets added,
which was exponentially increasing load times. On a huge test book the
load time dropped from 53 minutes to 1m20s.
2018-09-15 17:05:16 +02:00
Geert Janssens
221c46585c Sql backend - load transactions before business objects to reduce individual slot queries 2018-09-15 16:38:55 +02:00
Geert Janssens
5609b704c5 Fix memory leaks in GncQueryView 2018-09-14 16:38:35 +02:00
Geert Janssens
62eb95c05c Fix memory leaks in gncOwnerGetBalanceInCurrency 2018-09-14 11:34:45 +02:00
Geert Janssens
4e71629966 Fix memory leak in xaccTransRetDateDue 2018-09-14 10:47:31 +02:00
Geert Janssens
33fae41aaa Fix 1-byte memory leak on first run 2018-09-14 10:01:38 +02:00
Geert Janssens
ee77f38f40 Fix first run dialog not appearing 2018-09-13 21:13:54 +02:00
John Ralls
10a21cbfac Merge branch 'Bug794526' into maint 2018-09-11 10:46:02 -07:00
Geert Janssens
48b29f5e91 Fix memory leak in char* type KvpValue and fix improper uses
The core issue was that the delete visitor was never called because its parameter
type (char *) didn't match the boost::variant type (const char *).
Fixing the visitor's parameter type also require a const_cast
back to char * because that's what g_free takes as argument.

The rest of this commit is merely fixing KvpValue instantiations that
tried to create a char* KvpValue from a stack based const string instead
of a heap allocated one. That would bomb out on calling the
delete visitor.
2018-09-10 19:49:43 +02:00
Geert Janssens
b866d7d955 Plug memory leak in xaccSplitDestroy
Splits were not marked for deletion if the transaction is read-only
and the account is not marked for deletion yet. The net result is
that split will not be freed later on.
However xaccSplitDestroy is also called from a Transaction's do_destroy.
At that point accounts are not necessarily marked for deletion yet (like
is the case when a datafile is closed). This turned out to be a problem
for invoice post transactions (which are also read only) and hence
would cause memory to leak.
2018-09-10 18:57:39 +02:00
Geert Janssens
196decf649 Merge branch 'maint-fix-test-report-utilities' of https://github.com/christopherlam/gnucash into maint 2018-09-10 14:48:04 +02:00
Christopher Lam
4d57df2293 [test-report-utilities] changes to make tests locale independent
1. LC_ALL should set default-report-currency to USD
2. change test monetary output from list-of-strings '("$25.00") to
monetary pairs '(("USD" . 25)) which should be locale independent.
2018-09-10 20:09:45 +08:00
Geert Janssens
1117027f72 An empty GValue is interpreted as NULL reason, which is still a valid cache
Ignoring this would make caching almost useless as there are typically
only very few read-only transactions.
2018-09-10 10:24:49 +02:00
John Ralls
f219bc45aa Bug 794526 - Python bindings can't find loadable modules.
Always use absolute paths for configured directories (BINDIR etc.)
Abstract out the guts of gnc_gbr_find_foo_dir for foo in lib, bin, and data.
etc requires special handling because of the way it's treated if prefix
begins with /opt.

Always fall back on the configured directory if binreloc is disabled and
no default is passed in.
2018-09-09 16:36:39 -07:00
John Ralls
a19dcc7bd4 Fix crash when there's no TRANS_READ_ONLY_REASON slot.
Unsetting an empty g_value raises a fatal error, causing tests to fail
in some environments.

g_free() handles NULLs itself, no need to protect it.
2018-09-09 15:02:53 -07:00
Geert Janssens
b2d99615ab Fix if clause
Spotted by Kevin Hale Boyes
2018-09-09 23:36:41 +02:00
Geert Janssens
d069b67d48 Fix memory leak in xaccTransGetReadOnly
In addition implement a cache for this value as suggested in the comments
as this function is called on every transaction commit.
2018-09-09 22:50:05 +02:00
Geert Janssens
3634e8f59d Fix memory leak using qof_instance_get on a GncGUID
The underlying boxed type will return a copy so we should free this
when no longer needed.
2018-09-09 22:50:05 +02:00
Geert Janssens
3845611f30 Plug memory leak in register code
The table storing cell dimensions was never freed. The size of this table is
directly proportional to the number of cells in the register. So the more
transactions/splits in a register, the more memory was leaked - each time
a register was opened and closed. With my huge test book I saw leaks of
4Mb-10Mb per page that was opened/closed.
2018-09-09 22:50:05 +02:00