Commit Graph

1436 Commits

Author SHA1 Message Date
Christopher Lam
ae7eb9b3ad [gnc-pricedb] extract common code into get_nearest_price
Extracts common code in:

* gnc_pricedb_get_nearest_before_price
* gnc_pricedb_get_nearest_price
* gnc_pricedb_get_latest_price
2021-04-26 07:16:25 +08:00
Christopher Lam
a2f5223148 [gnc-pricedb] use g_list_find and plug memory leak
found_coms was not being freed.
2021-04-26 07:16:25 +08:00
John Ralls
ed486a58a4 Fix duplicate trading accounts.
In many cases GnuCash would create a new trading account hierarchy
when one already existed because gnc_account_lookup_by_type_and_commodity
didn't check the account presented and didn't recurse down the
account hierarchy correctly.
2021-04-24 15:51:32 -07:00
John Ralls
2258e7a44e xaccAccountTypes was backwards
vs. the documentation. The unit tests and dialog-account were similarly
backwards, but the use in gnucash/import-export/ofx followed the docs.
2021-04-24 15:51:32 -07:00
Christopher Lam
5ce8f78f77 Merge branch 'maint' 2021-04-24 23:16:22 +08:00
Robert Fewell
e535ba5411 Change some functions to use const gnc_commodity for gnc_pricedb 2021-04-23 11:56:15 +01:00
Robert Fewell
e75308e684 Rename a couple of gnc-pricedb functions that have not been used.
To be more consistent change gnc_pricedb_lookup_latest_before_t64 and
gnc_pricedb_lookup_latest_before_any_currency_t64 to be of the form
'_nearest_before_' and add a missing utest.
2021-04-23 11:56:15 +01:00
Robert Fewell
d3bd7fda61 Add unit tests for new gnc-pricedb functions 2021-04-23 11:56:15 +01:00
Robert Fewell
4a491f7cde Change a couple of docbook definitions in gnc-pricdb.h 2021-04-23 11:56:15 +01:00
Robert Fewell
05507008c5 Add retrieval functions for price before the date given
Add a new function, gnc_pricedb_convert_balance_nearest_before_price_t64
that retrieves the balance using the last price dated before a
specified date like today for the preset value. This uses another new
function gnc_pricedb_get_nearest_before_price to do the retrieval.
2021-04-23 11:56:15 +01:00
Robert Fewell
b54c30e03d Bug 798148 - Chart of Accounts page Present(xxx) value wrong
If for some reason you have price information in the future for a
security, the present value is based on the price retrieved for the
greatest date and not a price which is before the current date.

To fix this use the 'xaccAccountGetBalanceAsOfDateInCurrencyRecursive'
function.
2021-04-23 11:56:15 +01:00
John Ralls
bbb4113a5a Bug 798156 - glib 2.68.0 breaks gnucash
Move all of the #include <glib> to before the extern "C" blocks
so that the include guards will protect against headers inside
the extern "C" block also including glib.h.
2021-04-20 11:03:23 -07:00
John Ralls
f7f35faefe Bug 797928 - Since last run asks for security price when no shares traded
Refactor a bit to ensure that the same price variable names and transaction
currency is used for both extracting the variables and retrieving
any required exchange rates, and that splits with no formula are
ignored in both cases.
2021-04-19 14:25:59 -07:00
Robert Fewell
33b8a19253 Add depreciation warnings for the removal of individual option tool tips 2021-04-18 12:17:51 +01:00
Robert Fewell
02a6a0ae4a Remove the function gnc_option_permissible_value_description
Remove function and scheme using this function which deals with
individual tool tips on multi-choice options.
2021-04-18 12:17:51 +01:00
John Ralls
4eaa10c6be Another extern-C glib.h, for Windows this time. 2021-04-13 16:56:55 -07:00
Christopher Lam
67e65d436c Remove duplicate definitions 2021-04-02 09:37:14 +08:00
Christopher Lam
9b671b2039 [date-utilities.scm] remove unused date selectors code & string 2021-03-30 18:09:44 +08:00
Christopher Lam
b06ee5efaf Merge branch 'maint' 2021-03-30 18:09:08 +08:00
Christopher Lam
d316b01da7 [date-utilities] deprecate unused date selectors 2021-03-29 20:14:18 +08:00
Christopher Lam
d28ff20ff7 Merge branch 'maint' 2021-03-29 17:29:19 +08:00
Geert Janssens
a4cab54afc i18n - Reuse strings for less translation work 2021-03-28 20:51:19 +02:00
John Ralls
170502c6c5 Bug 797906 - GnuCash data file is locked after a "save-as"...
to mysql database.

It's more general, any save-as to a different backend type, i.e.
xml->sql or sql->xml, left the previous book locked.

Ensure that the session is ended and the book unlocked in the
backend's destructor. This also fixes a memory leak in the SQL
backend because the GncSqlConnection wasn't being deleted.
2021-03-23 11:27:37 -07:00
John Ralls
27435b1038 Don't filter use of TTInfo file section based on sizeof time_t.
The whole point of GncDateTime is to work around 32-bit time_t.
2021-03-22 14:23:23 -07:00
John Ralls
b40589244c Fix test-gnc-datetime failure on Ubunutu. 2021-03-22 14:18:24 -07:00
John Ralls
c49b45d8f1 Finish the glib 2.67 fixes for CI tests. 2021-03-22 14:02:37 -07:00
Geert Janssens
e9dfd0d9ea Still more fixes for Arch ci failure 2021-03-22 21:30:41 +01:00
Geert Janssens
cb04365013 More fixes for Arch ci failure 2021-03-22 21:14:34 +01:00
John Ralls
1221d7ebc1 Bug 798150 - Error on report over time
Extract functions LDT_from_date_time and LDT_from_date_daypart
to avoid duplicate code. Handle date-times in start-of-DST transitions
and better handle those in end-of-DST transitions. Test the results.
2021-03-21 15:55:08 -07:00
John Ralls
ebb5eb1f17 Fix GncDateTime::format_zulu to emit the UTC timezone.
Instead of the GncDateTime's timezone with the UTC timestamp.
2021-03-21 15:55:08 -07:00
John Ralls
3a35514d84 Fix the implementations of gnc_foo_get_day_neutral.
As implemented these returned 10:59 AM local on the day but neutral
time is 10:59 UTC.
2021-03-20 09:45:38 -07:00
Christopher Lam
2a2f080813 Merge branch 'maint' 2021-03-18 07:36:40 +08:00
Geert Janssens
fbabcd58e0 Remove dead code 2021-03-17 16:24:22 +01:00
Geert Janssens
b9208eccbf Remove duplicate declaration
The function is also declared and defined in gnc-locale-utils
2021-03-17 16:24:22 +01:00
Geert Janssens
e973a1b60d Drop default locale currency special case for euro
The condition mentioned in the comment no longer applies.
All European locales on Windows (MingW64) properly present EUR
as currency these days
2021-03-17 16:24:22 +01:00
Frank H. Ellenberger
4a983761d7 Fix a typo in a comment of the last commit 2021-03-16 06:34:08 +01:00
John Ralls
a11065b823 Fix fencepost error in calculating the week_num for POSIX timezone rules.
Fixes CI failure caused by US starting DST in 2021, a year in which
March began on a Monday.
2021-03-15 17:07:16 -07:00
John Ralls
a6276708c0 Bug 797630 - Check for missing dependencies of 'Get Quotes'...
to avoid Gnucash crash.

We already did, just not in the right order to get the error to
percolate up to price-quotes.scm.
2021-03-14 10:48:25 -07:00
John Ralls
8e41857014 Catch more exceptions in gnc_numeric_convert
To enable fixing https://bugs.gnucash.org/show_bug.cgi?id=798132.
2021-03-12 13:47:24 -08:00
Christopher Lam
87473ed5f9 Merge branch 'maint' 2021-03-12 23:14:51 +08:00
Dong Lin
75209c024f Update price database for imported transactions
When a transaction is added from the ledger, price database is updated properly.
But if the transaction is imported, there is no price db update.

This change adds the proper pricedb update in the import path (qfx/ofx/qif).
Tested with make check
2021-03-09 10:39:56 -08:00
Sumit Bhardwaj
df579c257b Replace g_memdup by memcpy
GLib is deprecating g_memdup. Since older versions of GLib
wouldn't have g_memdup2, this PR replaces occurrences of
g_memdup by memcpy.
2021-03-08 15:14:17 -08:00
Christopher Lam
3739d9121c [date-utilities.scm] typo fix and deprecate unused functions 2021-03-07 13:35:39 +08:00
Frank H. Ellenberger
93e2829ee5 Merge PR #899 into maint 2021-03-02 01:17:26 +01:00
luz paz
16b4976381 Fix typos in libgnucash/
Found via `codespell -q 3 -L ans,ba,parm,parms,numer`
2021-03-02 01:15:32 +01:00
Christopher Lam
e79db92d8d [Split.c] xaccSplitListGetUniqueTransactionsReversed
Same as xaccSplitListGetUniqueTransactions but doesn't reverse the
list prior to returning. To be used by gnc-tree-model-split-reg.c

Several optimizations

* doesn't call g_list_find and g_list_append for every iteration
* uses g_hash_table to cache list of txns already added instead of g_list_find
* does not reverse the result, thereby returning a reversed list.
2021-02-24 09:08:25 +08:00
Christopher Lam
b2b8792110 prepend-and-reverse instead of O(N^2) append 2021-02-24 09:08:25 +08:00
Frank H. Ellenberger
6bc8679932 I18N: replace several spourious spaces 2021-02-22 17:56:50 +01:00
Alex Aycinena
9d74333d82 2nd Update Form/Schedule line references for 2020 for the US Income Tax Report. 2021-02-16 18:41:20 -08:00
Alex Aycinena
320e84b990 Update Form/Schedule line references for 2020 for the US Income Tax Report. 2021-02-16 16:21:31 -08:00
John Ralls
7a7c26f87e Move glib and gtk includes out of extern C for tests.
Needed to compile with glib 2.67 and later.
2021-02-16 13:23:48 -08:00
Bill Nottingham
c0f2c3ae25 Fix build with glib2 2.67.x.
glib headers should not be included with 'extern "C"'.
2021-02-16 13:23:16 -08:00
Christopher Lam
092040c7fe Merge branch 'maint' 2021-02-16 18:44:02 +08:00
John Ralls
4359243c08 Move glib and gtk includes out of extern C for tests.
Needed to compile with glib 2.67 and later.
2021-02-15 12:37:09 -08:00
Christopher Lam
779c0521e0 [options.scm API] yank canonically-tabbed parent-subtotal-mode
'canonically-tabbed option is buggy and has never graduated out of
experimental for 17 years. Time to put it to rest.

All previous saved reports with this option will be switched to 't
i.e. parent-subtotal-mode enabled..
2021-02-15 08:59:50 +08:00
Bill Nottingham
f60b6354f8 Fix build with glib2 2.67.x.
glib headers should not be included with 'extern "C"'.
2021-02-13 16:35:27 -05:00
Christopher Lam
c20a588e0f Don't use g_list_append unnecessarily 2021-02-10 07:09:02 +08:00
John Ralls
ba0e412815 Bug 798112 - An error occurred while processing mysql ...
A "Feature" of MYSQL is that it allows C-style backslash escapes
in string constants and replaces them with the actual character
(e.g. \n is converted to 0x0a). This causes round trip problems
if the escape is one of the allowed ones and a MYSQL error if it
isn't.

Disable the feature so that MYSQL follows the SQL standard.
2021-02-07 13:53:00 -08:00
John Ralls
fe4f9ed64a [test-backend-dbi] Fix copying hidden property.
So that it actually copies it to the *other* root account.
2021-02-07 13:50:29 -08:00
Micha Lenk
9386b276e5 Make prototypes static for autoclear unit test
With the explicit prototypes not marked as static unit test builds on Debian
Buster (using buster-backports) fail with

error: testing::internal::ParamGenerator<TestCase*> gtest_InstantiationAutoClearTestAutoClearTest_EvalGenerator_() was declared extern and later static [-fpermissive]

According to the comment preceding the declaration the only intent of the
explicit prototype (in newer versions of googletest implicitly defined by the
GTEST macros) seems to be to silence a warning which would cause a build
failure on Ubuntu 18.04 when using -Werror.

Builds on Debian unstable seem to build just fine without this explicit
declaration, hence I consider it safe to just drop it. However, builds on
Ubuntu 18.04 then fail (see above).

Making the prototypes as static should make both build environments happy.
2021-02-07 13:50:29 -08:00
Christopher Lam
0d196bfb65 Merge branch 'remove-scheme-deprecated-module' #891 2021-02-01 21:43:59 +08:00
Frank H. Ellenberger
f556ad35ef Merge branch 'maint' 2021-01-31 23:17:19 +01:00
John Ralls
12ad4fadae Bug 798101 - Do not #undef __STRICT_ANSI__
Remove defines and undefines for Windows, they were needed with
MinGW classic but are not with MinGW-w64.
2021-01-30 17:38:37 -08:00
Christopher Lam
d16f39046d Merge branch 'maint' 2021-01-30 07:13:32 +08:00
Christopher Lam
bbcffa3eca Remove deprecated scheme modules 2021-01-30 00:42:20 +08:00
John Ralls
0f8d9f6d7c Bug 798093 - Changing the symbol/abbreviation of a security after...
the trading account was created breaks GnuCash.

Introduces a new function, gnc_account_lookup_by_type_and_commodity
that does that, though it also looks at name for the one special case
of finding/creating the Namespace placeholder account. Adds a parameter
checkname to xaccScrubUtilityGetOrMakeAccount to flag whether to look
for the name.

Namespaces aside this makes it possible for the user to rename trading
accounts or securities independent of each other.
2021-01-27 17:44:21 -08:00
John Ralls
bcbebe62b1 Make xaccScrubUtilityGetOrMakeAccount static and remove ScrubP.h
It being the only declaration in ScrubP.h
2021-01-27 17:44:21 -08:00
Christopher Lam
2fa5cba250 Merge branch 'maint' 2021-01-25 22:25:20 +08:00
John Ralls
b66eab2583 Bug 798100 - Equity totals calculating incorrectly
Prevents creation of non-currency opening balance accounts.
2021-01-24 16:53:02 -08:00
Christopher Lam
ddc86579c0 Merge branch 'master-remove-deprecated' #855 2021-01-24 09:25:08 +08:00
Frank H. Ellenberger
84cc64daed I18N: Remove annoying stars from translator comments 2021-01-22 10:19:54 +01:00
John Ralls
ffa2f606e3 Fix use-after-free in test_xaccTransEqual. 2021-01-17 11:51:12 -08:00
Sebastian Ovide
49ce463aaa
sorting sources
I've did a small bash script that retrieve the sources from gnc-fq-dump and try to find one source that has the specific stock. At that point I've noticed that the sources returned by Finance::Quote have always a different order. Just wondering if it is done in that way intentionally (?)
2021-01-10 15:09:51 +00:00
Christopher Lam
c5e7406c9f [account.cpp] remove deprecated function 2021-01-04 08:46:09 +08:00
Christopher Lam
ebcb0bc478 [master] remove deprecated scheme functions 2021-01-04 08:46:09 +08:00
Allan Nordhøy
383b0b2f19 Replace 'Non Bayesian' with grammatically more correct 'non-Bayesian'. 2021-01-03 07:01:14 +01:00
Christopher Lam
ca606e7694 [c-interface.scm] deprecate gnc:last-captured-error 2021-01-03 06:28:31 +08:00
Christopher Lam
f1c1fca023 [account.cpp][API] deprecate xaccAccountCountSplits 2020-12-28 09:48:06 +08:00
John Ralls
c8c58bf349 Add test_autoclear_SOURCES to the dist list for inclusion in the tarball. 2020-12-26 17:23:28 -08:00
John Ralls
ae66da9632 Fix test-gnc-timezone failure caused by latest zoneinfo release.
See the comment for details.
2020-12-26 13:46:09 -08:00
Christopher Lam
455ae59a56 [app-utils] fix dependency chain 2020-12-24 22:51:08 +08:00
Christopher Lam
0510ecfe85 [c-interface] internal defines must be declared first
An internal (define) cannot be after a statement such
as (issue-deprecation-warning). This rule was strict in guile-2.2 but
relaxed in guile-3.0, hence, the mixed results in CI.
2020-12-24 22:08:44 +08:00
Christopher Lam
bf671d4fc7 [c-interface] Deprecate gnc:make-string-database
It's only used by date-utilities.scm

This removes the date-utilities -> c-interface dependency.
2020-12-23 23:58:09 +08:00
John Ralls
c2ba88d91d Add MAKE_LINKS to app-utils and qif-import scheme targets.
Needed to successfully build on Windows.
2020-12-13 16:57:48 -08:00
John Ralls
2ff3bf5877 Echo into CMakeLists.txt rename of gmock-qofqury to fake-qofquery. 2020-12-13 11:52:32 -08:00
Christopher Lam
dcf90b98c0 [options.scm] use srfi-1
because list-index (used in options.scm) wants srfi-1 version rather
than the one in guile-core. the guile-core one crashes when editing options.
2020-12-09 21:54:26 +08:00
Christopher Lam
5bd65a6b22 [modularise] (gnucash locale) 2020-12-09 06:40:07 +08:00
Christopher Lam
59ec912928 [modularise] (gnucash app-utils) 2020-12-09 06:40:07 +08:00
Christopher Lam
0630c214f0 [options.scm] move gnc:options-fancy-date to business-options.scm
it needs gnc:fancy-date-info which is defined in business-options
2020-12-08 22:50:15 +08:00
Christopher Lam
51e3a65762 [options.scm] typo ref -> list-ref 2020-12-04 21:33:31 +08:00
Christopher Lam
a2ef6ed6a5 Use proper format syntax 2020-12-04 18:37:35 +08:00
Christopher Lam
854c117820 [trep-engine] move currency options into their own section
tidier, also includes backward compatibility with saved-reports
2020-12-02 18:46:25 +08:00
John Ralls
7a8a0f40b1 Fix missing space in warning message. 2020-11-29 10:59:25 -08:00
Christopher Lam
d11bdb3e3a Bug 798015 - cash flow numerical-overflow
error is caused by pricedb containing an invalid gnc_numeric
price. multiplication of (invalid) price with amount causes a report
crash.

Fix: if invalid price, return zero for amount converted to report
currency.
2020-11-22 23:35:46 +08:00
Christopher Lam
72982de588 Revert "[date-utilities] Convert reldate list into srfi-9 records"
This reverts commit 3be7935965.
2020-11-22 21:56:42 +08:00
Christopher Lam
8b5dd55dc4 Revert "[c-interface] deprecate gnc:make-string-database"
This reverts commit b67bf4b761.
2020-11-22 21:56:35 +08:00
Christopher Lam
b67bf4b761 [c-interface] deprecate gnc:make-string-database 2020-11-22 21:21:58 +08:00
Christopher Lam
3be7935965 [date-utilities] Convert reldate list into srfi-9 records 2020-11-22 21:14:13 +08:00
Ralf Habacker
63580d91ba Add feature GNC_FEATURE_EQUITY_TYPE_OPENING_BALANCE
When the above function is activated, the slot 'equity type' is used and
set in relation to opening balances and the checkbox for marking the
opening balance in the accounts dialog can be changed.
2020-11-16 08:51:51 +01:00
Ralf Habacker
f8dcd23023 Add support for the opening balance accounts flag
Up to now, opening balance accounts have been identified by means of
fixed names and their translations, which in some cases is not
appropriate.

With this commit, therefore, opening balance accounts can now be
identified by a special slot, which should solve the above problem.

in gnc_find_or_create_equity_account(), when querying the
EQUITY_OPENING_BALANCE type, the system now first searches for an
account with an existing 'equity-type' slot having the value
'opening-balance' and returns it as an opening balance account if
one exists. If no corresponding account is found, the search is
continued as before. An account found in the process is automatically
given the status of an opening balance account (it is given an
'equity-type' slot with value 'opening-balance') to simplify the
future search.

The opening balance status of an account is visualized in the account
settings dialog with a check box. If a Gnucash file does not yet contain
an opening balance account, one can be selected in the account settings
dialog.

https://bugs.gnucash.org/show_bug.cgi?id=797836
2020-11-16 08:51:51 +01:00
John Ralls
e09a26ba3a Merge Christian Gruber's 'test_import_backend' into maint. 2020-11-08 14:27:26 -08:00
John Ralls
26fa239f89 Merge Christian Klein's 'auto-clear-tests' into maint. 2020-11-08 13:44:41 -08:00
Cristian Klein
69789b2b93 [auto-tests] Stick to CodingStandard for member variables 2020-11-08 09:58:57 +01:00
Cristian Klein
f26215feae [auto-tests] Fix misspelling 2020-11-08 09:58:17 +01:00
John Ralls
2290fa7c22 Fix exception when converting to decimal values that reduce to N/1.
Before this the loop wouldn't terminate until the denominator had been
reduced to 0 and trying to create a GncRational with a 0 denominator
throws.
2020-11-07 16:22:18 -08:00
John Ralls
d03dc07b8d Remove redundant and incorrectly named constant. 2020-11-07 13:20:22 -08:00
John Ralls
3bcf57e7f2 Fix timezone transition times.
This is responsible for test failures on DST transition days.

See the comments in gnc-timezone.cpp for an explanation of why this is
correct. The rubric was tested on macOS, Arch Linux, Debian Unstable,
Fedora 33, and Ubuntu 18.04 to confirm universal applicability.
2020-11-07 11:02:54 -08:00
Robert Fewell
65b7b8c4a2 Section help on windows not working
Key and group names are case sensitive and in the gnucash-help.hhmap
file the section name is [MAP] so change gnc-help-utils.c to match
2020-11-06 13:05:42 +00:00
Cristian Klein
e5378b2048 [auto-clear] Make test more future-proof with GoogleTest 2020-10-30 09:42:05 +01:00
Cristian Klein
982cf86deb [auto-clear] Fix test with googletest 1.8 2020-10-30 09:42:05 +01:00
Cristian Klein
9d4c0b05db [auto-clear] Improve #include style 2020-10-30 09:42:05 +01:00
Cristian Klein
1cf7defee8 [auto-clear] Address feedback 2020-10-30 09:42:05 +01:00
Cristian Klein
9bf550d38f [auto-clear] Include test for ambiguous cases 2020-10-30 09:42:05 +01:00
Cristian Klein
5cd777b673 [auto-clear] Fix test: Add xaccAccountBeginEdit / xaccAccountCommitEdit 2020-10-30 09:42:05 +01:00
Cristian Klein
2faecb2074 [auto-clear] Avoid testing ambigous auto-clear 2020-10-30 09:42:05 +01:00
Cristian Klein
a1806a2f94 [auto-clear] Fix model 2020-10-30 09:42:05 +01:00
Cristian Klein
51715e454c [auto-clear] Add tests 2020-10-30 09:42:05 +01:00
McLayn
cebe6022c8 fix CZK partname to nominative singular 2020-10-30 00:40:02 +01:00
Christopher Lam
e833c8e1aa [utest-gnc-pricedb.c] test: gnc_pricedb_get_[latest|nearest]_price 2020-10-26 23:56:33 +08:00
Christopher Lam
2ecdd70e24 [gnc-pricedb.c][api] pull out composite pricedb price retriever
* tries direct price retrieval from pricedb.
* if fails, tries intermediate currency.
2020-10-26 23:55:51 +08:00
Christopher Lam
4d63eb922f [gnc-pricedb.c] copy convert_amount to convert_price 2020-10-23 09:49:27 +08:00
Christopher Lam
26e7eada37 [gnc-pricedb.c] refactor amount converters, use common code 2020-10-23 09:49:27 +08:00
Christopher Lam
78c8b03c5e [window-autoclear.c] cleanup, optimize, prevent UI lag
abort:
1. if too many splits lead to >1,000,000 reachable amounts
2. if the end_balance is the same as cleared_balance

also:
- g_free lists properly
- move knapsack algorithm to gnc-ui-balances.c
- show newly cleared splits in a new register: "Cleared Transactions"
- remove unneeded #includes
2020-10-23 09:11:29 +08:00
Robert Fewell
3c5066feb4 Change source files option-util.* for spaces and tabs 2020-10-22 14:30:46 +01:00
Robert Fewell
c11f4db96e Bug 345924 - Report options 'Reset Button' always flags changes
If a report is loaded with default settings and the 'Reset button' is
pressed the 'OK/Apply' buttons will be enabled which should not happen
as there are no changes to be made.

Fixed by resetting the changed flag on options load and then comparing
the current value to the default one when the 'Reset button' pressed.
2020-10-22 14:26:50 +01:00
Robert Fewell
8e5e3480ad Bug 797984 - Infinite loop while Check&Repair AR and AP accounts
If using the Check&Repair option from the Chart of Accounts on 'Account
Receivable or Payable' add has a voided transaction will cause an
infinite loop.

This occurs from checking the transaction split amount is zero in
gncScrubBusinessSplit and trying to delete it. As the transaction is
read only as a result of being voided this fails so add a further
condition for the 'else if' statement to include !is_void.
2020-10-20 14:45:44 +01:00
Robert Fewell
122cd682f6 Add some additional places where Check&Repair can be aborted 2020-10-20 14:43:39 +01:00
Robert Fewell
6ee537e1a7 Allow the Check&Repair routine to be cancellable from CoA
Add a callback for a keypress event when on the Accounts page that
checks for the Escape key and presents a dialog to confirm whether to
abort the Check&Repair. A similar dialog is used if you decide to quit
Gnucash while the Check&Repair is still running.
2020-10-20 14:42:32 +01:00
John Ralls
94a68dca7c Bug 797983 - v4.2 report numbers change over gnucash restarts;...
Price Database dropping user:price-editor entries.

A wider problem: QofInstance was unmarking itself dirty as long as the
backend raised an error and unconditionally marking itself non-infant.

This matters because the SQL backend depends on infant status to decide
whether to do an insert or update query; either will fail if the infant
status is wrong.

The price editor dialog clones a price having only its commodity set and
GncSqlPriceBackend declines to save if the currency isn't set. Since the
instance marked itself non-infant even though it wasn't saved subsequent
commits tried to use an update query and since the price wasn't in the
table that inevitably failed.

Requiring that QofBackend::commit should doing the marking-clean
required implementing it in the backends where it wasn't already.
2020-10-18 16:09:41 -07:00
Bill Nottingham
06110e2abd Fix warning about misleading indentation from recent gcc.
Patch by <law@redhat.com>
2020-10-15 08:38:00 +08:00
Geert Janssens
e8c321d954 Drop as dependency from gnc-module 2020-10-10 12:32:58 +02:00
Christopher Lam
39a6704169 [options.scm] rename new-owner-report "Links" to "Transaction Links" 2020-10-07 19:11:12 +08:00
Christian Gruber
6394b6491b fixup! Simplify type checking for GObject mockups 2020-10-05 22:48:52 +02:00
Christian Gruber
feba64624c Fix xaccTransSetNotes()
This is a bugfix for commit 954ce9577f
2020-10-05 22:20:02 +02:00
Christopher Lam
6eb2e36c2d minor optimisations, g_list_prepend then g_list_sort separately
if building a g_list incrementally, don't sort on each insertion.
2020-10-01 11:34:21 +08:00
Christopher Lam
e6486e9d95 deprecate xaccAccountCountSplits with include_children = FALSE
whereby xaccAccountCountSplits is called with with_children = FALSE,
test xaccAccountGetSplitList against NULL.
2020-10-01 11:34:21 +08:00
Christopher Lam
1b31c06b29 [Account.cpp] add gnc_account_and_descendants_empty (acc)
and deprecate xaccAccountCountSplits
2020-10-01 11:34:21 +08:00
John Ralls
5e6f9b3460 Fix some return of ptr-to-temporary errors
Flagged by new clang Apple version 12.
2020-09-25 12:31:52 -07:00
John Ralls
44fc52f5c6 Fix unnecessary copy in range-for loop
Flagged by new clang Apple version 12.
2020-09-25 12:31:13 -07:00
John Ralls
1c5561714d Fix ptr-comparison-to-string-literal error
A new error raised in the latest versions of gcc and clang.

The address of string literals is undefined in the C standard so the
compiler raises an error if one tries to test for string equality by
comparing them. A better fix would be to replace QOF_ID strings with an
int-based identifier; an even better one would get rid of QOF_ID
entirely and use the C++ type system.
2020-09-25 12:23:56 -07:00
Christian Gruber
e44cf9c61f Add missing C linkage statements 2020-09-23 19:59:40 +02:00
Christian Gruber
63969e8628 Remove unecessary include 2020-09-22 22:52:37 +02:00
Christian Gruber
d673c32e35 Mock methods should not neccessarily return mock objects 2020-09-22 22:52:37 +02:00
Christian Gruber
0e634c5446 Relax runtime type checks
Runtime type checks should only check for the mock up type, if
neccessary. If objects of another class than the mocked object itself
are processed, runtime type check should only check for the base-class
type. It should be possible to use mockup objects and non-mockup objects
within the same application.

The included headers are adapted accordingly.
2020-09-22 22:52:37 +02:00
Christian Gruber
99256c385b Add missing _get_type() functions of all mocked GObject classes
If a GObject is replaced by a mock up, its _get_type() function has to
be replaced as well. The replaced _get_type() functions have to return
the type of the mock up now.
2020-09-22 22:07:21 +02:00
Christian Gruber
833edd0b29 Add missing comment 2020-09-21 00:50:24 +02:00
Christian Gruber
bc80bbb325 Simplify type checking for GObject mockups
A type conversion function is introduced for each GObject mockup. This
function does a runtime type check and generates a GoogleTest failure in
case of any type error. This avoids checking GObject type twice.
2020-09-21 00:47:53 +02:00
Christian Gruber
b0906b5e2a Use MOCK_CONST_METHODn() macro instead of MOCK_METHODn() macro if necessary 2020-09-20 23:36:34 +02:00
Christian Gruber
5408854c28 Rename GObject type names of mock classes
According to a remark in PR #738 the lower case type name is changed.
Underscores should only be used between namespace and type name and
between type name and suffixes.
2020-09-20 22:33:51 +02:00
Robert Fewell
edaa0d7eea Fix some spaces on blank lines is source files 2020-09-18 16:13:35 +01:00
Robert Fewell
416e234232 Bug 797945 - Imap bayes conversion runs many times
When the Imap Editor is loaded, the bayes KVP entries are tested to see
if they are required to be converted to flat entries. This involves a
function that scans every account and if it finds entries that need
changing, the change is made and book property
GNC_FEATURE_GUID_FLAT_BAYESIAN is added so further scans are not made.

As the Imap Editor loops over the account list also, if there are no
bayes KVP changes then the conversion function gets called for every
account in the list. This can also happen to a lesser degree when doing
imports.

To stop this a flag is set once the convert to flat function has been
run so it only runs once and only lasts for the session.
2020-09-18 16:13:26 +01:00
John Ralls
9c8fa5cd2e Bug 797895 - Hang for a long time (9 minutes per account) importing...
a QFX file.
Bug 797945 - Tools -> Import Map Editor causes GnuCash to lock up.

Don't edit and commit the account if it has no BAYES_IMAP slots. Account
committing is extremely expensive.
2020-09-17 14:24:08 -07:00
Robert Fewell
7c1026783b Change the document link KVP symbol to original name
To maintain compatibility with any existing document link entries the
old 'assoc-head' and 'asooc_uri' entries will be used for the gsetting
and KVP entries.
2020-09-13 11:01:37 +01:00
John Ralls
843282f583 Merge John Ralls's 'assoc_title' into maint. 2020-09-11 11:41:42 -07:00
John Ralls
db626de68a Rename all Transaction and Invoice Association identifiers to DocLink.
To better reflect the purpose and for consistency with other software
(e.g. Libre Office).
2020-09-11 11:34:32 -07:00
John Ralls
50bf59d62e Rename Transaction and Invoice Associations to Document Links.
More clearly describes the actions and is more consistent with other
software (e.g. Libre Office).

This commit primarily changes the translatable strings, though it also
removes the Remove menu item because that can be done in the Manage
dialog box.
2020-09-11 11:34:31 -07:00
Robert Fewell
d0309b39d9 Bug 797935 - Strange formal register headers
The headers were made up from two parts, 'Tot' which was translated and
'Debit/Credit' which was not. Traced to some missing brackets around
the returned dflt_acct_debit_str and dflt_acct_credit_str.
2020-09-11 15:23:27 +01:00
Geert Janssens
ad8b602fe2 I18n - Uppercase option name to align with other option names 2020-09-09 22:22:48 +02:00
John Ralls
de0422da25 Merge G4js's missing-sentinels into maint. 2020-09-06 14:39:12 -07:00
Christopher Lam
f6d34f226f [Scrub.c] improve responsiveness of progressbar during scrub
Formerly would update progress bar every 100 splits. With scrub being
slow, it's nicer to update every 10 splits. Also remove
the (percentagefunc)(NULL, 0.0) which seems an error -- it would reset
the progressbar back to zero immediately.
2020-09-06 22:54:16 +08:00
Gaming4JC
cca4524055
Fix warnings: missing sentinel in function calls
When compiling with -Werror, GNUCash fails to build due to various error: missing sentinel in function call.
This patch resolves the issue by passing nullptr instead of C-style casting NULL.
2020-09-06 00:50:54 -04:00
jean
bbdd4f34b6 Bug 797900 - Crash caused by Quitting while Check and Repair All is running
The account tree page didn't have a "finish" function normally used to verify a page can close.
I added one, along with two flags that indicate whether a scrubbing operation is currently ongoing
and whether we should quit when the scrubbing is done.
The result is: If a user attempts to quit while scrubbing isn't done, an alert pops up asking whether the
user wants to abort the scrub. If so, the scrub is aborted (safely) and GC quits.
If not the app does not quit.

I have to say, I'm not sure this is the right way to do this. In my view, the right way would be:
- Disable the "quit" menu when scrubbing is happening (for some reason gnc_suspend_gui_refresh() does
not cause the quit menu to be grayed) so there's no chance of quitting while scrubbing is ongoing
- If needed, add an abort scrubbing button to the main window. Not sure whether that's desirable or not.

Let me know what you think: is what I have what we need, or would the above be better.
2020-08-27 16:59:55 -07:00
Christian Gruber
41c147a918 Use /* ... */ for multi-line comments 2020-08-24 23:31:08 +02:00
Christian Gruber
df6621f2b5 Add doxygen documentation to QofFakeQuery and QofFakeQueryPool 2020-08-24 23:13:23 +02:00
Geert Janssens
56210de9a2 Rename report option for consistency
In English each word in option and menu names starts with a capital letter.
Also eliminates a redundant translatable string.
2020-08-18 15:28:51 +02:00
John Ralls
6d44d0675e Reduce random transactions and iterations on test-lots.cpp.
No point in generating 320 transactions or running the test 10 times
for a simple does-it-crash test. Do it once with 32 transactions so
it takes less than one second instead of 16.
2020-08-16 16:05:15 -07:00
Christopher Lam
00efc1696a [Transaction.c] sanity check xaccTransGetAPARAcctSplitList
prevent segfault if trans is NULL
2020-08-16 17:55:57 +08:00
jean
a9f79cf79c Add a flag to the account structure to defer balance computation 2020-08-01 21:10:19 -07:00
Ralf Habacker
4df6493bc2 Fix API doc of gnc_account_lookup_by_code()
Taken from PR #762, but it is separate issue and rest of the PR needs
some discussion.
2020-08-01 07:25:20 +02:00
John Ralls
a93f3c198d Warn against using xaccTransGetSplit for iteration.
Instead of encouraging it.
2020-07-20 13:07:05 -07:00
Christopher Lam
d546a617ad ensure averaging-multipler returns exact numbers rather than floats 2020-07-19 17:46:01 +08:00
jean
705f0dbf9e Bug 797854 - Global Register Preference to prompt for interest payment is not being honored.
A new per-account preference is added to let the user decide whether the interest transaction dialog should be
opened automatically before the reconcile. This preference is only enabled for certain types of accounts and
the code that decides that was moved to Account.h as is it now used in two separate place.
2020-07-13 22:42:11 -07:00
Christopher Lam
428c8c501c [guile-3] change _ to G_
In guile-3 _ is a reserved symbol. Change to G_ by guile gettext
convention.
2020-07-12 19:03:26 +08:00
John Ralls
edd7efd951 Bug 797853 - Crash on 'Save As' in MacOS Mojave and Gnucash 4
Check and handle null books throughout GnuCash. Tests are left alone
because they should fail if there's no book.
2020-07-10 15:54:17 -07:00
Christian Gruber
861a2482fe Add a comment on using empty ctor for mock classes derived from GObjects 2020-07-10 23:03:01 +02:00
Christian Gruber
3d92d53917 Rename all class methods using snake_case instead of camelCase 2020-07-09 22:03:05 +02:00
Christian Gruber
1fa90a5429 Cleanup some comments 2020-07-09 22:00:18 +02:00
Christian Gruber
1e2236afdc Use typed queries 2020-07-09 22:00:18 +02:00
Christian Gruber
fa82a8bcce Replace query factory by a query pool
Query factory was implemented using a public global variable
qof_query_factory.

Furthermore a query pool is easier to handle than a factory, since the
whole management can be hidden from the user.
2020-07-09 22:00:14 +02:00
Christian Gruber
2639cdefdf Remove unnecessary inclusion of qofquery-p.h 2020-07-09 21:58:48 +02:00
Christian Gruber
841111e37e Rename class QofMockQuery to QofFakeQuery 2020-07-09 21:58:48 +02:00
Christian Gruber
bbfc30d70b Rename gmock-qofquery to fake-qofquery 2020-07-09 21:58:48 +02:00
Christian Gruber
8425af784e Check pointer to preferences backend before using it 2020-07-09 21:58:48 +02:00
Christian Gruber
766f88c02d Replace singleton class MockPrefsBackend by an ordinary class 2020-07-09 21:58:42 +02:00
Christopher Lam
ebb462d06d [account.cpp] prevent crash in gnc_account_get_currency_or_parent
if the *account argument is NULL, it is not reasonable to have a
g_assert crash. Passing NULL account returns NULL commodity instead.
2020-07-09 22:19:29 +08:00
John Ralls
0e0c27f80f Bug 797850 - Account register credit/debit column headings untranslated
Plus make the former globals static.
2020-07-07 12:33:38 -07:00
John Ralls
b0b238958e Merge Christoph Holtermann's 'python-sessionOpenMode' into master. 2020-07-06 12:45:07 -07:00
John Ralls
4ee573e23a Link with libm.so on those platforms that require it. 2020-07-06 12:30:37 -07:00
c-holtermann
22f91c407e use same order in comment as in definition of SessionOpenMode enum 2020-07-04 22:26:35 +02:00
c-holtermann
e23bf0bc1c fix SessionOpenMode explanation for SESSION_NEW_OVERWRITE 2020-07-04 22:16:13 +02:00
Christopher Lam
851bc7f8d9 deprecations: clarify functions deprecated in 4.x. 2020-06-22 19:53:29 +08:00
c-holtermann
7c8e0a28fc better display for doxygen, typo and consistent naming 2020-06-21 16:24:53 +02:00
John Ralls
d308028353 Merge branch 'maint' 2020-06-20 15:36:58 -07:00
John Ralls
50329df082 Bug 797811 - GnuCash crashes with segfault when saving to mysql...
when database already exists.

Crashed because of dereferencing GncSqlBackend::m_conn when it's nullptr
after the DB create failed. Protect all such dereferences.
2020-06-19 15:08:58 -07:00
Christian Gruber
8ac640d5fa Fix typo 2020-06-15 22:57:13 +02:00
Christian Gruber
610bbda23f Add glib-object.h to includes 2020-06-15 22:57:13 +02:00
Christian Gruber
53c294f9e8 Remove unnecessary type check 2020-06-15 22:57:13 +02:00
Christian Gruber
bb0088c43c Replace g_return_if_fail() and g_return_val_if_fail() by ASSERT_TRUE and EXPECT_TRUE 2020-06-15 22:57:13 +02:00
Christian Gruber
967cf0b430 Pass std::vector arguments by reference instead of by value 2020-06-15 22:57:12 +02:00
Christian Gruber
d084279891 State comment on unused GObject instance init function more precisely 2020-06-15 22:57:12 +02:00
Christian Gruber
67f63053fb Remove todo comments on replacement of std::vector by std::list
Replacing std::vector by std::list wouldn't have any advantage
2020-06-15 22:57:12 +02:00
Christian Gruber
a9d85e8f8e Use std::vector of const char* instead of std::string where meaningful
This avoids additional string allocation
2020-06-15 22:57:12 +02:00
goodvibes2
60da4bd7bf gnc-fq-dump: Err msg if AlphaVantage API Key is needed but missing
AlphaVantage API Key is needed for all currency quotes
and stock quotes with source 'alphavantage' or 'vanguard' or
multi sources that include 'alphavantage'
2020-06-12 15:11:53 +10:00
goodvibes2
ec08fc1d1a gnc-fq-dump: add examples to synopsis + remove tabs 2020-06-12 15:05:53 +10:00
Frank H. Ellenberger
222b34a08b doxygen: PERL_PATH has become obsolete in 1.8.0 (25-02-2012)
https://github.com/doxygen/doxygen/commit/6d1535c
2020-06-11 09:57:26 +02:00
Geert Janssens
f749f136ce Drop unused boost::locale::generator instantiations
We now have one single case in gnc-locale-utils and all code
uses gnc_get_boost_locale to get the proper locale.
2020-06-09 23:10:43 +02:00
Geert Janssens
69a04be353 Fix translations using boost::locale::translate
This requires a std::locale generated from a boost::locale::generator
The examples already in our code base used the wrong message_path while
creating the generator and as a result our message catalogs weren't found.

As with the std::locale I have added code to create a locale via
boost::locale only once instead of having each c++ file redo the work.

This code expects a message_path to set for the boost generator.
An earlier attempt queried for this path directly from within
gnc-locale-utils using gnc_get_locale_dir (from gnc-path.h).

That however broke several c++ tests depending on gnc_locale_utils as those
then also needed to be linked against gnc-path.o. I couldn't get the linker
to do this properly so I worked around it for now by splitting the boost_locale
functionality in two steps:
- an initializer step that takes the messages_path as a string and will
  generate the locale
- a getter to get the locale.

The initializer should only be run once, and before the getter is called.
It won't hurt though if the initializer is called more often.
If the getter is called before the initializer it will still
generate a std::locale but without setting a messages_path. It will then
also log a warning explaining translations may not be properly found.
2020-06-09 22:58:06 +02:00
Mike Alexander
5660fde36a Don't reference undefined variable if price is not set. 2020-06-09 02:10:25 -04:00
Robert Fewell
d4e90132d9 Fix a missing mode == in 'Replace the three bool parameters
to qof_session_begin to an enum'.
2020-06-05 11:10:16 +01:00
John Ralls
b8d514e157 Don't try to unlock the GncDbiSqlConnection when it was connected read-only.
If it's locked it's not *our* lock.
2020-06-04 14:07:28 -07:00
John Ralls
6a1cb5eecd Replace the three bool parameters to qof_session_begin to an enum.
For clarity. In so doing found the backend behavior a bit inconsistent
so it's modified to do what the enum values indicate.

In the course of changing the various calls I found some implementation
errors in the back end and corrected them.
2020-06-04 14:07:28 -07:00
John Ralls
c73a1bd475 Extract function template drop_database. 2020-06-04 14:07:28 -07:00
John Ralls
a320035f42 QofSession, QofBackend: Change book_id to uri.
It's more descriptive and less likely to be confused with the book:id value
in XML files that is the book's GUID.
Also changed the QofSessionImpl::begin new_uri parameter from std::string to
const char*. There's no point in allocating a string just to call
new_uri.c_str() all over the place.
2020-06-04 14:07:28 -07:00
John Ralls
65e2639de4 Delete QOF_STDOUT.
Apparently a hack for the long-gone QSF backend.
2020-06-04 14:07:28 -07:00
Geert Janssens
a124e647db Add files omitted in previous commit 2020-05-29 17:35:04 +02:00
Geert Janssens
5fc2b9519c Add mock sources and import-export test to dist 2020-05-29 17:20:53 +02:00
Robert Fewell
2f9be87549 Replace tabs with spaces in gncInvoice.c/h
Replace tabs with spaces, trim ending spaces and add spaces to function
calls where appropriate.
2020-05-28 17:25:41 +01:00
Robert Fewell
69aeacb621 Add KVP Association property to GncInvoice 2020-05-28 17:25:41 +01:00
Robert Fewell
785a6a8fa6 Add a new cell type for Transaction associations that
supports the use of glyphs
2020-05-28 17:25:40 +01:00
John Ralls
fde6be6e01 Fix binreloc compile error with gcc. 2020-05-25 08:01:47 -07:00
Mike Alexander
b1ffe2246a CLean up the binreloc code a bit. It is won't work pervectly, but it's better.
Make it do something plausible in a non0QUartz Mac build and make it handle
running GnuCash from a symlink.
2020-05-25 03:30:59 -04:00
John Ralls
f2a13ecac7 Merge Christian Gruber's 'test_import_backend' into master. 2020-05-21 12:39:57 -07:00
John Ralls
a81f155408 Fix abort in qof_log_check.
Apparently g_logv doesn't like recursive calls from its log handler.
2020-05-15 12:52:18 -07:00
Christopher Lam
09a8bee5c0 Merge branch 'speedup-aging' #638 2020-05-14 20:30:08 +08:00
Christopher Lam
f8bad131a5 Merge branch 'maint-797743' #720 price renderers 2020-05-13 13:20:09 +08:00
Christopher Lam
3d25a40d1f [gnc-ui-util] add gnc_price_print_info
similar to gnc_default_price_print_info but also accepts a use_symbol
specifier. for generating print_info for prices, either exact e.g.
$1 + 2/3, or inexact e.g. $1.3333
2020-05-13 11:36:22 +08:00
John Ralls
1510f34926 Use std::unique_ptr instead of std::shared_ptr.
No need to share ownership.
2020-05-12 14:06:45 -07:00
John Ralls
bd6840e035 Fix incorrecly logging all possible messages regardless of log level. 2020-05-12 14:06:45 -07:00
John Ralls
94fdc42f16 Fix wrong Boost library variable names. 2020-05-11 12:35:42 -07:00
John Ralls
b9b51efa8d Don't use g_return_value_if_fail in qof_log_check.
It causes GnuCash to crash if g_log is called without having set
G_LOG_DOMAIN.

Also extract a singleton getter function to ensure that the static
root module has been created before use.
2020-05-11 12:31:49 -07:00
John Ralls
fc637aadc7 Two more test directories needing G_LOG_DOMAIN defined.
Should fix CI failures.
2020-05-10 10:18:36 -07:00
Christopher Lam
f9dfdb3e6c [c-interface] compact code, use (ice-9 match) 2020-05-10 09:52:40 +08:00
John Ralls
f23e3b2660 Fix undeclared std::find_if. 2020-05-09 18:28:20 -07:00
John Ralls
5da3bf7943 [QofLog] Replace hashtable with tree of vectors.
16x speedup.
2020-05-09 14:39:08 -07:00
John Ralls
3e442a0ef9 Make qof_log_set_file static.
Used only internally.
2020-05-09 14:39:08 -07:00
John Ralls
0403e4906c Move QofLogModule typedef to qoflog.h where it belongs. 2020-05-09 14:39:08 -07:00
John Ralls
4e6c497cd1 Don't ask to save a non-existant book.
To accomplish that we separate creating a book and creating a session;
gnc_get_session no longer automatically creates a book if one isn't
connected.

We also add an initially_insensitive GtkAction array to
gnc-plugin-basic-commands with a call to make its contents insensitive
at plugin load so that the save button on the toolbar isn't lighted when
there's nothing to save.
2020-05-08 15:59:41 -07:00
John Ralls
8ff5af4c19 Decouple QofBook creation from QofSession.
So that we don't create two books when loading a session.
Step 1 to not having a dirty book when we think we should have no
book at all.
2020-05-08 15:59:41 -07:00
Mike Alexander
478112d8c0 Define log_module in gnc-sx-instance-model.c. 2020-05-08 16:43:45 -04:00
Christopher Lam
a9a60c1831 [Account.cpp] more xaccAccountTypeGetFundamental types 2020-05-04 23:35:06 +08:00
Christopher Lam
14ea5d9751 Merge branch 'maint' 2020-05-04 23:31:21 +08:00
John Ralls
6a3fabc30d Fix test failure for timezones west of the prime meridian.
The previous fix didn't calculate the comparison time correctly and
ended up in the wrong day because the GMT time is before the local time.

In the course of checking the corner-case timezones (Midway and
Kiritimati) I found an error in the GncDateTime calculation of the
neutral time, so fixed that too.
2020-05-02 15:35:13 -07:00
John Ralls
b4177bc60a Fix transaction post_date being set to midnight local.
Reported for Invoices on gnucash-user. Checked all other uses of
xaccTransSetPostDateSecs(), fixed the ones that weren't passing an
already normalized time64. For Invoices change the post_date to also be
normalized so that it stays the same as the transaction post_date. That
also protects it from the displayed date changing depending on timezone.

The python binding invoice post_time test had to be changed to match.
2020-04-30 12:09:22 -07:00
Christopher Lam
a3dae3bd4d [gnc-lot.c] speed up gncInvoiceGetInvoiceFromLot by caching invoice 2020-04-30 23:56:26 +08:00
John Ralls
fbf7171ab6 Fix libgnc-app-utils.dylib install_name_dir.
The install location changed as part of expunging libgnc-module.
2020-04-28 10:30:22 -07:00
John Ralls
9822f2f486 Merge Jean Laroche's 'add_reconcile_after_ofx_import_master' into master.
https://github.com/Gnucash/gnucash/pull/700
2020-04-25 16:44:50 -07:00
John Ralls
de9ee8dede Merge branch 'maint' 2020-04-25 15:45:59 -07:00
jean
e0e7cf7dfb Fix 3 problems with the scheduled transactions calculations
This fixes 3 bugs:
- Set a monthly recurrence on the 10th with a start date on the 20th of this month.
The editor correctly shows the next occurrence to be on the 10th of the following month.
The schedule transaction summary dialog incorrectly shows the next occurrence to be on the 10th of this month
(before the start date!)
- Set a monthly recurrence on the 19th, with a start date on the 20th of this month. The editor's
calendar marks incorrectly show the next occurrence to be on the 19th of this month (before the start date).
- Set a monthly recurrence on the 18th, with a start date on the 20th and an end date on the 17 of the following
month. The calendar should show no mark, but fails to erase the marks that were present.
2020-04-25 14:39:41 -07:00
John Ralls
758bd7b656 Merge branch 'maint' 2020-04-24 13:52:21 -07:00
Geert Janssens
f7f4f42145 Drop several test-link type tests
They were intended to test whether a gnc-module could be loaded
correctly. However several were not even properly implemented
and for the others the gnc-modules have been converted to
ordinary libraries. Testing whether a library can be linked to
is not a useful test. Link issues are triggered at build time
already.
2020-04-24 22:34:57 +02:00
Geert Janssens
bbeb9a2b62 Drop all gnc-module dependencies and includes from compilation units that no longer use it
This also drops the python wrapper for gnc-module. As for the guile wrappers,
python should use other means of loading our shared libraries.

This commit required a few tweaks to the dependency chain as some units
inherited dependency information from gnc-module's public dependency
interface.
2020-04-24 22:16:24 +02:00
Geert Janssens
abf29aa196 Drop the gnc-module wrapper around the test-engine library
It's not adding anything
2020-04-24 21:29:20 +02:00
jean
2d0d7c40f8 Make the reconcile window close when the session closes, use full version of free 2020-04-22 21:15:36 -07:00
Christopher Lam
8023065030 [fin.scm] return #f instead of -1 if n is out of range 2020-04-21 11:39:40 +08:00
Christopher Lam
96a6e1b0d5 Merge branch 'patch-1' of git://github.com/thetedmunds/gnucash into maint 2020-04-21 11:39:28 +08:00
Geert Janssens
261bff1250 Drop unused module file in xml backend 2020-04-19 21:23:22 +02:00
Christopher Lam
6de712b501 [gnc-exp-parser] don't crash when gnc:fn returns non-number
if gnc:fn returns anything other than a number, abort rather than
crash
2020-04-15 04:54:05 +08:00
thetedmunds
d6c5b115d8
Adding lines missing from fix for Bug 797196
Adding definition of gnc:amort_balance() that got lost in the original pull-request for Bug 797196.
2020-04-14 07:45:54 -07:00
Bill Nottingham
592c3ad562 Fix building with link-time-optimization.
Patch from Jeff Law (law@redhat.com):
Rename one instance of struct _iterate to struct _qofid_iterate to
avoid ODR problems with LTO
2020-04-14 10:13:48 -04:00
John Ralls
3ca8fa1229 Merge branch 'maint' 2020-04-13 11:27:14 -07:00
John Ralls
06033c19cd Fix typo. Really fixes 797674. 2020-04-12 13:40:49 -07:00
John Ralls
c91fb77fae Bug 797674 - 3.9: test-gnc-path-util failed on Debian amd64 2020-04-11 14:23:27 -07:00
John Ralls
fdfaca5575 Merge Christoph Holtermann's 'python-session-instance-constructor' into maint. 2020-04-06 12:05:21 -07:00
c-holtermann
ab843c0b7a include gnucash_core of python bindings in python swig app-utils 2020-04-06 07:03:40 +02:00
John Ralls
640171c211 Merge Jean Laroche's '797318_MRO' into maint. 2020-04-05 14:38:46 -07:00
John Ralls
8ccc1579d9 Bug 797666 - libgnucash/engine/test/test-recurrence.c: In function 'check_valid': 'result' may be used uninitialized 2020-04-05 12:06:02 -07:00
jean
4a8350ece2 797318 - Amounts ending in zero displayed as fractions 2020-04-04 14:43:03 -07:00
Geert Janssens
e78313147c Cmake - rework gnc_add_scheme_deprecated_module to use keyword parameters
Update all invocations accordingly
2020-03-30 08:41:29 +02:00
Geert Janssens
06ff8a292d Use new keyword parameters for all calls to gnc_add_scheme_test_targets 2020-03-30 08:41:29 +02:00
Geert Janssens
c05281c582 Use new keyword parameters for all calls to gnc_add_scheme_targets 2020-03-30 08:41:29 +02:00
John Ralls
f85be03bb5 Merge branch 'maint' 2020-03-29 14:46:55 -07:00
Christopher Lam
f05128b2c2 Bug 797583 - gnc:book-add-quotes crashes when there are no quotes
When Get Quotes being run on empty book, the gnc:book-add-quotes
function expects book->commodity->fq-call-data to return #f
2020-03-28 09:21:46 +08:00
Christopher Lam
ed2437e427 Bug 797656 - Immediate crash when retrieving quotes
gettext needs to be imported
2020-03-28 09:17:36 +08:00
John Ralls
33902a6793 Improve test building with the Xcode generator.
Add CONFIGURATIONS keyword to unadorned tests, enables tests with
multi-config generators.
Add CONFIGURATION generator expression to libgtest.a and libgmock.a
build directory specs when building with Xcode so that it can
find them when building tests.
2020-03-23 17:52:26 -07:00
jean
66fce05308 Move the weekend adjust code in its own function 2020-03-22 12:34:57 -07:00
jean
268695f19c Make test-recurrence handle wadj 2020-03-22 12:34:57 -07:00
jean
7a61eca4fe Bug 685102 - Scheduled Transactions don't always respect weekends for first occurrence 2020-03-22 12:34:57 -07:00
goodvibes2
39c9aa4de3 Remove bad paths from CMakeLists.txt files 2020-03-22 17:57:27 +11:00
Robert Fewell
6b55222ca9 Add ability to show HBCI Online Account matches to 'Import Map Editor' 2020-03-16 15:02:46 +00:00
Christopher Lam
9865a99663 [account.cpp] refactor GetBalanceAsOfDate
much more compact loop.
2020-03-15 07:01:55 +08:00
Christopher Lam
8def3ba26e [account.cpp] refactor xaccAccountGetPresentBalance
instead of starting from account->splits tail then backtrack, reuse
existing code.
2020-03-15 06:58:50 +08:00
Christopher Lam
50674ef632 [gnc-ui-balances] add and expose gnc_ui_account_get_reconciled_balance_as_of_date 2020-03-15 06:40:03 +08:00
Christopher Lam
a8f03cf1c8 [account] add and expose xaccAccountGetReconciledBalanceAsOfDate 2020-03-15 06:40:03 +08:00
John Ralls
d744b79bef Remove disabled code copied from utest-Account.c into utest-Budget.c. 2020-03-14 11:08:27 -07:00
John Ralls
8b61644978 Add more tests for neutral time. 2020-03-14 10:15:32 -07:00
Christopher Lam
1fa5fd0a14 Merge remote-tracking branch 'upstream/maint' 2020-03-14 11:48:10 +08:00
Frank H. Ellenberger
82987e13f3 gnc-fq-dump: fix warning on argv
Scalar value @ARGV[0] better written as $ARGV[0] at gnc-fq-dump line
160.
2020-03-13 21:22:19 +01:00
Frank H. Ellenberger
56fa959ec0 Apply @PERL@ -w substitution on gnc-fq-dump, too 2020-03-13 20:53:15 +01:00
Mike Alexander
9e35aea588 Fix a typo in commit 4318f7a: gnc.scm, not gcc:scm 2020-03-08 18:11:51 -04:00
Mike Alexander
4318f7a3c7 Revert "completion redefine gnc:debug" and fix some bugs in it
This change made it impossible to turn debug output on or off on the
fly by calling qof-log-set-level from Scheme code.  The optimization
achieved isn't all that great either since the arguements to
gnc:debug are still evaluated when debugging is off and this is
where a lot of the overhead is. Even without this change the call to
strify is avoided.

Also fixed the parameters of qof-log-check:
    "gmc" => "gnc.scm"
    G-LOG-LEVEL-DEBUG => QOF-LOG-DEBUG

This reverts commit b3a4cd6277.
2020-03-07 23:44:16 -05:00
Christopher Lam
e85b28f00f Merge remote-tracking branch 'upstream/maint' 2020-03-01 21:31:21 +08:00
John Ralls
95857a8b99 Merge Christian Gruber's 'fix_bug_797587' into maint. 2020-02-28 21:29:58 -07:00
Geert Janssens
5c468b33bf Housekeeping - clarify the use of the word backend in a warning message
In this context backend refers to a preferences implementation.
To disambiguate this from our qof backends, add the word 'preferences'
2020-02-28 20:46:16 +01:00
Geert Janssens
5e1316444e Fix build order of dependencies for tax sources 2020-02-28 18:55:07 +01:00
Geert Janssens
90345096e4 Merge branch 'maint' 2020-02-28 18:37:10 +01:00
Geert Janssens
feee495f2e Bug 797624 - Wrong Decimal for Vietnam currencies 2020-02-25 16:40:50 +01:00
Christian Gruber
7509b542da Simplify function build_bayes()
Inline function parse_bayes_imap_info() into build_bayes() and remove
temp_guid.
2020-02-17 23:41:05 +01:00
Christian Gruber
01c76e2391 Remove unused template of function for_each_slot_prefix()
for_each_slot_prefix() is not used anywhere with two arguments
2020-02-17 23:41:05 +01:00
Christian Gruber
41863be9c7 Avoid copying local instance of AccountTokenCount 2020-02-17 23:41:05 +01:00
Christian Gruber
322f2d99de Rework key prefix matching
Use C string comparison instead of C++ function std::mismatch to increase
performance.
2020-02-10 22:31:29 +01:00
Geert Janssens
ab5b7155af CMake - remove parameter repetition in else() and endif() statements
Fix leftovers after the maint branch merge
2020-02-06 17:01:26 +01:00
Geert Janssens
301db9020d Merge branch 'maint' 2020-02-06 16:50:08 +01:00
Geert Janssens
e79e82edcf CMake - remove parameter repetition in else() and endif() statements
This follows Professional CMake's recommended practises
2020-02-05 11:38:14 +01:00
Alex Aycinena
f1667e7ba8 Update US Income Tax information for more 2019 changes 2020-02-02 13:58:00 -08:00
Christian Gruber
a13184978a Fix calculation of token info to find exactly matching tokens only
In get_first_pass_probabilities() function
qof_instance_foreach_slot_prefix() is called with a prefix path
including closing slash after token now. This avoids, that also entries
with token as a substring are included in token info, where key only
starts with token.

Finally function build_token_info() checks, if the key suffix after the
token consists only of the GUID. This avoids, that also entries with the
same prefix and slashes are included in token info.
2020-02-02 18:00:27 +01:00
Christian Gruber
da60560ac4 Change behaviour of KvpFrame::for_each_slot_prefix()
Provided function func is now called with key suffix only instead of
full key (prefix is omitted). This is neccessary for fixing function
build_token_info() in the next commit.
2020-02-02 18:00:27 +01:00
Christian Gruber
9b3085a429 Add test cases to check for exact token matching 2020-02-02 18:00:27 +01:00
Christopher Lam
62c2203d40 Merge branch 'maint' 2020-01-30 20:30:04 +08:00
Geert Janssens
0131780b30 Add guile function to extract a lot's guid
Useful for debugging lot issues in reports.
2020-01-29 18:55:35 +08:00
Geert Janssens
4537c1de36 Bug 794916 - Fails to find environment file at startup when installation prefix is '/opt'
Update on this bug. Before doing the binreloc dance on various
paths check if the calculated dynamic prefix is still the same
as the compile time PREFIX. If so, just stick with the compile
time path names as this means the application wasn't relocated
anyway. Only if the dynamic prefix is different, try to
recalculate the requested paths relative to the dynamic
prefix.
Together with the configure time fix to detect /etc/opt is
outside of the /opt prefix, this eliminates the need for further
special case handling of the sysconfig directory so that
special case handling is removed.
2020-01-22 22:40:11 +01:00
gnucash-dev
24b46b1c36 Update US Income Tax information for 2019. 2020-01-20 17:28:49 -08:00
Geert Janssens
490b20d2da Merge branch 'maint' 2020-01-17 18:35:30 +01:00
Geert Janssens
073e47801d Drop useless ifdefs
The parameter it checks is always defined these days
2020-01-17 18:25:43 +01:00
Geert Janssens
d8a304c2c9 Housekeeping - reduce the number of PACKAGE and VERSION related cmake variables
This starts by setting the gnucash version number in the 'project' call.
This will result in a number of variables set by cmake. The remainder
of this commit is to reuse the auto-generated
PROJECT_NAME, PROJECT_VERSION, PROJECT_VERSION_MAJOR
PROJECT_VERSION_MINOR, PROJECT_VERSION_PATCH and PROJECT_VERSION_TWEAK
instead of all the various instances of PACKAGE, GNUCASH_MAJOR_VERSION
and so on.

One parameter is worth mentioning - GETTEXT_PACKAGE
GnuCash is not using this directly (any more) but it has to be set before
including gi18n-lib.h.
2020-01-17 18:15:27 +01:00
Christopher Lam
c4ab772d4b Bug 797576 - xaccAccountOrder shouldn't sort account codes as base-36
Thanks to yegor for discovering it is unreliable for sorting. It has
been present since 50646f04
2020-01-15 18:25:16 +08:00
Christopher Lam
3db699786f [core-utils.i] declare prefs as ENUMs 2020-01-15 18:04:35 +08:00
Geert Janssens
08d685f4aa Define SET_ENUM in core-utils.i as well
Will be used to expose our settings related constants to guile
2020-01-15 09:29:27 +01:00
Geert Janssens
45cfb8937a Merge branch 'maint'
Resolves most merge conflicts. The only bit I was unable
to merge from maint into master is the use of match-lambda
in category-barchart.scm. This will have to be redone manually.
2020-01-14 19:56:35 +01:00
John Ralls
df92200c8e Restrict gnucash.pot comment collection to ones beginning with Translators.
On recommendation of the Translation Project's Benno Schulenberg.

Required re-annotating some comments. Also removed several comments
about leaving a line break to prevent inserting it into gnucash.pot.
That didn't actually work: they were inserted anyway.
2020-01-04 15:57:02 -08:00
Daniel Dittmann
31c0fed1dc test_gnc_setlocale: use trailing whitespaces 2020-01-02 14:02:04 +01:00
Daniel Dittmann
5c478713d6 test_gnc_setlocale: add missing whitespaces to diagnostic message 2019-12-30 00:38:09 +01:00
John Ralls
d51b4d7f08 Bug 797532 - Crash/Coredump Lots
Replace the asserts in cap-gains.c with g_return_val_if_fail. There's
nothing about cap-gains.c that justifies crashing the program.
2019-12-28 13:36:11 -08:00
Geert Janssens
cd8698321d Bug 797482 - Can't edit date when using Edit Payment function 2019-12-27 18:38:55 +01:00
Christopher Lam
8fb73c7ed1 [gnc-lot.h] amend description for gnc_lot_get_earliest_split
this function doesn't necessarily point to the lot opening split.
2019-12-24 16:43:55 +07:00
Christopher Lam
5ebbb74435 [new-owner-report] invoice->payments displays lot links
Change of algorithm to display invoice->payments.

Previously: invoice->lot->splitlist; filtered to payments; retrieve
splits->parent->xaccPaymentAcctSplitList This would find payment
splits in originating currency.

But this fails for lot-link txns whose PaymentAcctSplitList is null.

New algorithm:

- invoice->lot->split-list, each lot-split analysed

- TXN-TYPE-PAYMENT lot-splits will query TransferAcct and each will be
rendered in the originating currency, if they haven't been encountered
before in this invoice.

- TXN-TYPE-LINK lot-splits are rendered as a generic 'Offset
Documents' link to lot-link splits. This helps link invoice to the
link transaction to locate the corresponding credit-note. It is not
possible to link to the corresponding credit-note because a
link-transaction can group many invoices to many credit-notes.

Also:

Increase right-hand-side links from 3 to 4 columns. I think it's quite
useful to add 'Credit Note' 'Invoice' 'Payment' as a separate
column.
2019-12-24 10:55:26 +07:00
Robert Fewell
e4ac6b480f Merge branch 'maint' 2019-12-12 16:33:34 +00:00
Robert Fewell
803d4c511e Bug 797489 - No option to use account codes in Budget View - Part1
In the budget view there is no option to add the account code column
which some uses use for sorting their accounts. This commit introduces
a feature flag to be used in version 4.0 but if set in 3.8 will hide
the new account code column so the view is not disrupted.
2019-12-11 15:16:48 +00:00
Christopher Lam
279a5fcde8 Merge branch 'maint' 2019-12-08 20:34:49 +08:00
Geert Janssens
e8451ae1db tax - remove gncmod boilerplate
This is now an ordinary shared library

* Remove test to load the gnc-module in scheme
* Rewrite test to load the module in C to actually test something.
2019-12-06 20:38:21 +01:00
Geert Janssens
d52aa0a0dd app-utils - remove gnc-module boilerplate
app-utils now is an ordinery shared library

A few bits worth mentioning:
1. it's not guile-free just yet, so instead of a gnc_module_load
   your code may have to call scm_c_use_module("gnucash app-utils");
   to expose the scm side of the app-utils api. This call has been
   added to gnucash-bin.c for example
2. while lots of noise in this commit is to rename from gncmodule-app-utils
   to gnc-app-utils, I'll point out the library has also been moved from
   <libdir>/gnucash to <libdir>. This required changes in app-util's
   CMakeLists.txt file for the install side and in the top level
   CMakeLists.txt file for the build directory structure.
3. The C side link module test has been removed as linking an ordinary
   shared library should be considered well tested by the compiler devs.
   The scheme side module load test has been slightly tweaked to no longer
   try to use gnc:module-load, but instead now checks whether the app-utils
   api is properly exposed to scheme after loading it via use-modules.
4. Dropped a completely obsolete README file.
2019-12-06 20:38:21 +01:00
Geert Janssens
90aa539908 app-utils - make gnc-expression-parser responsible for its own cleanup
It already ensured it would initialize on first use.
It can as well register the hooks it needs for its
cleanup directly itself instead of depending on the
module loading system to do so.
2019-12-06 20:38:21 +01:00
Geert Janssens
43647c7a54 app-utils - move component manager to gnome-utils
It's primary purpose is to track gui objects' lifetimes. There's no
need for libgnucash (a non-gui library) to deal with that.
This required two book options related gui-only call backs
to be moved to gnome-utils as well.
2019-12-06 20:38:21 +01:00
Geert Janssens
4c77f7670e engine - remove gncmod boilerplate
engine is now an ordinary shared library

This requires a few more places to run gnc_engine_init as
this is no longer done as part of module loading.
2019-12-06 20:38:21 +01:00
Geert Janssens
95b81844ad Update documentation referring to the deprecated gnc:module wrapper 2019-12-06 20:38:21 +01:00
Geert Janssens
bd311d5dfb report - expose wrapped api directly from report-core.scm
With that in place we no longer need to (gnc:module-load "gnucash/report" 0)
the report gncmodule. An ordinary (use-modules (gnucash report)) suffices

Note: as gncmod-report did additional initialization, most reports
needed additional tweaks like using app-utils.
And in app-utils the initialization of the relative date terms
has been tweaked as well to run whenever the app-utils module
gets loaded first time, rather than having this initialized by
gncmod-report.
2019-12-06 20:38:21 +01:00
Geert Janssens
c00bf6bcdb app-utils - expose wrapped api directly from app-utils.scm
With that in place we no longer need to (gnc:module-load "gnucash/app-utils" 0)
the app-utils gncmodule. An ordinary (use-modules (gnucash app-utils)) suffices
2019-12-06 20:38:20 +01:00
Geert Janssens
5a650ad566 gnc-module - fix test build on Windows 2019-12-06 20:38:20 +01:00
Geert Janssens
63e89aecf7 gnc-module - fix incompatdep test
The test passed but for the wrong reasons:
as no GNC_MODULE_PATH was passed to the test
it just didn't find the module. That's different
from finding a module with the same name but
a wrong sysver. This commit fixes that.
2019-12-06 19:59:12 +01:00
Geert Janssens
043c6367a5 gnc-module test updates
- move test modules into a subdirectory on Windows as well
- move the futuremod module into its own subdirectory
  to avoid its load warnings each time gnc_module_init is called
  That also tends to happen when building guile modules.
- remove the log handlers filtering out the futuremodsys warnings
  They didn't match the actual warning signature anyway and
  they're no longer emitted during testing
2019-12-06 19:59:12 +01:00
Geert Janssens
8aed43ec55 gnc-module - drop redundant extra_dist specificiation
There was only the README left in this list and that was already in
the local dist list by itself
2019-12-06 19:59:12 +01:00
Geert Janssens
2c61662113 gnc-module - remove guile traces from c-interface tests and examples
None of them still depend on guile.
2019-12-06 19:59:12 +01:00
Geert Janssens
331039cdcc gnc-module - expand c-interface load test and make it guile independent 2019-12-06 19:59:12 +01:00
Geert Janssens
fbd73c83cf gnc-module - move most of scm tests to bindings/guile
This is a first rudimentary separation of gnc-module tests
based on whether they require guile or not. Needs plenty of refinement
which will be applied in followup commits.
2019-12-06 19:59:12 +01:00
Geert Janssens
6eb0ccfa11 gnc-module - move guile wrappers to bindings/guile 2019-12-06 19:59:12 +01:00
Geert Janssens
6a3505d01f app-utils - move price-quotes support functions directly into bindings
- wrappers for glib functions go into glib-guile
- engine convenience functions go into gnc-engine-guile
2019-12-06 19:59:12 +01:00
Geert Janssens
9ed9621363 app-utils - remove unused guile includes 2019-12-06 19:59:12 +01:00
Geert Janssens
d777128e6f app-utils - simplify and move gettext wrappers
1. Instead of creating a C wrapper around gettext to then wrap in
guile, use guile's builtin gettext support directly.

The code still defines the _ and N_ shorthands. However it doesn't
really warant a separate module just for these two shorthands.
Instead define them in core-utils. So all code wanting to use
_ or N_ in guile should now use the (gnucash core-utils) module.

The bulk of this commit is actually deleting the scm-gettext
target and using (gnucash core-utils) instead of (gnucash gettext).

2. As the definition of _ and N_ is removed from app-utils.scm,
the app-utils test for a functional N_ macro has been moved to a
new test file in the guile bindinds tests.

3. The (gnucash gettext) module has been deprecated. Use
(gnucash core-utils) from now on.
2019-12-06 19:59:12 +01:00
Geert Janssens
759bbe1da0 app-utils - move gnc_get_debit/credit_str functions to Account
Eliminates another scm file (prefs.scm).
The old scm functions are declared deprecated.
2019-12-06 19:59:12 +01:00
Geert Janssens
0a635fadee engine - cmake cleanups
- drop no longer used GUILE_LDFLAGS and GUILE_INCLUDE_DIRS
- use generator expressions where it makes sense
2019-12-06 19:59:11 +01:00
Geert Janssens
2e1b9f937b engine - drop guile wrappers for obsolete functions
These were marked deprecated early in the 3.x release cycle.
2019-12-06 19:59:11 +01:00