Commit Graph

744 Commits

Author SHA1 Message Date
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
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
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
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
Christopher Lam
d16f39046d Merge branch 'maint' 2021-01-30 07:13:32 +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
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
Christopher Lam
c5e7406c9f [account.cpp] remove deprecated function 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
Allan Nordhøy
8d4d1f1523 Replace 'Non Bayesian' with grammatically more correct 'non-Bayesian'. 2021-01-02 20:29:21 -08:00
Christopher Lam
f1c1fca023 [account.cpp][API] deprecate xaccAccountCountSplits 2020-12-28 09:48:06 +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
John Ralls
2ff3bf5877 Echo into CMakeLists.txt rename of gmock-qofqury to fake-qofquery. 2020-12-13 11:52:32 -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
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
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
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
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
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
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
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
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
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
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
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
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
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
c-holtermann
7c8e0a28fc better display for doxygen, typo and consistent naming 2020-06-21 16:24:53 +02: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
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
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
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
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
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
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
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
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
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
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
John Ralls
f85be03bb5 Merge branch 'maint' 2020-03-29 14:46:55 -07: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
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
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
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
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
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
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
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
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
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
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
Geert Janssens
04f10d66fa engine cosmetics - remove a few references to guile that are no longer relevant 2019-12-06 19:59:11 +01:00
Geert Janssens
c46c9682eb engine/test - move guile related tests to bindings 2019-12-06 19:59:11 +01:00
Geert Janssens
02511401b7 bindings/guile cosmetic - rename source files for consistency 2019-12-06 19:59:11 +01:00
Geert Janssens
48f3195e5c bindings - make business-core scm module part of the engine module
There's no reason to expose it as an individual module as what it exports
are support functions for first class engine objects.
2019-12-06 19:59:11 +01:00
Geert Janssens
1c7f835f47 engine - move guile code to bindings/guile
This commit tries to do the minimum necessary to move the guile bits from engine
to bindings/guile. As engine is a very central piece in the software, this unfortunately
still touches many other source files:

- A few helper objects have been squashed together:
  * engine-helpers-guile.[ch] (of which the c part is extracted from engine-helpers.c)
  * gncBusGuile.[ch]
  * gnc-hooks-scm.[ch]
- The initialization function of gncmod-engine no longer initializes the scm bits.
  Any scm code that wants to interact with the engine code now has to load
  the (gnucash engine) scm module, or sometimes (gnucash business-core).
  The bulk of changes in this commit actually is updating all the scm consumers to do so.
- scm-scm target has been removed. Instead (gnucash utilities) is part
  of scm-engine. A few dependency graphs have been updated for this.

More refinements will be in followup commits.
2019-12-06 19:59:11 +01:00
Geert Janssens
b1ba16c33b gnc-hooks - factor out scm calls into a separate source file
This required the addition of an extra parameter to gnc_hook_add_dangler
to allow the scm hooks to unprotect the scm data on hook destruction.
2019-12-06 19:59:11 +01:00
Geert Janssens
18093b5e82 core-utils - move guile utils to bindings/guile 2019-12-06 19:59:11 +01:00
Geert Janssens
33e1ff645c Allow to pass include directories to the add_swig_xyz commands
This will be needed when the wrappers no longer live in
the same directory as the objects they are wrapping.
2019-12-06 19:59:11 +01:00
Geert Janssens
f5e28c3d0f split register - drop scm copy interface 2019-12-06 19:41:50 +01:00
Christopher Lam
ded336f987 [gnc-features] enable reading of unreversed budgets 2019-12-05 17:26:46 +08:00
Christopher Lam
c06191a656 Transaction.c: avoid slow g_list_nth_data 2019-12-05 13:06:11 +08:00
John Ralls
ba5bd6b4d7 Merge branch 'maint' 2019-11-04 14:31:43 -08:00
Christopher Lam
2df672bdb2 [gncOwner] i18n gncOwnerGetTypeString types 2019-11-02 09:05:22 +08:00
Christopher Lam
f89691f73c Merge branch 'maint' 2019-10-31 23:30:13 +08:00
Christopher Lam
644cb4100e [gncOwner] add gncOwnerGetTypeString returns owner-type
* will have several uses
2019-10-28 20:18:47 +08:00
Christopher Lam
02e86a4c6a Merge branch 'maint' 2019-10-27 22:03:55 +08:00
Christopher Lam
b2fcfbd3c6 Bug 797326 - Enhancement: budget's Estimate tool should ignore Closing Entries
Addendum to 8b8c957ed -- if budgeted amounts exclude closing entries,
actual amounts should also exclude closing entries.

Amend documentation, modify budget test to add a closing entry which
will be ignored.
2019-10-25 18:27:47 +08:00
Christopher Lam
5f6aa6ed45 Merge branch 'maint' 2019-10-23 20:11:52 +08:00
John Ralls
1dc22e53c5 Fix test_xaccTransEqual.
Needed to make the noclosing_balances equal to get the balance-equality test to pass.
2019-10-23 20:09:40 +08:00