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.
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.
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.)
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.
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.
dxaccAccountGetPriceSrc and dxaccAccountGetQuoteTZ.
DxaccAccountSetCurrency remains untested - unsure how to retrieve an
ISO4217 currency to use as parameter.
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.
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.
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.
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?.
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.
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.
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.
- 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
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.
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.
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().
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.
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.
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.
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.
four digits in length generates an error message.
Because the grouping is off. Checking grouping on input is pointless so
just ignore the grouping separator when parsing number input.
Inspired by PR #983. Transaction sorting on num broke down if the
user had a non-numeric string or a number larger than an int in
the effective num field (might be split-action if the option is set).
The comparison first tries to use strtoull on the two strings and
compares the results. If they're both nonzero and different then the
numeric order is returned. If they're both nonzero but the same the
unconverted parts of each are passed to g_utf8_collate; if either is 0
then the whole strings are passed to g_utf8_collate. strtoull will
return 0 for a negative number.
* Re-commit the original transaction to ensure that there aren't
any stray trading splits.
* If the original and cloned transactions have a different number of
splits don't leak the cloned transaction.
* Check that the cloned transaction isn't NULL before trying to invert
it.
If copied text includes control characters they are inserted when
pasted which can cause alignment issues. This commit filters the
clipboard text for control characters before it is pasted.
after the trading account was created breaks GnuCash.
Revisited. The original changeset looked for a top level trading account
and a namespace account in the transaction currency; if either of those
accounts had been created in a different currency it would duplicate
them.
This commit will accept any such account regardless of commodity. If
more than one exists it will prefer the one in the root currency if
there is one, otherwise it will select the first one found.
Fix the compilation error on gcc 10:
gnucash/libgnucash/engine/gnc-pricedb.c: In function âextract_common_pricesâ:
gnucash/libgnucash/engine/gnc-pricedb.c:2469:40: error:
to_price may be used uninitialized in this function [-Werror=maybe-uninitialized]
2469 | if (from_price == NULL || to_price == NULL)
| ^
gnucash/libgnucash/engine/gnc-pricedb.c:2469:20:
error: âfrom_priceâ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
2469 | if (from_price == NULL || to_price == NULL)
| ^
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.
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.
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.
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.
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.
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.
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.
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.
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
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.