Commit Graph

728 Commits

Author SHA1 Message Date
John Ralls
d744b79bef Remove disabled code copied from utest-Account.c into utest-Budget.c. 2020-03-14 11:08:27 -07:00
John Ralls
8b61644978 Add more tests for neutral time. 2020-03-14 10:15:32 -07:00
Frank H. Ellenberger
82987e13f3 gnc-fq-dump: fix warning on argv
Scalar value @ARGV[0] better written as $ARGV[0] at gnc-fq-dump line
160.
2020-03-13 21:22:19 +01:00
Frank H. Ellenberger
56fa959ec0 Apply @PERL@ -w substitution on gnc-fq-dump, too 2020-03-13 20:53:15 +01:00
Mike Alexander
9e35aea588 Fix a typo in commit 4318f7a: gnc.scm, not gcc:scm 2020-03-08 18:11:51 -04:00
Mike Alexander
4318f7a3c7 Revert "completion redefine gnc:debug" and fix some bugs in it
This change made it impossible to turn debug output on or off on the
fly by calling qof-log-set-level from Scheme code.  The optimization
achieved isn't all that great either since the arguements to
gnc:debug are still evaluated when debugging is off and this is
where a lot of the overhead is. Even without this change the call to
strify is avoided.

Also fixed the parameters of qof-log-check:
    "gmc" => "gnc.scm"
    G-LOG-LEVEL-DEBUG => QOF-LOG-DEBUG

This reverts commit b3a4cd6277.
2020-03-07 23:44:16 -05:00
John Ralls
95857a8b99 Merge Christian Gruber's 'fix_bug_797587' into maint. 2020-02-28 21:29:58 -07:00
Geert Janssens
feee495f2e Bug 797624 - Wrong Decimal for Vietnam currencies 2020-02-25 16:40:50 +01:00
Christian Gruber
7509b542da Simplify function build_bayes()
Inline function parse_bayes_imap_info() into build_bayes() and remove
temp_guid.
2020-02-17 23:41:05 +01:00
Christian Gruber
01c76e2391 Remove unused template of function for_each_slot_prefix()
for_each_slot_prefix() is not used anywhere with two arguments
2020-02-17 23:41:05 +01:00
Christian Gruber
41863be9c7 Avoid copying local instance of AccountTokenCount 2020-02-17 23:41:05 +01:00
Christian Gruber
322f2d99de Rework key prefix matching
Use C string comparison instead of C++ function std::mismatch to increase
performance.
2020-02-10 22:31:29 +01:00
Geert Janssens
e79e82edcf CMake - remove parameter repetition in else() and endif() statements
This follows Professional CMake's recommended practises
2020-02-05 11:38:14 +01:00
Alex Aycinena
f1667e7ba8 Update US Income Tax information for more 2019 changes 2020-02-02 13:58:00 -08:00
Christian Gruber
a13184978a Fix calculation of token info to find exactly matching tokens only
In get_first_pass_probabilities() function
qof_instance_foreach_slot_prefix() is called with a prefix path
including closing slash after token now. This avoids, that also entries
with token as a substring are included in token info, where key only
starts with token.

Finally function build_token_info() checks, if the key suffix after the
token consists only of the GUID. This avoids, that also entries with the
same prefix and slashes are included in token info.
2020-02-02 18:00:27 +01:00
Christian Gruber
da60560ac4 Change behaviour of KvpFrame::for_each_slot_prefix()
Provided function func is now called with key suffix only instead of
full key (prefix is omitted). This is neccessary for fixing function
build_token_info() in the next commit.
2020-02-02 18:00:27 +01:00
Christian Gruber
9b3085a429 Add test cases to check for exact token matching 2020-02-02 18:00:27 +01:00
Geert Janssens
0131780b30 Add guile function to extract a lot's guid
Useful for debugging lot issues in reports.
2020-01-29 18:55:35 +08:00
Geert Janssens
4537c1de36 Bug 794916 - Fails to find environment file at startup when installation prefix is '/opt'
Update on this bug. Before doing the binreloc dance on various
paths check if the calculated dynamic prefix is still the same
as the compile time PREFIX. If so, just stick with the compile
time path names as this means the application wasn't relocated
anyway. Only if the dynamic prefix is different, try to
recalculate the requested paths relative to the dynamic
prefix.
Together with the configure time fix to detect /etc/opt is
outside of the /opt prefix, this eliminates the need for further
special case handling of the sysconfig directory so that
special case handling is removed.
2020-01-22 22:40:11 +01:00
gnucash-dev
24b46b1c36 Update US Income Tax information for 2019. 2020-01-20 17:28:49 -08:00
Geert Janssens
073e47801d Drop useless ifdefs
The parameter it checks is always defined these days
2020-01-17 18:25:43 +01:00
Geert Janssens
d8a304c2c9 Housekeeping - reduce the number of PACKAGE and VERSION related cmake variables
This starts by setting the gnucash version number in the 'project' call.
This will result in a number of variables set by cmake. The remainder
of this commit is to reuse the auto-generated
PROJECT_NAME, PROJECT_VERSION, PROJECT_VERSION_MAJOR
PROJECT_VERSION_MINOR, PROJECT_VERSION_PATCH and PROJECT_VERSION_TWEAK
instead of all the various instances of PACKAGE, GNUCASH_MAJOR_VERSION
and so on.

One parameter is worth mentioning - GETTEXT_PACKAGE
GnuCash is not using this directly (any more) but it has to be set before
including gi18n-lib.h.
2020-01-17 18:15:27 +01:00
Christopher Lam
c4ab772d4b Bug 797576 - xaccAccountOrder shouldn't sort account codes as base-36
Thanks to yegor for discovering it is unreliable for sorting. It has
been present since 50646f04
2020-01-15 18:25:16 +08:00
Christopher Lam
3db699786f [core-utils.i] declare prefs as ENUMs 2020-01-15 18:04:35 +08:00
Geert Janssens
08d685f4aa Define SET_ENUM in core-utils.i as well
Will be used to expose our settings related constants to guile
2020-01-15 09:29:27 +01:00
John Ralls
df92200c8e Restrict gnucash.pot comment collection to ones beginning with Translators.
On recommendation of the Translation Project's Benno Schulenberg.

Required re-annotating some comments. Also removed several comments
about leaving a line break to prevent inserting it into gnucash.pot.
That didn't actually work: they were inserted anyway.
2020-01-04 15:57:02 -08:00
Daniel Dittmann
31c0fed1dc test_gnc_setlocale: use trailing whitespaces 2020-01-02 14:02:04 +01:00
Daniel Dittmann
5c478713d6 test_gnc_setlocale: add missing whitespaces to diagnostic message 2019-12-30 00:38:09 +01:00
John Ralls
d51b4d7f08 Bug 797532 - Crash/Coredump Lots
Replace the asserts in cap-gains.c with g_return_val_if_fail. There's
nothing about cap-gains.c that justifies crashing the program.
2019-12-28 13:36:11 -08:00
Geert Janssens
cd8698321d Bug 797482 - Can't edit date when using Edit Payment function 2019-12-27 18:38:55 +01:00
Christopher Lam
8fb73c7ed1 [gnc-lot.h] amend description for gnc_lot_get_earliest_split
this function doesn't necessarily point to the lot opening split.
2019-12-24 16:43:55 +07:00
Christopher Lam
5ebbb74435 [new-owner-report] invoice->payments displays lot links
Change of algorithm to display invoice->payments.

Previously: invoice->lot->splitlist; filtered to payments; retrieve
splits->parent->xaccPaymentAcctSplitList This would find payment
splits in originating currency.

But this fails for lot-link txns whose PaymentAcctSplitList is null.

New algorithm:

- invoice->lot->split-list, each lot-split analysed

- TXN-TYPE-PAYMENT lot-splits will query TransferAcct and each will be
rendered in the originating currency, if they haven't been encountered
before in this invoice.

- TXN-TYPE-LINK lot-splits are rendered as a generic 'Offset
Documents' link to lot-link splits. This helps link invoice to the
link transaction to locate the corresponding credit-note. It is not
possible to link to the corresponding credit-note because a
link-transaction can group many invoices to many credit-notes.

Also:

Increase right-hand-side links from 3 to 4 columns. I think it's quite
useful to add 'Credit Note' 'Invoice' 'Payment' as a separate
column.
2019-12-24 10:55:26 +07:00
Robert Fewell
803d4c511e Bug 797489 - No option to use account codes in Budget View - Part1
In the budget view there is no option to add the account code column
which some uses use for sorting their accounts. This commit introduces
a feature flag to be used in version 4.0 but if set in 3.8 will hide
the new account code column so the view is not disrupted.
2019-12-11 15:16:48 +00:00
Christopher Lam
2cd69e8d85 [budgets.c] handle both natural & reversed signs budgets
introduce new API
* gnc_using_unreversed_budgets - queries book's unreversed feature
* gnc_reverse_budget_balance - check if book unreversal status matches
  2nd argument. if so, return account's reversal status. else, return
  FALSE.

* gnome-budget-view can now show both natural and reversed budgets
* gnome-plugin-page-budget will now read&write both natural and
  reversed budgets.
2019-12-05 17:26:46 +08:00
Christopher Lam
ded336f987 [gnc-features] enable reading of unreversed budgets 2019-12-05 17:26:46 +08:00
Christopher Lam
c06191a656 Transaction.c: avoid slow g_list_nth_data 2019-12-05 13:06:11 +08:00
Frank H. Ellenberger
91183a2af5 drop emacs_trailer from xml files.
Modern versions of emacs know, how to behave on xml files.
2019-11-25 00:42:40 +01:00
Christopher Lam
fbc7c9027e [scm/utilities] even more efficient list-flatten functions
because:

* list? is O(N), because it needs to test for an improper
list. improper lists are lists whose last pair's cdr cell is not
'(). null? and pair? are both O(1).

* avoids reverse which is also O(N): guile has unlimited stack
therefore we can do non-tail-call loop first to pass as parameter to
the tail-call loop. this removes the need for prepend-and-reverse.
2019-11-19 19:28:27 +08:00
Christopher Lam
de09259f13 Bug 797500 - valgrind errors - new/delete vs malloc/free
Mismatched new/g_free()
Change to new/guid_free() which calls delete
2019-11-17 09:55:51 +08:00
John Ralls
9189bcbe41 Bug 797078 - "Automatic decimal point" Should Not Cause 2 Different Behaviors
It's documented only for automatically inserting the decimal point
so remove the code that affects number display.
2019-11-10 12:33:20 -08:00
Christopher Lam
d56a47f17a [c-interface] gnc:backtrace-if-exception returns #f if error
previous would return *unspecified* when error was captured.
old code seems to expect #f to signal error
2019-11-03 10:44:50 +08:00
Christopher Lam
2df672bdb2 [gncOwner] i18n gncOwnerGetTypeString types 2019-11-02 09:05:22 +08:00
Christopher Lam
644cb4100e [gncOwner] add gncOwnerGetTypeString returns owner-type
* will have several uses
2019-10-28 20:18:47 +08:00
Christopher Lam
b2fcfbd3c6 Bug 797326 - Enhancement: budget's Estimate tool should ignore Closing Entries
Addendum to 8b8c957ed -- if budgeted amounts exclude closing entries,
actual amounts should also exclude closing entries.

Amend documentation, modify budget test to add a closing entry which
will be ignored.
2019-10-25 18:27:47 +08:00
John Ralls
1dc22e53c5 Fix test_xaccTransEqual.
Needed to make the noclosing_balances equal to get the balance-equality test to pass.
2019-10-23 20:09:40 +08: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
John Ralls
9661a77f3c Bug 797459 - Installation (for 3.7) Readme Version number shows 2.2.x
Remove the version line and update the number of developers: The
AUTHORS file shows more than 200, not counting patches.
2019-10-15 10:55:18 -07:00
John Ralls
badda88224 Clear, not empty.
Found by gcc when setting C++17 on master.
2019-10-05 11:44:09 -07:00
Christopher Lam
c6195d6e7a [test-budget] centralize gnc:create-budget-and-transactions
it will be reused by test-stress-options
2019-10-03 08:23:29 +08:00
Christopher Lam
22cdd237f1 [test-portfolios] initial commit
1.1.1980 seed $10,000
1.2.1980 buy 1 AAPL @ $100
1.3.1980 buy 1 AAPL @ $200
1.5.1980 sell 1 AAPL @ $400, FIFO capgain = $300, less $10 fee
1.10.1980 1:10 stock split 1 to 10 AAPL, price now $40
1.11.1980 1:10 stock split 10 to 100 AAPL, price now $4
1.12.1980 3:1 stock split 100 to 33 AAPL, price now $12;
          cash-in-lieu for 1/3 AAPL = $4

tests both portfolio.scm and advanced-portfolio.csm
tests report output using average/fifo/lifo

pending: DRP etc
2019-09-24 23:07:47 +08:00