Commit Graph

384 Commits

Author SHA1 Message Date
John Ralls
552aa438ff [options] Implement gnc_register_internal_option. 2022-08-06 17:13:28 -07:00
John Ralls
3d275a3715 [options] Improve Scheme API consistency 2022-08-06 17:13:16 -07:00
John Ralls
418bb7d0cc [options] Fix two deprecation messages. 2022-08-06 16:25:42 -07:00
John Ralls
cf2870b71a [options] Change RelativeDate and Multichoice index type to uint16_t.
From size_t because clang thinks that std::is_same_v<size_t, time64> is
true and we need to differentiate the handling of the two.
2022-08-06 16:25:42 -07:00
John Ralls
0b2d14ee72 Fix distribution for expressions target. 2022-08-06 16:25:42 -07:00
Christopher Lam
0b5a4cd298 Merge branch 'maint' 2022-08-03 20:38:08 +08:00
John Ralls
688832b5f8 Bug 798585 - segfault running sample script
The root cause of which is that on recent releases of GLib (recent
meaning 2.66 in the current Debian stable!) g_type_instance_get_private
looks in the wrong place for the private data. When running the script
in question it returned NULL and since the code didn't check for a valid
pointer, it crashed.

So this change replaces all calls to g_type_instance_get_private with
the function [type_prefix]_get_instance_private() added in glib-2.36
except for two register2 files that have been removed from master; those
are ignored to avoid unnecessary merge conflicts.
2022-07-30 16:50:51 -07:00
Christopher Lam
f1adb5da34 Merge branch 'TXN_TYPE-is-dynamic' xaccTransGetTxnType into maint #1201 2022-07-18 09:24:32 +08:00
Christopher Lam
fd12d3900c [Transaction.c] use heuristics to determine txn->txn_type 2022-07-18 09:24:05 +08:00
John Ralls
f4c27d4494 Move gnc_ui_account_get_tax_info_string to gnc-locale-tax.c
To prevent a circular dependency between libgnc-app-utils and
libgnucash-guile.
2022-07-17 10:00:23 -07:00
John Ralls
47904a858e Fix distcheck in master.
Several gnc-optiondb dependencies left out of tarball.
2022-07-16 18:15:57 -07:00
John Ralls
3fd8bd9ddf Merge branch 'maint' 2022-07-16 17:15:20 -07:00
John Ralls
426b30c37e Fix python tests dependencies
So that ninja check works from a clean build directory with Python enabled.
2022-07-16 16:36:46 -07:00
Christopher Lam
dc620d4b24 Merge branch 'maint' 2022-04-22 13:43:47 +08:00
John Ralls
95487eb4a0 Merge branch 'maint'
# Conflicts:
#	gnucash/gnome/window-reconcile2.c
#	libgnucash/app-utils/options.scm
#	libgnucash/engine/gnc-numeric.cpp
2022-04-14 18:02:17 -07:00
Christopher Lam
fae7ea02cd [account.cpp] gnc_accounts_and_all_descendants converted from scm
much more efficient than guile algorithm, avoids numerous repeated
GList<->SCM conversions, and traversals of account descendants.
2022-04-14 21:51:14 +08:00
Christopher Lam
40d5db43e6 Bug 797163 - qof_book_get_option segfaults when retrieving a non-leaf frame
returns a KvpFrame into a nested list of pairs
returns a KvpValue GLIST into a list
2022-04-10 11:46:12 +08:00
Christopher Lam
11458bf8b3 [core-utils.i] Use g_dpgettext2 instead of g_dpgettext
avoids using \004 context and msg separator.

Discussed in dae2ea8356
2022-04-02 10:24:33 +08:00
John Ralls
abd1a0b3f1 Merge branch 'c++options' 2022-03-29 15:58:22 -07:00
Christopher Lam
73ddaa8c40 Remove deprecated functions
Were resurrected in error 5c7967c4a
2022-03-28 23:02:38 +08:00
John Ralls
03cbbd1cd1 Merge branch 'maint' 2022-03-27 06:46:09 -07:00
John Ralls
7d94ade599 [python]Remove non-namespace "All non-currency" fom namespace test. 2022-03-25 15:19:57 -07:00
John Ralls
109efe62b8 Rework default non-currency commodity namespace.
Separate the "All noncurrency" convenience category in the commodity
selector and the default non-commodity namespace proposed by the QIF
importer because they have different functions.

Also remove the namespace guessing code from qif-dialog because with
only one default non-currency namespace there's nothing to guess.
2022-03-24 18:10:32 -07:00
Christoph Holtermann
6a015c8744 make GncNumeric.invert() return GncNumeric 2022-03-20 20:04:56 +01:00
Christoph Holtermann
567df27cc7 Implement some comparisons and arithmetics for GncNumeric
Derive some numeric comparisons and arithmetics from Fraction
class
https://github.com/python/cpython/blob/3.7/Lib/fractions.py
and general information from
https://docs.python.org/3/library/numbers.html#numbers.Integral

These methods are bound closer to the gnucash-C-api than those
from the fraction class.

This is not the full set of comparisons and arithmetics, needs
to be extended. It would be good to extend tests to cover this.
2022-03-20 20:04:44 +01:00
Christopher Lam
193a7aae5d Merge branch 'maint' 2022-03-12 15:18:43 +08:00
John Ralls
1373233cd0 Restore Scheme definitions of GNC-COMMODITY-NS-CURRENCY & -NONCURRENCY.
Overzealously removed in PR 1073.
2022-03-11 11:57:55 -08:00
John Ralls
cbfacdcd55 Merge Christoff Holtermann's 'python-qof-example' into maint. 2022-03-08 13:46:07 -08:00
John Ralls
d841b322d0 Merge Frank Ellenberger's 'Bug684507' into maint. 2022-03-08 12:39:47 -08:00
Christoph Holtermann
64920e7c70 Small fix in expected result 2022-03-08 10:49:44 +01:00
Christoph Holtermann
07cfe9e45c Missed one redundancy 2022-03-08 10:45:17 +01:00
Christoph Holtermann
395c7a7052 Modify examples to respect previous patch 2022-03-08 10:40:12 +01:00
Christoph Holtermann
62f8acf6ae Provide the complete set of QOF enums in gnucash 2022-03-08 10:33:25 +01:00
Christoph Holtermann
06e17dfd5c Provide wrapper for qof numeric predicate
Python bindings already have some wrapping objects for
qof predicates. This adds the one missing for GncNumeric
comparisons.

Additionally fixes a wrong number for QOF_NUMERIC_MATCH_ANY
in example file.
2022-03-08 09:45:48 +01:00
Christoph Holtermann
f44d23035e python qof examples 2022-03-06 23:52:32 +01:00
John Ralls
9ad24321b4 Remove investment-type namespaces.
Leave it to users to categorize their non-currency commodities. In the
QIF importer default non-classifiable commodities to
GNC_COMMODITY_NS_NONCURRENCY.
2022-03-01 19:58:23 -08:00
Frank H. Ellenberger
09296dfb96 Drop commodity-table.scm, no longer required after adjusting qif-dialog-utils 2022-03-01 19:58:11 -08:00
Frank H. Ellenberger
c7f842c081 Bug 684507 - commodity namespace should be localized 2022-03-01 19:58:11 -08:00
John Ralls
c1c75e8f81 Revert "Revert "Merge Stefan Bayer's 'SepaInternalTransfer' into maint.""
The original merge was of a PR based on master into maint, bringing
along all of the development changes in master along with it. We don't
want that so the merge was reverted and the PR's two changes
cherry-picked in. That fixed maint, but then the next regular merge of
maint into master naturally included that revert commit undoing the
changes in master. Not so good. Reverting the revert, this commit,
restores the changes, albeit with messed up history.
2022-01-08 15:10:53 -08:00
John Ralls
ff75ad7043 gnc:html-foo-include: Use gnc-resolve-file-path. 2021-12-28 11:34:11 -08:00
John Ralls
5c7967c4a5 Revert "Merge Stefan Bayer's 'SepaInternalTransfer' into maint."
This reverts commit 17a3f7fef2, reversing
changes made to b8458d0732.
2021-12-03 13:58:07 -08:00
John Ralls
17a3f7fef2 Merge Stefan Bayer's 'SepaInternalTransfer' into maint. 2021-12-03 13:11:28 -08:00
Christopher Lam
d861c65020 [test-engine-extras] don't create splits of opposing amt/value signs
Splits' value and amount should never be of opposite signs. Fix
test book which had created this incorrect value/amount
pair. Strengthen env-create-multisplit-transaction to disallow
test book errors.
2021-11-21 23:34:39 +08:00
John Ralls
4c43dac1b6 Restore setting swig engine initialization flag. 2021-11-13 11:10:17 -08:00
John Ralls
cf5da9fffd Resolve merge conflicts. 2021-11-12 19:56:29 -08:00
Christopher Lam
984d816a58 Merge branch 'maint' 2021-11-06 21:41:17 +08:00
Christopher Lam
e94ee3bfad Don't g_strdup char* from scm_to_locale|utf8_string
Both scm_to_locale_string and scm_to_utf8_string return newly
allocated char*. It is not necessary to return a strdup'd char* and
free the original.
2021-10-30 22:26:33 +08:00
Christopher Lam
171ce9413b Don't g_strdup char* returned by scm_to_locale_string
Previous code was returning a duplicated string and released the
original one. It's no better than returning the original returned
char* instead.
2021-10-16 22:50:09 +08:00
Christopher Lam
19a91f041e Revert "g_list_free swigged GList* arguments"
This reverts commit 16184daf95. Was
causing an unexplained GNC_IS_ACCOUNT assertion failure in
account_foreach_descendant.
2021-10-16 22:49:05 +08:00
Christopher Lam
16184daf95 g_list_free swigged GList* arguments
used by xaccQueryAddAccountMatch and gnc_price_list_equal. SplitList
TransList LotList and CommodityList are not currently being passed as
arguments.
2021-10-16 12:57:03 +08:00
Christopher Lam
9eaa3eb23a Merge branch 'maint' 2021-10-14 09:34:28 +08:00
Christopher Lam
23d964a6a4 g_list_free_full requires a GDestroyNotify
error in f4941a5b0
2021-10-09 12:03:57 +08:00
Christopher Lam
0bce6a1d56 [core-utils] introduce gnc:format
(gnc:format str [binding value]...)

str will contain ${binding} which will be replaced to value.
2021-10-09 10:25:53 +08:00
Christopher Lam
3ff5bd8246 [test-core-utils] uses srfi-64 2021-10-09 10:25:49 +08:00
Christopher Lam
f4941a5b01 use g_list_free_full 2021-10-09 10:24:45 +08:00
Christopher Lam
ad7bffaae1 Run test-core-utils and test-create-account properly 2021-10-07 19:21:00 +08:00
Christopher Lam
34a4b652c1 [test-core-utils.scm] fix - N_ is no longer a macro 2021-10-07 19:20:32 +08:00
John Ralls
824b515430 Fix qoflog's comments to reflect a preference for the macros over GLib functions. 2021-09-14 15:59:01 -07:00
John Ralls
74d0630867 Bug 798237 - Logging during XML file loading degrades performance...
significantly

Modify the DEBUG and PINFO macros to return unless qof_log_check is
true. Replace almost all direct calls to g_debug and g_message with
DEBUG and PINFO respectively.

Track the highest logging level sent to qof_log_set_level to provide a
short-circuit return in qof_log_check. Remove setting GNC_MOD_TESTS to
QOF_LOG_DEBUG so that the short-circuit threshold isn't defeated by
always being DEBUG.

Net result: 33% improvement in xml load times.
2021-09-14 15:15:11 -07:00
Christopher Lam
017ab06939 Merge branch 'maint' 2021-09-12 22:44:34 +08:00
Christopher Lam
d0f7daf4cf Revert "[engine.i] QofQueryParamList * args must be freed"
This reverts commit 72a3ebbba3. Freeing
does not apply to all qof_query_* calls.
2021-09-11 15:45:32 +08:00
Christopher Lam
72a3ebbba3 [engine.i] QofQueryParamList * args must be freed 2021-09-11 14:59:18 +08:00
John Ralls
b8552a8070 Fix python transaction test_date on Ubuntu-81.04.
Python3 there is too old for fromisoformat, use direct construction
instead.
2021-09-10 17:01:38 -07:00
John Ralls
fcab298245 Add test for Transaction GetDate() in python bindings.
Pursuant to Bug 798284.
2021-09-10 13:26:59 -07:00
Christopher Lam
140922a37e QofQuery args must be destroyed after qof_query_merge
qof_query_merge returns a new QofQuery; the two merged QofQueries are
not explicitly destroyed.
2021-09-09 19:19:44 +08:00
Christopher Lam
c6d8333811 Merge branch 'maint' 2021-08-27 20:33:31 +08:00
Christopher Lam
37cb886de5 [engine.i] gnc_budget_get_account_period_note to be freed by the caller
amendment to last commit.

this pair of changes was necessary to allow the GValue to be unset.
2021-08-25 09:17:25 +08:00
Christopher Lam
929cb3d0c1 [engine.i] free swigged GList* arg 2021-08-24 00:13:45 +08:00
Christopher Lam
9fc1ac6be1 Merge branch 'maint-guile-changes' into maint #1111 2021-08-20 17:02:19 +08:00
Christopher Lam
9bc44c62e6 [engine.i] free GSList* key_path arg to qof_book_get_option
Addendum to 6c8af6aab need to specify exact typemap target.
2021-08-20 17:01:42 +08:00
Christopher Lam
6c8af6aab1 [engine.i] free GSList* arg to qof_book_get_option 2021-08-20 09:03:37 +08:00
Christopher Lam
c4a0fb468b [srfi64-extras.scm] exit instead of return #t if no failures
due to change in guile-3.0.7 to fix srfi64 bug
2021-08-19 20:56:13 +08:00
Christopher Lam
eafc290034 Merge branch 'maint' 2021-08-12 22:28:58 +08:00
Christopher Lam
de1ad9367a g_free gnc_ctime which returns a new gchar* 2021-08-05 21:42:31 +08:00
Frank H. Ellenberger
b31b8dbd1e Merge PR #1103 into maint 2021-08-04 20:16:14 +02:00
Steven Walter
5f721614ad Remove unneeded .decode() from Invoice*.tex.templ
These values are already str's, don't decode them
2021-08-03 15:59:54 -04:00
Christopher Lam
a3177e8b6b [swig] %newobject to g_free AccountList* functions 2021-08-03 12:14:12 +08:00
Christopher Lam
e0d953bfc8 [swig] %newobject to g_free gchar* functions 2021-08-03 12:14:12 +08:00
Steven Walter
3ed6b4dab9 latex_invoices.py: write takes string not bytes
write() fails if you give it bytes, so don't encode
2021-08-01 22:17:41 -04:00
Steven Walter
ba4852a9da latex_invoices.py: use default locale
Don't hardcode a locale.  Empty string means to use the user's locale
(e.g. $LANG)
2021-08-01 22:17:11 -04:00
Steven Walter
ad3895fa07 latex_invoices.py: don't decode() a str
These functions all return str's not bytes.  Therefore there is no need
to decode them.
2021-08-01 22:16:33 -04:00
John Ralls
90b8fce59f Fix build after merge. 2021-07-31 17:54:29 -07:00
John Ralls
08bf3ec5b0 Merge branch 'maint' 2021-07-30 10:28:57 -07:00
Christopher Lam
9767c86337 [engine.i] some GLists must be freed 2021-07-29 23:56:10 +08:00
John Ralls
6c7f976a65 Make second arg to gnc_glist_to_scm_list const char*
So that C++ won't complain when passed a static string.
2021-07-10 17:29:15 -07:00
John Ralls
81c5ac6689 Remove the incomplete book-currency code.
Not everything from the 6 Book-Currency commits is removed: Switching
the Num and split-action fields and restricting edits of transactions
older than n days were included and those changes are left in place.

Some other partly-implemented features were also part of these commits
and were removed: Options for setting a default capital gains account
and currency, completion of the LIFO cap-gains policy, and creation of
a list of cap-gains policies.

If any of these are to be revived they should each be done in a separate
feature branch and submitted via Github pull request for a code review
before merging; a design discussion on gnucash-devel before restarting
work is also advisable.
2021-07-10 17:29:11 -07:00
luz paz
95f8884892 Fix misc. typos in comments 2021-06-29 08:46:34 +02:00
Christopher Lam
1b4d30b3b1 Merge branch 'maint' 2021-06-22 23:30:20 +08:00
John Ralls
da3bd8ec0e [bindings/guile/test] add SRFI64 test sources to the dist. 2021-06-13 15:25:23 -07:00
Hong Xu
79d5270c9d Fix a variable name typo in Python binding gnc_pricedb_lookup_latest_before_t64
commodit -> commodity
2021-06-13 01:12:59 -07:00
Christopher Lam
b25a444140 Merge branch 'maint' 2021-05-14 21:16:48 +08:00
Christopher Lam
14c523e4f1 [test-engine-extras] augment book data generators
* txn-currency can be specified explicitly instead of currency of
first split
* split memos can be specified

Note test-register.scm gets some changes because the Trans Num field
was erroneously saved into Split Action fields. Now the num field is
only copied into the TransNum field.
2021-04-30 08:55:26 +08:00
Christopher Lam
e6355be755 [test-scm-engine] remove support for functions deprecated in 4.x 2021-04-24 23:34:58 +08:00
Christopher Lam
5ce8f78f77 Merge branch 'maint' 2021-04-24 23:16:22 +08:00
Christopher Lam
5957b3c256 Add scheme backward compatibility functions renamed in #979 2021-04-23 21:20:42 +08:00
John Ralls
49102c7ac2 Python Bindings: Provide a deprecated GncPriceDB.lookup_latest_before_t64.
To avoid breaking user scripts.
2021-04-23 11:56:15 +01:00
Robert Fewell
87285f945e Update gnucash_core.py with gnc-pricedb function name change 2021-04-23 11:56:15 +01:00
John Ralls
490f9a8035 Change the g_log macro calls to QofLog ones so that they don't go to /dev/null. 2021-04-13 16:58:11 -07:00
koldavi
506fd57989
Fix to_string_with_decimal_point_placed
>>> nominator='123456'
A digit is missing in the string returned from to_string_with_decimal_point_placed. The -1 error.
>>> point_place=2
>>> nominator[:-point_place - 1], nominator[-point_place:]
('123', '56')
2021-04-01 13:26:15 +02:00
Christopher Lam
d28ff20ff7 Merge branch 'maint' 2021-03-29 17:29:19 +08:00