Commit Graph

1435 Commits

Author SHA1 Message Date
John Ralls
67e8c317da [xml backend] Extract functions to make gz_trhead_func more readable. 2022-03-01 12:49:12 -08:00
Alex Aycinena
a2825d33a1 Update Form/Schedule line references for 2021 for the US Income Tax Report 2022-01-27 12:00:31 -08:00
Christopher Lam
f0de54ac7a Merge branch 'maint-798406' into maint #1240 2022-01-19 19:16:14 +08:00
Christopher Lam
8bc080b96d [gnc-budget] store budget kvp data onto memory upon first call.
then each getter will retrieve from memory rather than backend's kvp.
2022-01-17 09:34:46 +08:00
Christopher Lam
ef8d812d3f [utest-Budget] test data retention when modifying budget num_periods 2022-01-17 09:31:28 +08:00
Christopher Lam
87b0a41e9b [Split.c] return price==0 instead of 1, if !split, or amt==0 2022-01-10 19:19:25 +08:00
Christopher Lam
c3eaff9bb2 [account.cpp] gnc_account_and_descendants_empty: don't copy children 2021-12-13 21:48:44 +08:00
Kevin M. Buckley
1e22632687 Bug 798382 - Typo corrections in comments 2021-12-12 09:50:48 -08:00
John Ralls
95b973f792 Bug 798352 - Decimal Precision when Entering Mutual Fund Transaction
Let xaccParseAmount parse up to 12 decimal places instead of 8.
2021-12-09 15:55:37 -08:00
Christopher Lam
33b6dfc6ce [options.scm] addendum ca6604c93 gnc:make-budget-option
selection-budget changed from budget object to guid, handle other uses
as appropriate.
2021-12-04 20:35:04 +08:00
Christopher Lam
ca6604c93c [options.scm] Addon previous commit... need to initialize with guid 2021-12-04 08:59:14 +08:00
Christopher Lam
d740ac1cb0 Merge branch 'budget-option-stores-guid' into maint PR #1207 2021-12-04 08:24:10 +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
ae7eaad018 Merge Chris Good's 'maintBug797678OfxAppend' into maint. 2021-12-03 13:44:50 -08:00
John Ralls
17a3f7fef2 Merge Stefan Bayer's 'SepaInternalTransfer' into maint. 2021-12-03 13:11:28 -08:00
Christopher Lam
5a812ca1eb [options.scm] gnc:make-budget-option stores guid instead of object
because object may become stale if UI is used to delete it, leading to
stale pointer and segfault. storing guid is safer, and will return
null if budget is deleted.
2021-12-04 01:37:08 +08:00
John Ralls
ff04ad3785 Bug 798346 - crashes when running check & repair
Don't scrub trading accounts for imbalances, see the comment in
the commit for why.
2021-11-08 18:06:29 -08:00
Christopher Lam
984d816a58 Merge branch 'maint' 2021-11-06 21:41:17 +08:00
Christopher Lam
79d8ef0299 Revert b5f5129f7 using gnc_list_length_cmp 2021-11-02 23:34:26 +08:00
Christopher Lam
3dfdf60608 [gnc-glib-utils] Define and export gnc_list_length_cmp 2021-11-02 23:34:25 +08:00
Christopher Lam
b5f5129f7d Shortcut g_list_length comparison against small numbers
It's more efficient to test node && node->next etc when testing GList
length against small numbers
2021-10-30 22:29:17 +08:00
Christopher Lam
f813f7cd14 [gnc-autoclear] Move autoclear algorithm into gnome-utils 2021-10-28 21:41:46 +08:00
goodvibes2
8ad29feaba Bug797678 OFX import should append not replace, existing Notes & Desc
Add an "Append" checkbox to the bottom of the "Generic import
transaction matcher" window to the left of the "Reconcile after match"
checkbox.
When ticked, this causes the imported Description/Notes to be appended
to the matched transaction Description/Notes respectively.
The selected ticked/unticked state of the "Append" checkbox is saved in
a key value pair for the import account, so the next import for that
account will automatically default it to the saved state.
As these mods are limited to the code for the matcher window, this
should work for all the imports that use it - ie ofx & csv file imports
(both tested) & aqbanking (cannot test).
2021-10-28 10:58:07 +11:00
Geert Janssens
bdb06479e8 GSettings - fix GObject warning when old prefs-version is unset
This will happen when current master (future 5.0) has been run
at least once.
2021-10-27 10:35:11 +02:00
John Ralls
5a8cbf4193 Bug 798325 - New Currency for Venezuela (VED)
Add latest Venezuelan revaluation of the Bolivar Soberano, following
the ISO notation replacing VES (which the Venezualan central bank is
keeping) with VED and the exchange code (ditto) with 926.
2021-10-23 12:27:11 -07:00
Christopher Lam
f40dbb8c28 Avoid unnecessary g_list_length in equality functions 2021-10-21 17:56:15 +08:00
Christopher Lam
f0970c8eb4 [gnc-features] don't repeatedly g_strconcat gchars* 2021-10-20 19:29:32 +08:00
Christopher Lam
31a0300abe [Recurrence.c] avoid repeated calls to g_list_length 2021-10-20 19:29:26 +08:00
Christopher Lam
b480600dc8 [gnc-pricedb] gnc_price_list_equal: avoid 4 g_list_length calls 2021-10-18 22:41:44 +08:00
Christopher Lam
23e528f51a [utest-gnc-pricedb] add tests for gnc_price_list_equal
Also need to change PWARN which causes test failure, to PINFO
2021-10-18 22:25:21 +08:00
Geert Janssens
09b3ce2382 Revert "Add structure to map migrated preferences to old ones"
This reverts commit c6103a5c17.
2021-10-16 19:02:17 +02:00
Geert Janssens
806d0b3157 Revert "GSettings - make most of the api private"
This reverts commit 26b2d7ca78.
2021-10-16 19:02:10 +02:00
Geert Janssens
1d4673ed2a Revert "GSettings - rework internal helper functions to use more C++"
This reverts commit 24fa289952.
2021-10-16 19:02:04 +02:00
Geert Janssens
24fa289952 GSettings - rework internal helper functions to use more C++ 2021-10-16 10:49:05 +02:00
Geert Janssens
26b2d7ca78 GSettings - make most of the api private
All preference calls should happen via the gnc_prefs_... apis.
The gnc_gsettings_... apis are an internal implementation of this.
2021-10-16 10:49:04 +02:00
Geert Janssens
c6103a5c17 Add structure to map migrated preferences to old ones
This can be used to keep both in sync in the period between
initial migration and eventual obsolence.
Note only non-obsoleted, migrated preferences are tracked.
We don't want to resync preferences that have been
obsoleted (reset). That would nullify the whole idea
of making them obsolete for future removal.

This commit only adds the mapping, synching will follow in a future
commit.
2021-10-16 10:49:04 +02:00
John Ralls
2f4438ab28 Bug 798335 - No longer possible to change trading account
Strip trading splits only if "Use Trading Accounts" is enabled
for the book so that users who want to manage trading accounts by
hand may do so.
2021-10-14 17:22:32 -07:00
Christopher Lam
9eaa3eb23a Merge branch 'maint' 2021-10-14 09:34:28 +08:00
John Ralls
7c9c2eba3c Bug 798320 - Error message indicating a crash of GNUcash when closing...
application - MacOS 10.15.7 (19H1419)

Destruction order problem: The SX template accounts can't be destroyed
until after the template splts and transactions are.

Register them before the transactions and splits, as destruction occurs
in reverse order of registration.
2021-10-08 14:17:28 -07:00
Geert Janssens
e64bcfe620 Merge branch 'maint' 2021-10-01 14:51:04 +02:00
Geert Janssens
9a465fc359 GSettings - add 'deprecate' and 'obsolete' conversions for user preferences
'deprecate' is technically a noop. It serves to remind maintainers
the 'deprecated' preference is to be obsoleted in the next major
release.
'obsolete' goes one step further in that it will cause gnucash to reset
the preference, effectively clearing the value stored in the preferences
backend. This is the final phase of a preference. Following this it
will be completely removed from the GSettings schema in the next
major release.

Notes
* 'deprecate' and 'migrate' are related. Both are a reminder the
preference is to be obsoleted in the next major release. 'deprecate'
does only that though while 'migrate' will also trigger a copy of
the old value to a new location in the databse.

* This commit readds a couple of preferences that had been removed
in the past to be able to properly obsolete them (and to test
the obsoleting code)
2021-10-01 14:46:55 +02:00
Geert Janssens
64576f7d27 GSettings - widen scope from 'migration' to 'transformation'
This commit mostly changes descriptions and variable names to
use the more generic terms 'transformations' or 'conversions'.
'migration' is only one possible transform, future commits will
add others.
There are no functional changes in this commit other than
a logic inversion in parse_one_release_node. It now checks
for nodes named 'migrate' rather than for nodes not named
'migrate' (the code is adapted accordingly to match this
logic change).
2021-10-01 13:59:55 +02:00
John Ralls
29e7b07ed3 Remove superflous schema_source left over from pasting. 2021-09-28 17:17:23 -07:00
John Ralls
8bfa5a63f2 [gsettings] Avoid crash from settings schema not being registered. 2021-09-28 11:00:05 -07:00
Christopher Lam
10c1223df2 Merge branch 'maint-progress' into maint #1150 2021-09-27 08:10:02 +08:00
Geert Janssens
2a7566cc40 Win32 - drop conditional code never reached
We had hardcoded HAVE_HTMLHELPW to always be true so the fallback
code that's only reached when it is false was never reached.
Time to drop this dead code.
2021-09-26 22:58:08 +02:00
John Ralls
67191203ae Merge branch 'maint' 2021-09-26 10:46:06 -07:00
Christopher Lam
d82bb7b8a2 [Transaction.c] use is_unset static to denote uncached readonly_reason
tests in 128c8d6f88
2021-09-26 09:40:32 +08:00
Christopher Lam
128c8d6f88 [utest-Transaction] add tests for xaccTransGetReadOnly 2021-09-25 13:27:56 +08:00
Geert Janssens
8ea52ae212 GSettings - run data model transations while setting up
This makes sure all schema changes are in effect before
the first consumer can query them. For example this will
prevent a one-time re-occurrence of the tip of the day dialog
the first time the new migrations are run.
2021-09-22 15:44:30 +02:00
Christopher Lam
c0736a1a04 Merge branch 'maint-leaks' into maint #1135 2021-09-22 21:06:25 +08:00
Geert Janssens
f1802b6fdf GSettings Upgrade - add code to migrate settings
The rules for migration are read from an xml file. This file was
prepared in a previous commit. Future settings 'data model' changes can
reuse this code by simply adding migration rules in the xml file.

This replaces the hardcoded rules that were currently in place to
migrate a few settings from 2.6 and older to 3.0. These rules are no
longer meaningful as we require users to migrate from one major release
series to the immediate next one. So by the time the new migration rules
in this commit are applied by users they should already have run gnucash
3.x at least once. That run should have taken care of the pre-3.0
migration actions.
2021-09-21 17:10:56 +02:00
Geert Janssens
f21c7b6e90 GSettings - define old prefix and check settings for the presence of both prefixes while normalizing 2021-09-21 17:10:56 +02:00
Geert Janssens
a203c5b2d5 GSettings - drop logic to relocate our settings
This was ported from GConf, but GSettings doesn't work that way.
Settings locations are defined at compile time and can't be
relocated at run time (unless you make all of the settings
explicitly relocatable. That however is not how GSettings is meant to be
used.)
2021-09-21 17:10:56 +02:00
Geert Janssens
d1113a4534 GSettings - build as cpp 2021-09-21 17:10:56 +02:00
Geert Janssens
02fbf217f6 GSettings Upgrade - change schema prefix from org.gnucash to org.gnucash.GnuCash
The latter is the prefix format prescribed by gsettings itself. The former never
was an issue until flatpak decided to not accept the shorter prefix when
requesting a settings migration from host system to flatpak sandbox.

In order to allow for migration, keep the old schema around in
org.gnucash.GnuCash.deprecated.gschema.in

While we're at it, make the new prefix an internal implementation detail.
There's no need for it to be visible to the rest of the gnucash code.
2021-09-21 17:10:55 +02:00
Geert Janssens
6674b1bb6b Cleanup - minimal glib=2.56.1 - drop all conditionals on older versions 2021-09-21 17:10:55 +02:00
Christopher Lam
87b61bf6fb [account.cpp] GValue must be unset in old functions
GValue in DxaccAccount[Set|Get]Currency is unset correctly.

However dxaccAccountGetPriceSrc and dxaccAccountSetQuoteTZ reuse a
static char* therefore the latter must be used carefully before
calling the function again. The functions are tested in
4309469730.
2021-09-19 11:28:25 +08:00
Christopher Lam
86cf327f09 [account.cpp] GValue containing string must be unset
already have comprehensive tests in 15852031d
2021-09-19 11:28:25 +08:00
Christopher Lam
c8a53c54f2 [account.cpp] refactor gnc_account_get_map_entry
Have comprehensive tests in a5d101d1b
2021-09-19 11:28:25 +08:00
Christopher Lam
4309469730 [utest-Account] test old dxaccAccount* functions
dxaccAccountGetPriceSrc and dxaccAccountGetQuoteTZ.

DxaccAccountSetCurrency remains untested - unsure how to retrieve an
ISO4217 currency to use as parameter.
2021-09-19 11:27:03 +08:00
Christopher Lam
a5d101d1be [utest-Account] test gnc_account_get_map_entry 2021-09-15 21:09:01 +08:00
Christopher Lam
73ad5b1265 [gnc-glib-utils] use g_stpcpy instead of gnc_strcat
g_stpcpy will use stpcpy wherever available.
2021-09-15 21:09:01 +08:00
Christopher Lam
aa0668f9e6 Revert "[account.cpp] deprecate old dxacc* functions"
This reverts commit d290c3c45d. These
functions are not deprecated after all.
2021-09-15 21:09:00 +08:00
Christopher Lam
d290c3c45d [account.cpp] deprecate old dxacc* functions 2021-09-15 09:20:04 +08:00
Christopher Lam
374443747d [account.cpp] new static: get/set_kvp_string_path
exactly the same as set_kvp_string_tag but will accept the full kvp
path.
2021-09-15 09:19:17 +08:00
John Ralls
1d8983191d Fix runaway sed error. 2021-09-14 16:24:28 -07: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
John Ralls
574f567b62 Refactor GncXmlBackend::get_file_lock.
Moving all of the error-handling to it for better clarity and
simplicity. Drop the unnecessary stat call, open will fail with
EEXIST if there's already a lock file. Provide specific messages
for file system failures.
2021-09-14 09:32:12 -07:00
John Ralls
d7eae0664f [gz_open] Use compress and write consistent with calling functions. 2021-09-14 08:29:11 -07:00
Christopher Lam
15852031d4 [utest-account.cpp] increase test coverage
adds getter/setter tests for

xaccAccountSetLastNum
xaccAccountSetTaxUSCode
xaccAccountSetTaxUSPayerNameSource
2021-09-14 07:12:15 +08:00
John Ralls
c3f8daaf7d Bug 798250 - Gnucash permanent hang on save while loading report
Prevent WebKit's fork from getting a copy of the pipe's file descriptors
and so keeping the pipe from closing.

Thanks to Simon Arlott for recognizing the FD duplication.
2021-09-13 13:18:10 -07:00
Christopher Lam
017ab06939 Merge branch 'maint' 2021-09-12 22:44:34 +08:00
John Ralls
edad194389 Bug 798180 - Update to macOS Big Sur 11.3 breaks Finance Quote
Added new dependency Test2 to gnc-fq-update. This is a second-order
dependency of Finanance::Quote that CPAN doesn't seem to recognize
on its own.
2021-09-11 16:09:55 -07:00
John Ralls
cd0d50aac1 Deprecate date options with a time of day setting.
Removing the only use, an example in hello-world.scm. GnuCash doesn't
use this value in any of its own report options and the feature will
be removed in GnuCash 5.

Related to bug 798297 Pref "Use 24-hour clock" obsolete?.
2021-09-10 12:21:46 -07:00
John Ralls
8ab8642e76 Fix leak of trading_splits list in xaccTransClearTradingSplits 2021-09-09 16:32:43 -07:00
John Ralls
1387d5f960 Fix unchecked ptr dereference.
First crash in Bug 798225.
2021-09-09 16:32:43 -07:00
John Ralls
ab24c34660 Merge Simon Arlott's 'free-template-root' into maint. 2021-09-07 12:14:41 -07:00
Simon Arlott
4a8acf3fb2 Free template root accounts on book end
The template root should be unset so that it's destroyed when the book is
ending. This is required to free all the template accounts and referenced
strings.

The scheduled transactions themselves need to be freed first so reverse
the order that SXRegister and gnc_sxtt_register are called in
cashobjects_register: The list resulting from that function is traversed
from the bottom up.
2021-09-07 12:11:05 -07:00
John Ralls
901fea158f Merge Simon Arlott's 'xml-locking-fixes' into maint. 2021-09-06 15:22:49 -07:00
John Ralls
38cd06e54a Remove the lock-file-link-count test from the XML backend.
This was an effort of somewhat dubious value to detect if a process
on another ocmputer had a hsrd-link to a lockfile on an NFS share.
NFS is rarely used now and SMB doesn't support hard links so this check
adds complexity with no real value.
2021-09-06 15:18:34 -07:00
John Ralls
079a900300 Bug 798298 - Re-imported transactions no longer ignored
Merges Jean Laroche's '798298_reimport_ofx' into maint.
2021-09-06 13:51:26 -07:00
Mike Alexander
068a5d2fa8 Fix xaccSplitGetOtherSplit which was broken by 028bf9826, don't
count splits that aren't really in the transaction.

The rewrite left out one test.  This was most obvious in the dummy
transaction used to enter a new transaction into an account.
xaccSplitGetOtherSplit never returned an "other split" for this
transaction.  It turns out the old code was broken too, but
it worked for this case by coincidence.
2021-09-06 02:45:37 -04:00
jean
4e9fe0a4d1 Add missing function to mock account 2021-09-05 17:52:34 -07:00
Christopher Lam
8d502fcdd8 Merge branch 'maint' 2021-09-02 22:17:22 +08:00
Christopher Lam
1eb6709331 [test-lots.cpp] add kvp getter/setter changes 2021-08-31 23:16:43 +08:00
Christopher Lam
323182c9f7 [utest-Account.cpp] add kvp getter/setter changes 2021-08-31 23:16:43 +08:00
Christopher Lam
8a37c4c019 [utest-Invoice.c] add kvp getter/setter tests 2021-08-31 23:16:43 +08:00
Christopher Lam
9ec670f828 [test-commodities.cpp] add kvp setter/getter test 2021-08-31 23:16:42 +08:00
Christopher Lam
d4c8b36f9f [utest-Transaction.cpp] add kvp setter/getter tests
wasn't tested before
2021-08-31 23:16:42 +08:00
Christopher Lam
c3b50f0b58 [gnc-lot.c] fix - cache value properly 2021-08-31 23:16:42 +08:00
Christopher Lam
595e126a34 [account.cpp] modify set_kvp_string_tag to accept strstrip or nullptr
- will remove a second call to g_strstrip (g_strdup (str))
2021-08-31 23:16:42 +08:00
Christopher Lam
c5a6383b43 [account.cpp] fix - incomplete #1117
- init struct members properly to: is_unset and TriState::Unset
- test acct kvp "equity-type" for "opening-balance" instead of "true"
- cached account->color/sort_order/notes/filter gets strstripped
  similarly to previous behavior
2021-08-31 23:16:42 +08:00
Christopher Lam
001b34616f [Transaction.c] GValue string must be unset 2021-08-29 15:38:16 +08:00
Christopher Lam
a47bee97d6 [Split.c] GValue string must be unset 2021-08-29 15:38:16 +08:00
Christopher Lam
0ecbcb4ef1 [gnc-lot.c] GValue string must be unset 2021-08-29 15:38:16 +08:00
Christopher Lam
ac2afc7e13 [gncInvoice.c] GValue string must be unset 2021-08-29 15:38:16 +08:00
Christopher Lam
3bf49ed8d7 [Account.cpp] GValue string must be unset 2021-08-29 15:38:16 +08:00
Christopher Lam
e3af2f22f9 [gnc-commodity.c] cache user_symbol into commodity struct
Continuation of ff2ceb111 which introduced issue whereby user_symbol
returned could become stale, leading to invalid read fixed with
c398bef59. There are likely other user_symbol pointers becoming stale
without this commit.

This change will save the user_symbol into the commodity struct,
avoids gchar* becoming stale.
2021-08-29 15:38:16 +08:00
John Ralls
57f73d70c7 Merge Yordan Miladinov's denom_lcd into maint. 2021-08-27 12:34:07 -07:00
Christopher Lam
c6d8333811 Merge branch 'maint' 2021-08-27 20:33:31 +08:00
Christopher Lam
c55ab50349 [gnc-budget.c] gnc_budget_get_account_period_note to be freed by the caller 2021-08-24 23:02:15 +08:00
Christopher Lam
9ddb9e8215 [gnc-module.c] free a GList* properly
g_list_free (current) was a NOP because current became NULL after the
preceding GList traversal.
2021-08-24 22:32:39 +08:00
Simon Arlott
0665208299
xml-backend: Lock file is deleted even if the lock is not acquired
The lock file is set in m_lockfile and then unlinked in session_end even if
the lock was not acquired.

Clear m_lockfile if locking was not successful.
2021-08-24 09:29:47 +01:00
Simon Arlott
e4619fdae6
xml-backend: Don't try to close m_lockfd if it's not open
m_lockfd is not initialised. If the file is locked then it will not be set
before session_end and close() will be called on an uninitialised int.

Initialise it to -1 in the class definition.
Consistently use -1 instead of "< 0" or "< 1" as the definition of invalid.
Always set it to -1 after closing it.
2021-08-24 09:29:45 +01:00
Yordan Miladinov
6cb509ea7d
fix an uncaught exception: denom_lcd may throw an overflow exception if casting lcm to int64_t fails 2021-08-24 00:58:31 +03:00
Christopher Lam
7e41efc232 Merge branch 'maint-speedup-and-leaks' into maint #1109
Speedup xaccSplitGetOtherSplit
2021-08-20 21:23:35 +08:00
Christopher Lam
ff2ceb111d [gnc-commodity] GValue must be unset 2021-08-20 17:02:58 +08:00
Christopher Lam
028bf9826b [Split] xaccSplitGetOtherSplit don't test book trading-accts
don't test trading-acct property when finding other split.
2021-08-17 13:04:34 +08:00
Christopher Lam
6bf5a618de qof_instance_get gchar* must be freed
A call to qof_instance_get expecting a gchar* receives a newly
allocated string which must be freed.
2021-08-15 09:49:06 +08:00
Christopher Lam
e4d808e674 [qofbook] qof_book_use_split_action_for_num_field: free a char*
qof_instance_get allocates a new char* which must be freed.
2021-08-13 08:58:07 +08:00
Christopher Lam
eafc290034 Merge branch 'maint' 2021-08-12 22:28:58 +08:00
Christopher Lam
40d886fa9d gnc_account_list_name_violations elements must be freed 2021-08-12 09:39:08 +08:00
Christopher Lam
4c37f6d4ef [account.cpp] gnc_g_list_stringjoin instead of repeated allocations 2021-08-12 09:19:34 +08:00
Christopher Lam
e84549926b [gnc-glib-utils] gnc_g_list_stringjoin to join a GList of strings
It traverses the GList twice (once to calculate the length) but
allocates only once.

Includes snippet from
https://www.joelonsoftware.com/2001/12/11/back-to-basics/
2021-08-12 09:19:34 +08:00
Christopher Lam
bedc85afa3 Merge branch 'maint-leaks' into maint #1101 2021-08-06 19:30:01 +08:00
Christopher Lam
0420ae6a66 [account.cpp] refactor gnc_account_list_name_violations 2021-08-06 17:31:36 +08:00
Christopher Lam
67bd513514 [account.cpp] rewrite gnc_account_foreach_descendant_until in C++ 2021-08-06 17:31:36 +08:00
Christopher Lam
17953441cb [account.cpp] refactor gnc_account_foreach_descendant 2021-08-06 17:31:36 +08:00
Christopher Lam
5698b67bf5 [account.cpp] refactor gnc_account_lookup_by_code 2021-08-06 17:31:36 +08:00
Christopher Lam
09e2e7613c [account.cpp] refactor gnc_account_lookup_by_name 2021-08-06 17:31:36 +08:00
Christopher Lam
bebc366e88 [account.cpp] refactor gnc_account_n_descendants 2021-08-06 17:31:35 +08:00
John Ralls
f0926d66c1 Merge Simon Arlott's 'qof-instance-dispose' into maint. 2021-08-05 11:45:14 -07:00
Christopher Lam
e6c33a39bc [account.cpp] refactor gnc_account_get_descendants{_sorted} 2021-08-06 00:23:12 +08:00
Christopher Lam
d2db43019c [account.cpp] internal function account_foreach_descendant
fast and efficient
2021-08-06 00:23:12 +08:00
Christopher Lam
de1ad9367a g_free gnc_ctime which returns a new gchar* 2021-08-05 21:42:31 +08:00
Simon Arlott
7a0ea190ca
qof_instance_dispose should always complete dispose processes
If QofInstancePrivate has no collection then qof_instance_dispose() returns
without completing the rest of its dispose processes, skipping removal of
its type string from the string cache resulting in a reference count leak.

Change the check for a collection so that it only affects the call to
qof_collection_remove_entity().
2021-08-05 08:56:51 +01:00
Christopher Lam
c9db551693 g_free qof_print_date which returns a new char* 2021-08-05 09:23:28 +08:00
John Ralls
d099d39afd Merge Simon Arlott's 'commit-root-on-load' into maint. 2021-08-04 15:52:51 -07:00
John Ralls
fd56512cf7 Merge Simon Arlott's 'load-test-xml' into maint. 2021-08-04 15:48:42 -07:00
John Ralls
9062be3d47 Merge Simon Arlott's 'string-cache-fixes' into maint. 2021-08-04 14:26:27 -07:00
John Ralls
f6766d42ec Merge Simon Arlott's 'string-cache-no-refcount-empty' into maint. 2021-08-04 14:19:21 -07:00
Christopher Lam
a5edacf0fc [options.scm] Rename option name to "Levels of Subaccounts"
Original name "Show Accounts until level". Add backward compatibility
missed in 08f490ee98
2021-08-04 19:02:30 +08:00
Christopher Lam
23bd716451 g_free gnc-path's gchar* intermediate strings 2021-08-03 12:14:12 +08:00
John Ralls
08bf3ec5b0 Merge branch 'maint' 2021-07-30 10:28:57 -07:00
Christopher Lam
f1e35daab3 Rename option name from "Extra notes" to "Extra Notes" 2021-07-23 06:25:01 +08:00
Christopher Lam
251db8c37b Rename option name from "Report title" to "Report Title" 2021-07-23 06:25:01 +08:00
Christopher Lam
2606ddf905 Rename option name from "Invoice number" to "Invoice Number"
This ensures it matches all other invoice reports.
2021-07-23 06:24:55 +08:00
Simon Arlott
4a5b5f3bf2
Don't cache the empty string
Avoid unnecessary reference counting for uses of the empty string.
2021-07-11 18:54:49 +01:00
Simon Arlott
320df7e409
Use const return values for string cache
This is a prerequisite for being able to return "" (which is const) and
none of the returned values should ever be modified.
2021-07-11 18:54:49 +01:00
Simon Arlott
4132939612
Avoid leaking string cache entries for "" in Transaction and Split
When g_object_new() is used, the strings that default to "" are added to
the string cache. These are then not correctly removed when updating them
with new values when cloning a Transaction/Split.

Use CACHE_REPLACE instead of CACHE_INSERT.
2021-07-11 18:52:09 +01:00
Simon Arlott
bf8fe1123c
Commit root accounts after loading from XML
The root accounts start with a non-zero editlevel because BeginEdit is
called for them during loading but not committed after loading.

If the book is then closed without performing any further edits that would
require a commit, the Account book_end process does nothing because the
root account is still being edited and so none of the accounts are freed.
2021-07-11 15:04:57 +01:00
Simon Arlott
f15402a9a6
Load test data from XML properly
If qof_session_new() is called without a book then qof_session_load()
won't do anything.

Set up a book for it to use.
2021-07-11 14:56:56 +01:00
John Ralls
e1c153a516 Bug 798224 - Scheduled transactions are created with date-entered...
copied from the template transaction.
2021-07-10 16:35:20 -07:00
Robert Fewell
0f026f6a10 Bug 798221 - Transfer funds between accounts with different currencies crashes Gnucash on macOS
In the scrub function find_account_matching_name_in_list there was a
test for account names being the same for currency but condition was
backwards so was matching on account names being different. There was
also a g_list_free resulting in a double free which was removed.
2021-07-08 09:33:10 +01:00
John Ralls
ebf84fbf8d Bug 798229 - GncDate::c_formats is being created and destroyed twice...
resulting in a double free crash on every exit.

Exclude by name the obsolete pre-GnuCash 4 modules from being inspected
so that they don't try to construct and destroy their static variables
twice.
2021-07-06 12:03:41 -07:00
John Ralls
06fc58c39d Merge Simon Arlott's 'load-pricedb-faster' into maint. 2021-07-05 14:48:48 -07:00
Simon Arlott
08b56e9669
[gnc-pricedb] Don't lookup old prices when doing bulk updates 2021-07-05 21:57:34 +01:00
Geert Janssens
60f50e34c7 Tax - fully express source file dependencies in build scripts 2021-06-30 15:19:34 +02:00