Commit Graph

51 Commits

Author SHA1 Message Date
Christopher Lam
9782918586 [account.cpp] add more account metadata - assoc account
the tag denotes the type of associated account eg. "dividend"
"capgains" "cash" "fees"
2024-01-26 20:54:20 +08:00
Christopher Lam
235e24a055 [account.cpp] ~GncImapInfo = gnc_account_imap_info_destroy 2023-09-15 23:34:43 +08:00
Daniel Johnson
04b0317119 Demonstrate fx handling in budget report 2023-04-29 12:01:36 -07:00
Geert Janssens
d75ab275f1 Eliminate gnc-csv-account-map.[ch]
The code is was only used by the csv import assistant and forced
gtk as a dependency on gnc-imp-props-tx

Part has been moved to Account, other bits have
been moved to the importer code where they were
used.
2023-03-13 19:58:10 +01:00
Geert Janssens
99506d331a Reduce GncImportMatchMap to just the account
There is no added value in storing the book and account together
The book is easily retrieved from the account (as was
illustrated in the gnc_account_imap_new function).

I looked through the commit history to understand why this struct
was originally created and a long time ago it also had
a reference to a kvp frame.
2023-02-04 16:53:20 +01:00
Geert Janssens
51706f289c Minor corrections in comments 2023-02-04 16:43:46 +01:00
Robert Fewell
a15c6f81b3 Allow the balances of sub accounts to be used in limits 2022-12-16 15:16:53 +00:00
Robert Fewell
518ecfe041 Add some functions that would allow adding a balance limit to accounts 2022-12-10 13:37:41 +00:00
John Ralls
4ae17d12c7 [options] Move options from app-utils to engine.
Options is required for book options that are stored as part of the data
 file and so belongs in engine.
2022-08-25 22:09:56 -07:00
Christopher Lam
dc620d4b24 Merge branch 'maint' 2022-04-22 13:43:47 +08: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
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
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
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
John Ralls
67191203ae Merge branch 'maint' 2021-09-26 10:46:06 -07: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
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
1b4d30b3b1 Merge branch 'maint' 2021-06-22 23:30:20 +08:00
Hong Xu
0fd0aca531 Explain out what AsOfDate means in the doc
As discussed at
https://lists.gnucash.org/pipermail/gnucash-user/2021-June/096893.html
2021-06-16 12:07:23 -07:00
Christopher Lam
b25a444140 Merge branch 'maint' 2021-05-14 21:16:48 +08:00
John Ralls
4f030aac6e Bug 798093 - Changing the symbol/abbreviation of a security...
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.
2021-05-12 09:00:51 -07:00
Christopher Lam
5ce8f78f77 Merge branch 'maint' 2021-04-24 23:16:22 +08:00
Robert Fewell
e535ba5411 Change some functions to use const gnc_commodity for gnc_pricedb 2021-04-23 11:56:15 +01:00
Christopher Lam
87473ed5f9 Merge branch 'maint' 2021-03-12 23:14:51 +08: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
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
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
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
Christopher Lam
1b31c06b29 [Account.cpp] add gnc_account_and_descendants_empty (acc)
and deprecate xaccAccountCountSplits
2020-10-01 11:34:21 +08: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
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
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
jean
2d0d7c40f8 Make the reconcile window close when the session closes, use full version of free 2020-04-22 21:15:36 -07:00
John Ralls
f85be03bb5 Merge branch 'maint' 2020-03-29 14:46:55 -07: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
a8f03cf1c8 [account] add and expose xaccAccountGetReconciledBalanceAsOfDate 2020-03-15 06:40:03 +08: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
Christopher Lam
198570d8c8 Bug 797390 - xaccAccountRecomputeBalance also tallies no-closing balances
Add a few API, enough for fixing bug 797326 easily.
2019-10-23 20:09:40 +08:00
Robert Fewell
6c43c3afe0 Fix Imap Editor to reflect the changes in kvp paths
There were several problems that broke the Imap Editor that have been
fixed due to kvp changes. The import-map-bayes entries were being added
to the tree view based on the number token entries squared. Retrieving
import-map entries resulted in an empty list and also deleting entries
from the tree view failed.
2018-03-29 17:32:57 +01:00
lmat
fbf4843f31 Changed bayes import map design
This commit introduces a new feature flag:
GNC_FEATURE_GUID_FLAT_BAYESIAN. It signifies that the bayes import map
data are stored flat and by guid. Any time bayes import map data are
accessed, they are converted if necessary.
2017-12-21 07:39:33 -05:00
lmat
eb6dad86e3 Fixed conversion problem
The conversion assumed there were only three levels to bayes import
map kvp: IMAP token, user-supplied token, GUID/account name. In
actuality, since user-supplied tokens could have the delimiter in them,
there could be several. This fix takes that into account like so:
IMAP token, potentially several user-supplied tokens, GUID/account name.

The import map is undergoing two conversions at the same time: account names
to guids and an hierarchical representation to a flat representation in KVP.
2017-12-21 07:39:32 -05:00
lmat
b3667c76fc Implement flat bayes kvp
The bayes data are stored in the KVP store. Before this commit, they are
stored under /import-map-bayes/<token>/<account guid>/count (where count
is the datum that "matters" in bayes matching).

The problem with this is that any token including the kvp delimiter
(currently '/') gets divided, and is not found correctly during bayes
kvp searching. The quickest solution to this is to replace all "/"
characters with some other character. That has been done, along with a
re-structuring of the bayes matching code to take advantage of c++
features to make the code more concise and readable.

Also modified some test functions to fix leaks and double-frees: the
same kvp value can't be in the kvp tree twice.

Also, when I added code to clean up after the tests, some things started
breaking due to double-delete. Apparently const_cast was hiding some
programming errors. Really? You don't say? When giving a GUID* to KvpValue,
the latter takes ownership of the former.
2017-12-21 07:39:32 -05:00
lmat
eb6c741bf9 Account.c to Account.cpp
Since Account.c is now Account.cpp, the function signatures look a bit
different internally. The tests rely on function signatures in error
messages. Instead of trying to figure out what the exact
function signature might be, I use a substring matching strategy to
ensure that the correct error was issued.
2017-12-21 07:39:32 -05:00