Commit Graph

753 Commits

Author SHA1 Message Date
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
Christopher Lam
9832fa397a [window-report] show backtrace when report crashes
* exposes a SCM string last-captured-error containing last backtrace
* when rendering report-crash window, include it
2019-09-23 17:55:25 +08:00
Christopher Lam
a259ba4a3e [utilities] move gnc:html-string-sanitize to utilities.scm 2019-09-22 22:48:07 +08:00
Christopher Lam
24393b6f5c [utilities] fix comment use official gnu mail archive 2019-09-21 19:33:21 +08:00
Christopher Lam
0511ce723e [API] gnc:list-flatten flattens lists recursively
and is a schemey algorithm rather than a report algorithm, so, belongs
centrally.
2019-09-21 11:18:26 +08:00
Christopher Lam
3208879e64 [app-utils] upgrade Tax/Tax Number option to all locales
Previously de_DE locale will add a *global* 'Tax/Tax Number'
option. This is immediately translated.

This change will upgrade it to be present in all locales, and can be
queried by any report.
2019-09-20 14:57:57 +08:00
John Ralls
c23f3f05e3 Fix deprecated G_TYPE_INSTANCE_GET_PRIVATE and G_INLINE_FUNC
with the function/declaration that they substituted.
Note that this doesn't use the recommended new GObject creation macros
because the class names in libgnucash/engine don't follow the gnome
naming convention.
2019-09-12 15:25:42 -07:00
Christopher Lam
70cb3a0b97 [utilities] compact sort-and-delete-duplicates
This is still readable IMHO. kons is the result constructor, and adds
item to result iff different from previous add.
2019-09-11 20:30:13 +08:00
Frank H. Ellenberger
fa4fc551af Remove obsolete "disambiguation prefix" translator comments
https://lists.gnucash.org/pipermail/gnucash-devel/2019-September/044199.html

Continuation of commit d30fe7a
2019-09-10 00:13:01 +02:00
John Ralls
e6e2258a74 Bug 797356 - ninja check fails with GCC-9 2019-09-09 14:44:10 -07:00
Frank H. Ellenberger
bbcf19ae6a [I18N] use msgctxt for Reconciled flags
Final step for [Bug 797349] "A"ssociate header badly translated
2019-09-06 05:59:55 +02:00
Robert Fewell
2bcb9bb1a5 Test for Invoices XML dates not being INT64_MAX
To prevent errors being logged to the trace file when invoices are
saved test for the date values not being INT64_MAX which is an unset
date.
2019-08-29 11:28:18 +01:00
Robert Fewell
d677e3c5df Do not log an error when no default tax tables set 2019-08-29 11:27:10 +01:00
John Ralls
f00777ca07 Add scm-srfi64-extras and scm-qif-import as check dependencies
Fixes make check when make all hasn't been run.
2019-08-27 11:50:25 -07:00
Craig
04aab7cea3 Correctly parse decimals between 0 and -1.
The negative sign was being lost because stoll("-0") is 0.
Also permits parsing decimals between -1 and 1 without the leading 0.
2019-08-25 15:50:29 -07:00
Geert Janssens
7dc59950a5 Bug 797353 - Add copyright and release info in appdata file
This also means the appdata file now requires preprocessing to set this info
automatically.
2019-08-24 17:32:16 +02:00
Geert Janssens
c4a21bc9d4 Extract a few cmake commands to dedicated files rather than generating them on the fly
This simplifies a number of escape sequences.

The generated file to configure the man page was split up a bit further:
- code that extracted the GNC_VCS_REV_Y_M from gnc-vcs-info.h was spun out
  into its own function that now sets all parameters in gnc-vcs-info.h
  as environment variables.
- this function is now invoked by configure-manpage.cmake to extract
  the date to insert into the manpage.
- the manpage in addition now shows the full date rather than only
  yyyy-mm. This is how man itself does it as well.
2019-08-24 17:05:03 +02:00
Geert Janssens
0e9e3c107d Drop code path for cmake 3.1 and older
We require cmake 3.5
2019-08-24 17:01:50 +02:00
Christopher Lam
3d608efc22 [test-options] add to CMakeLists.txt
forgto to add to dist_list.
2019-08-23 19:51:13 +08:00
Christopher Lam
67751665b3 [taxtxf(-de_DE)] compact functions, use srfi-2
srfi-2 and-let* allows concise code and returns #f if any intermediate
var is #f.
2019-08-23 19:34:14 +08:00
John Ralls
fcc1653822 Replace overly indirect gnc_business_get_default_tax_table.
With gncTaxTableGetDefault.

qof_book_get_default_tax_table would have been even better but it
would have created a circular dependency between QofBook and
GncTaxTable.
2019-08-22 12:30:33 -07:00
Christopher Lam
bd9edbbbf6 Bug 797279 - Reports RTL do not support RTL - fix string
fix guile-2.0 string handling to prevent munging unicode in
report-titles etc. while loading/saving reports
2019-08-19 08:06:27 +08:00
John Ralls
8eb3819a3c Merge Christian Gruber's 'rework_gtest_src' into maint. 2019-08-15 15:18:07 -07:00
John Ralls
24d4576617 Include libicu-i18n in libgncmod-engine linkage for new ICU API usage. 2019-08-15 15:17:16 -07:00
Christian Gruber
1b4e481296 Add gtest_main.cc to libgtest.a
Currently when compiling GoogleTest from source code, source file
gtest_main.cc from GoogleTest repository is not compiled into any
library as in GoogleTest repository, where it is compiled into
libgtest_main.a. Instead gtest_main.cc is added to source file list
GTEST_SRC, which is then added to the list of source files of every
single GoogleTest based test application.

To simplify this gtest_main.cc is added to the source file list of
target gtest now. Additionally GTEST_SRC is merged into
lib_gtest_SOURCES, since both variables defined source files for
GoogleTest libraries.

Now target gtest generates library libgtest.a, which already contains
the main function from source file gtest_main.cc. This is different to
GoogleTest build system, where both are separated into two independent
libraries libgtest.a and libgtest_main.a.
2019-08-15 23:20:45 +02:00
Christopher Lam
f64dd0860f Bug 752395 - Start Day of weekly report doesn't respond to change in locale
Redefines some functions to ensure weekly grouping in transaction
report obeys locale's start-of-week.
2019-08-15 13:18:46 +08:00
Geert Janssens
ec6602adf9 [gnc-date][API] find locale's start of week using ICU.
gnc_start_of_week

* ICU has a mature C++ api, so prefer that one in our C++ code
* Use PERR instead of fprintf for consistent reporting
* Add the ICU specific linker flags to the test case
2019-08-15 13:18:43 +08:00
Christopher Lam
bdbb06b722 [price-quotes] remove no F::Q message 2019-08-15 13:18:16 +08:00
Christopher Lam
2a6a4e34d6 [price-quotes] compact commodity-tz-quote-triple->price 2019-08-13 18:50:59 +08:00
Christopher Lam
e15f2610ba [price-quotes] compact gnc:book-add-quotes 2019-08-13 18:50:57 +08:00
Christopher Lam
4a4f81b320 [price-quotes] compact book->commodity->fq-call-data
make function more readable.
2019-08-13 18:50:55 +08:00
Christopher Lam
5e8663772a [price-quotes] compact gnc:fq-get-quotes 2019-08-13 18:50:53 +08:00
Christopher Lam
d5122c97ea [price-quotes] compact gnc:fq-check-sources
improve locality of vars.
2019-08-13 18:50:51 +08:00
Christopher Lam
fab1c8db3e [price-quotes] show if F::Q not installed, remove dead code 2019-08-13 18:50:48 +08:00
Christopher Lam
fbb6a95600 [simple-obj] deprecate this module
* it's only a wrapper for make-record-type
* use record-types directly in modules
2019-07-30 18:17:52 +08:00
Christopher Lam
e8a41bbf54 [options] compact lookup-option 2019-07-28 12:16:58 +08:00
Christopher Lam
bd0cbbf931 [test-options] initial commit
* test lookup option changed section/name
2019-07-28 12:16:58 +08:00
Christopher Lam
66511f17bb [c-interface] compact functions
fix whitespace. this module has good coverage in test-c-interface.scm.
2019-07-28 12:16:58 +08:00
John Ralls
887f7fac32 Bug 746937 - Template transaction splits are loaded in reverse order...
and then not sorted before saving.

Actually not sorted after loading because the template accounts weren't
being committed.
2019-07-27 15:15:55 -07:00
John Ralls
456ab2241f Remove unused ifdefs for IMPLEMENT_BOOK_DOM_TREES_LATER.
Apparently stub code for a different way of generating the DOM tree, never implemented.
2019-07-26 16:17:09 -07:00
Frank H. Ellenberger
a0a0ffbb77 Bug 797319 - Mauritanian ouguiya MRO shows too few decimals
Add info about cash vs. banking
2019-07-25 23:51:50 +02:00
Frank H. Ellenberger
c77607c8c0 Bug 797316 - New Mauritanian ouguiya MRU not supported
Add info, which Mauritanian ouguiya is recent
2019-07-25 23:33:42 +02:00
Christopher Lam
681e023cd5 [date-utilities][API] deprecate unused exports, add comments
* deprecated:
  gnc:make-reldate-hash
  gnc:reldate-string-db
  gnc:relative-date-values
  gnc:get-relative-date-strings

* remove gnc:reldate-list, unused

* comment sections
2019-07-25 20:22:12 +08:00
Christopher Lam
7e9ec00906 [date-utilities] tidy up gnc:make-date-interval-list 2019-07-24 23:44:56 +08:00
Christopher Lam
a4811b3b46 [test-extras] add (create-test-invoice-data) for tests
this function creates some business data. moved from test-invoice.scm
without the invoice-specific tests. verified all invoices/bills are
created correctly.

it returns a vector-list of the 8 invoices generated.
2019-07-24 20:01:02 +08:00
John Ralls
ca87572a2c Bug 797319 - Mauritanian ouguiya MRO shows too few decimals
Changed MRO smallest-fraction to 100 based on information provided
by the reporter. ISO4217 has moved the MRO to the "Historical Currencies"
list that doesn't include CcyMnrUnits.
2019-07-23 09:42:43 -07:00
John Ralls
b02f7ac409 Bug 797316 - New Mauritanian ouguiya MRU not supported
Add new MRU with info from
https://www.currency-iso.org/dam/downloads/lists/list_one.xml
2019-07-23 09:42:28 -07:00
Christopher Lam
273ae720cc [scm-utilities][API] add sort-and-delete-duplicates
this can be used instead of delete-duplicates when the list must also
be sorted.

the main reason for this function will be for the upcoming aging.scm
report which will use it heavily to slice APAR splits into owner list.
2019-07-20 21:10:08 +08:00
Christopher Lam
fdeff65f06 [business-core] refactor & document gnc:owner-from-split
This function helps to establish UI link from register split to an
owner's split. It should not be used anywhere else. Its use in reports
will be removed.

It is also unnecessarily complex -- it is called from an AP/AR account
register split, it should have all necessary information via split
metadata. e.g. this function *can* return a split owner if originating
from an Asset/Liability account which settles an invoice, but this
functionality is not used because there is no asset/liability register
hook to call it.
2019-07-20 21:10:08 +08:00
Christopher Lam
d0bf4ad8ae [test-business-core] add to dist_list 2019-07-20 21:10:08 +08:00
John Ralls
e88f31e05c Bug 784623 - GNUCash does not work with sql backend, I can open...
in read only mode

Upgrade the splits table as well, an oversight from the original fix.
2019-07-19 21:20:43 -07:00
Christopher Lam
0c433e02f7 [business-core] deprecate gnc:entry-type-percent-p
This function is only used once. deprecate it.
2019-07-19 22:22:28 +08:00
Christopher Lam
e654bd34af [business-core] simplify functions 2019-07-19 22:22:28 +08:00
Christopher Lam
57f291af86 [test-business-core] initial commit 2019-07-19 02:50:24 +08:00
Christopher Lam
6c4ae89012 [business-options] fix whitespace 2019-07-12 21:08:15 +08:00
Christopher Lam
560b313f85 [business-options] deprecate unused option-types 2019-07-12 20:50:18 +08:00
Christopher Lam
b3a4cd6277 completion redefine gnc:debug 2019-07-07 09:04:04 +08:00
Christopher Lam
429077ee8e completion wrap qoflog 2019-07-07 08:41:13 +08:00
Christopher Lam
42b6fb993b call strify only if debugging enabled 2019-07-06 11:15:18 +08:00
Christopher Lam
898a9cdb8e wrap qoflog 2019-07-06 11:15:18 +08:00
John Ralls
a3871d9ca1 Warn if can't lock for any reason other than that the file is locked already.
And include the error string in the message.
2019-06-28 11:48:01 -07:00
Christopher Lam
039b84871e [utilities] warn against using guile's strftime
strftime has been banished from code; warning for custom-reports

https://www.mail-archive.com/bug-guile@gnu.org/msg09778.html
2019-06-19 22:10:23 +08:00
Geert Janssens
15a35e6a3b Housekeeping - replace plenty of http links with https
There are more, but these are most common ones.
There are also a number of urls that don't behave well when https, so those are skipped
At some point I have also started marking non-working URLs as [DEAD LINK], though
that's not a full coverage.
2019-06-06 15:52:30 +02:00
Christopher Lam
885689b42d [options] bugfix don't override inbuilt list keyword
fixing a 17 year old bug.

previous version had defined (save-acc list count) and (save-item list
count) thereby overwriting the inbuilt 'list' keyword, and tried to use
the it later on with (list key)... best rewrite with neater code.
2019-05-31 23:31:54 +08:00
Geert Janssens
4ffc4d046f GncEntry - Fix inverted comparison 2019-05-28 17:19:29 +02:00
John Ralls
957df9a32b Add a +0000 offset to ISO8601 timestamps in the XML backend.
Apparently GnuCash for Android hard-coded the offset spec into their
parser, so it can't import XML files without it.
2019-05-27 14:51:06 -07:00
Christopher Lam
ed42f8acb6 Bug 797197 - Transaction report: Error message when sorting on month
guile's strftime is/was buggy; cannot handle non-UTF8 locales. Use
gnc_print_time64 instead. see the following

http://lists.gnu.org/archive/html/bug-guile/2019-05/msg00003.html
2019-05-27 21:20:29 +08:00
Geert Janssens
b7479e8fb0 Bump minimum cmake version to 3.5
This version is available for all supported platforms and distros
(CentOS can have a version via EPEL, which is required anyway)

Advantages:
- one cmake version for all platforms
- we can drop all conditions based on cmake version
2019-05-25 12:04:51 +02:00
John Ralls
2d4f771bed Merge Adrién Panella's 'budget' into maint. 2019-05-23 09:50:20 -07:00
Adrian Panella
5bb54d073c [budget] Fix error in qof_book property path
The "Default budget" property had an erroneus path
and was not returning any value.
2019-05-17 23:12:19 -05:00
Robert Fewell
416b79d304 Reformat source files gnc-accounting-period.*
Change tabs to white space and some other white space changes.
2019-05-17 11:01:24 +01:00
Robert Fewell
037f5ed5be Bug 797089 - Wrong time for accounting period end date
In the Preferences/Accounting Period, there is an option to specify
absolute dates but the end date was being set to start of day instead
of end of day, changed this.
2019-05-17 11:01:24 +01:00
John Ralls
fc567208f3 Bug 797233 - Balance Sheet, Chart of Accounts, and other reports...
crash when involving foreign currency stocks.

Scheme's inexact->exact function just converts the floating-point
representation of a number into an exact rational (documented in the
API Reference, Simple Generic Data Types, Numerical data types, Exact
and Inexact Numbers), which isn't what we want.

We want the number converted to exact directly from the string and to do
that we have gnc-fq-helper preface it with #e.
2019-05-14 13:34:07 -07:00
John Ralls
217418bb8c Merge Adrián Panella's 'numeric' into maint. 2019-05-14 10:09:16 -07:00
Adrian Panella
f905467a44 [numeric] Fix constructor from strings in range (0 ,1)
Fix error that caused strings in the form 0.nnn to be
converted to negative numerics.
2019-05-13 23:05:11 -05:00
John Ralls
e6c50357bb Fix test error string to match actual error. 2019-05-13 15:19:19 -07:00