- avoid hashing Account* twice. one call to operator[] is sufficient.
- don't need use std::move with better constructors
- sanity check - can't have a budget with num_periods = 0
- remove unused headers
- don't need to create/destroy GHashTable for each feature query
- plugs leak: g_hash_table_unref (features_used) not always called properly
- to check 1 feature, don't need to traverse whole GHashTable
Instead of using static_assert. This prevents the compiler from even
trying and avoids weird compilation errors when testing types for
instantiating other templates.
The compiler complains that there's no matching
gnc_register_number_range_option for GncOptionDB*, which without this
commit is true because the explicit templates are for GncOptionDBPtr&.
Note that the original template definition is for GncOptionDB* and
that the header-defined inlines that take GncOptionDBPtr& call the
GncOptionDB* version.
Because when loading the value the split in the xml backend doesn't yet
have a parent so the code tried to convert to GNC_COMMODITY_MAX_FRACTION
and if the numerator was larger than 10^10 that would overflow.
To fix it this changes the "don't know" response to get_currency_denom
and get_commodity_denom to GNC_DENOM_AUTO which will normally leave
the denominator alone.
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.
tests TXN_TYPE_NONE in utest-Transaction.c
testing TXN_TYPE_INVOICE, TXN_TYPE_PAYMENT, and TXN_TYPE_LINK will
require valid posted invoices, so, are best tested in utest-Invoice.c
When a top level bayesian entry is deleted, the book is not marked
dirty and so the save button is not highlighted. Deleting individual
entries did mark book dirty.
Fixed in gnc_account_delete_all_bayes_maps by wrapping the deletion
with xaccAccountBeginEdit/CommitEdit block.
day of fall change from Daylight Time to Standard Time.
Really any day where the period crosses the dst->std change, and
since the date dialog returns local midnight for the time that includes
the day of the change.
Convert both the parameter time and the return time to neutral time
to ensure that the interval is handled correctly.
With the accounting period preference settings set to 'Start/End of
previous quarter' and balance sheet report using 'End of accounting
period' the date is wrong, currently is 30/03/2022 when it should be
31/03/2022.
Simplify gnc_gdate_set_quarter_end to get correct last day and
subtract the 3 months befor calling said function.
Found via `codespell -q 3 -S *.po,./po,*.min.js,./ChangeLog*,./NEWS,./borrowed,./doc/README*,./AUTHORS,./libgnucash/tax/us/txf-de*,./data/accounts -L ans,ba,cas,dragable,gae,iff,iif,mut,nd,numer,parm,parms,startd,stoll`
The Book Options, counter formats were being stored under the 'options'
tree but need to be stored in the 'counter_format' tree similar to the
'counters' tree.
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.
Leave it to users to categorize their non-currency commodities. In the
QIF importer default non-classifiable commodities to
GNC_COMMODITY_NS_NONCURRENCY.
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.
If book has budgets, and GNC_FEATURE_BUDGET_UNREVERSED isn't set,
check and fix budget amount signs. Previously budgets were created
with assumption that sign reversal was set to credit amounts. A
heuristic approach is used:
- if budgeted expense is negative, conclude sign reversal is
"Income and Expense"
- if budgeted liability is positive, conclude sign reversal is
"None"
- otherwise conclude sign reversal is "Credit Accounts"
The above is calibrated to (hopefully) prefer sign reversal of Credit
Accounts.
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).
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.
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.
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.
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.
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.
At the beginning of a transactions edit, xaccTransBeginEdit is used and
part of that duplicates the existing splits so that they can be
restored if editing is cancelled. If cancelled, xaccTransRollbackEdit
is used to restore the origin splits but if a split was not changed,
the copy was not being freed so loop over the original split list and
free them.
The two prices used in convert_price had there reference count
increased in extract_common_prices. This lead to the reference count
continuously increasing and not being freed on close so add
gnc_price_unref on both prices to reduce the reference count.
There is no need to act differently when destroying the scheduled
transactions accounts, they can be destroyed when the scheduled
transaction is freed under normal conditions and on book close.
When Gnucash is shutting down, the TaxTables and BillTerms will be
destroyed/freed and may already have been so there is no point trying
to decrement a reference that is used to stop them being destroyed if
in use.
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().
If the current quarter ends June 30 backing up 3 months from there
gets March 30, one day off. Back up first and calculate the end
of the actual quarter of interest.
Changed pre_quarter_start for consistency, it doesn't matter.
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.
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.
Under some build conditions boost::typeindex will use an internal type
identifier that's different from the C++ builtin. In that case type equality
tests to C++ typeid in boost::variant will fail, breaking it. Using
boost::typeindex::type_id ensures that the comparisons always work.
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.
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.