Commit Graph

753 Commits

Author SHA1 Message Date
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
John Ralls
8738644af0 Merge David Palma's fix-division into maint. 2019-05-13 15:15:36 -07:00
Geert Janssens
d4c524a9ef Fix test dependency issue 2019-05-13 20:14:58 +02:00
David Palma
aab89065da
Bug 796949 - Fix division and rounding of zero.
Fix division of 128-bit integers so that the remainder inherits the dividend's sign.
Fix rounding for truncated zero.
2019-05-11 23:23:59 +01:00
Christopher Lam
6e246ef8ad [options] compact option-setter in generator
slightly more compact, avoids confusing structure whereby 'option' is
both the lambda's argument and the definition of argument.
2019-05-04 06:19:59 +08:00
John Ralls
bfbb89f6e2 Rewire and corrected Doxygen comment for gnc_get_locale() c++ function.
There's no point in going through the cache dance on MinGW, that will
just throw.
2019-04-30 15:00:06 -07:00
John Ralls
529a6cb067 Call setlocale(LC_ALL, "") exactly once.
And in Windows only with the value from the environment if there is one.
Calling it with "" in Windows ignores the environment and sets it to the
system settings.
2019-04-30 14:56:43 -07:00
John Ralls
114efe5936 Transcode non-constant strings before passing them to scm_eval_string.
Instead of using scm_c_eval_string, which transcodes with
scm_from_locale_string. That doesn't work on Windows.
2019-04-29 15:00:54 -07:00
John Ralls
94bb28d9ab Bug 797127 - Company name and address in reports not display properly
Ensure that all includes of swig-runtime.h are *followed* by
including guile-mappings.h so that the defines masking
scm_to_utf8_string and scm_from_utf8_string are undone.
2019-04-27 13:39:27 -07:00
Christopher Lam
4d529c02cd [libgnucash-scm-utilities] remove unneeded section in CMakeLists 2019-04-27 17:04:02 +08:00
Robert Fewell
d1ee651bbc Modify the qof log format based on max logger name from log.conf
When you have multiple loggers enabled, the log file indentations are
partly based on logger name length and so you can have false
indentations which can cause confusion. This change gets the maximum
name logger length and uses this for all with a minimum default length
of 12 characters.
2019-04-26 12:09:05 +01:00
Robert Fewell
4368e18ac5 Bug 797165 - Crash on price deletion.
Caused by the introduction of caching used in gnc_pricedb_nth_price,
when prices were deleted, the cached list was never updated and so the
tree model could reference a deleted price and hence crash. This also
affected adding prices as the new prices would not show due to the
cache not being updated. To fix this a function was added to reset the
cache when prices are updated from the model.
2019-04-26 12:09:05 +01:00
Robert Fewell
9f0558ffb5 Add some missing log Macros for the price model
Add some missing LEAVE macro statements so the log entries do not get
longer and longer.
2019-04-26 12:09:05 +01:00
thetedmunds
483f9a4c83 Bug 797196 - Allow for per-payment rounding in amortization calculations
Provides functions gnc:amort_pmt, gnc:amort_ppmt, and gnc:amort_ipmt in
fin.scm.
2019-04-25 13:28:40 -07:00
John Ralls
5311e5a386 Revert "Merge T Edmunds's 'amortization-rounding' into maint."
This reverts commit aa53c23239, reversing
changes made to 3c946a8449, because
aa53c23 was based on master and so undid other changes made to maint
since the last merge-to-master.
2019-04-25 13:19:28 -07:00
Christopher Lam
0cf49f1244 [test-libgnucash-scm-utilities] amend info to explain comment fix 2019-04-25 11:20:34 +08:00
Christopher Lam
7d15e6e4e7 [utilities] create general string-replace-substring
copied function created by Mark Weaver, core guile dev and augmented
to selectively replace substring indices

This is a much more efficient function than the previous
gnc:substring-replace which will constantly split lists using
substring, and create new strings using string-append.

It also does tail call optimization properly, unlike the previous
functions.

https://lists.gnu.org/archive/html/guile-devel/2013-09/msg00029.html -
original

"Here's an implementation that does this benchmark about 80 times
faster on my machine: (20 milliseconds vs 1.69 seconds)

--8<---------------cut here---------------start------------->8---
(define* (string-replace-substring s substr replacement
                                   #:optional
                                   (start 0)
                                   (end (string-length s)))
  (let ((substr-length (string-length substr)))
    (if (zero? substr-length)
        (error "string-replace-substring: empty substr")
        (let loop ((start start)
                   (pieces (list (substring s 0 start))))
          (let ((idx (string-contains s substr start end)))
            (if idx
                (loop (+ idx substr-length)
                      (cons* replacement
                             (substring s start idx)
                             pieces))
                (string-concatenate-reverse (cons (substring s start)
                                                  pieces))))))))
--8<---------------cut here---------------end--------------->8---

The reason this is so much faster is because it avoids needless
generation of intermediate strings."
2019-04-25 10:52:45 +08:00
John Ralls
a12bbaccd3 Create CMakeLists.txt in libgnucash/scm/test.
Amended by chris to add a working scm/test/CMakeLists.txt.
2019-04-25 10:51:20 +08:00
Christopher Lam
92a920c4e0 [test-libgnucash-scm-utilities] renamed from test-utilities.scm 2019-04-25 10:51:20 +08:00
Christopher Lam
d9623b0ad1 [test-utilities] initial commit
Add tests for libgnucash/scm/utilities.scm functions

- tests for list<->vec
- tests for gnc:substring-replace
- tests for gnc:substring-replace-from-to

  The latter confirms that the comment before the function definition
  is *incorrect* - it describes that substring-replace-from-to will
  start from the 2nd substring for the first substitution, and
  performs 2 substitutions. However the comment illustrates only 1
  substitution. The test suite performs the test according to code
  behaviour, rather than the comment. This issue is moot in practice
  because the end-after is always called with negative in the code
  base.

  original comment:

;;  gnc:substring-replace-from-to
;;  same as gnc:substring-replace extended by:
;;  start: from which occurrence onwards the replacement shall start
;;  end-after: max. number times the replacement should executed
;;
;;  Example: (gnc:substring-replace-from-to "foobarfoobarfoobar" "bar" "xyz" 2 2)
;;           returns "foobarfooxyzfoobar".
2019-04-23 18:52:36 +08:00
John Ralls
fc0a729253 Merge Christoph Holtermann's 'PR-python-bindings-update-source-doc' into maint 2019-04-20 12:55:41 -07:00
John Ralls
aa53c23239 Merge T Edmunds's 'amortization-rounding' into maint. 2019-04-20 12:36:51 -07:00
John Ralls
3c946a8449 Merge T Edmunds's 'computeInterestIncrement' to maint. 2019-04-20 12:32:17 -07:00
c-holtermann
ba8a9c8478 update python source doc 2019-04-20 15:12:20 +02:00
Robert Fewell
20e2b6b5de Bug 797175 - Opening a file from a gvfs mount point fails
When testing for a MS Windows path which has a ":", a gvfs path with the
format '/run/user/1000/gvfs/smb-share:server=192.168.1.11,share=public/
test-xml-file.gnucash' is recognised as a Windows path. To avoid this
expand the test to ":/" and also ":\"
2019-04-19 15:51:29 +01:00
thetedmunds
9afc856c20 Changed gnc:computeInterestIncrement to directly calculate the amount of interest accrued in the specified compounding period. Bug 797195. 2019-04-17 12:11:29 -07:00
thetedmunds
5f9020016a Amended commit to address pull-request comments. 2019-04-17 11:52:24 -07:00
Robert Fewell
0f6465ca6d Bug 797175 - Gnucash will not open from UNC paths.
UNC paths were overlooked in a change I made, corrected and added some
notes to source file for reminder.
2019-04-12 11:53:29 +01:00
John Ralls
c091197f57 Provide static strings for gnc_userdata_home and gnc_userconfig_home.
On Windows boost::filesystem::path's string() produces a string
that goes out of scope with the function in which it's called, so
returning its c_str() ptr yields freed memory, usually full of garbage.

This has an interesting side effect in gnc-file.c's check_file_path():
Since the memory is freed, g_path_get_dirname() reuses it after an
iteration or two, writing its result into the same address. The
following strcmp naturally returns 0 because it's comparing two
instances of the same ptr, so check_file_path falsely reports that
the proposed save path is in GNC_USERDATA_DIR.
2019-04-11 17:38:01 -07:00
Frank H. Ellenberger
833decc03e I18N: Review of price-quotes.scm
Mark "Found FQ version" translatable, but remove translation from log
file entries.
2019-04-08 17:37:33 +02:00
Christopher Lam
d64fb74b9e [utilities] add supporting functions for guile-json use
converts nested-list to nested-vector, and vice-versa
2019-04-04 19:44:00 +08:00
Christopher Lam
3923dfa19a [business-prefs] tidy counter definitions
(for-each) is more appropriate here because the (map) output is
unused...
2019-04-04 19:43:44 +08:00
Robert Fewell
5eb6f76e63 Change uri functions to work with valid Windows file uri's
Windows file uri's can be of the form 'file:///N:/bob.txt' so change
the gnc_uri_get_components to remove a left over '/' at the start so
gnc_resolve_file_path gets the absolute path correctly. Also change
gnc_uri_create_uri to add an extra '/' for Windows file uri's.
2019-03-29 20:43:00 +00:00
Robert Fewell
89d2cde979 Remove some white space/tabs from gnc-filepath-utils.cpp 2019-03-29 20:43:00 +00:00
Robert Fewell
22a7a05d50 Add function to create an absolute file path
Add function to create an absolute file path from a prefix path and a
relative one. If the prefix is null, then the root directory of the
current path is used.
2019-03-29 20:43:00 +00:00
Christopher Lam
a4eb5b1a59 [options] compact book-currency-acounting functions 2019-03-30 01:39:55 +08:00
Christopher Lam
faf1b08cec [options] compact valid-gains-loss-account? 2019-03-30 00:59:24 +08:00
Christopher Lam
0b8ff4b5d6 [options] deprecate gnc:save-options
this is unused.
2019-03-25 17:38:50 +08:00
Christopher Lam
4f6344963d [options] simplify gnc:value->string 2019-03-25 17:38:50 +08:00
christopherlam
d711cc35f8 Bug 639049 - Asset Barchart Report includes also the first day of next month transactions
If the original date is an end-of-month date, we take it as an
indicator they always want monthdelta dates to be end-of-months.

This works for monthly/quarterly/halfyearly/annual.

Addendum to commit 65bfeaf5de which was
deemed to be an incomplete fix.

Also I'd forgotten to activate a test in test-date-utilities. Enable it.
2019-03-21 19:44:33 +08:00
John Ralls
bc9d83c90f Merge Christoph Holterman's 'PR-G_ADD_PRIVATE-clean' into maint. 2019-03-19 09:12:48 -07:00
loftx
d5297a46bf Resolve 'basic_string::_M_construct null not valid' error when no database is provided in connection string 2019-02-26 15:37:01 +01:00
Christopher Lam
09e0e02a75 [test-extras] abstract test-data skeleton 2019-02-22 23:36:15 +08:00
Geert Janssens
fce75ea748 Add dedicated api to query build-time, version related compile constants
And use it in several location in the code for consistent behaviour
2019-02-21 17:00:15 +01:00
Christopher Lam
fe6cc534a0 [engine-utilities] deprecate account utility functions
These functions are obsolete with SRFI-1
2019-02-20 22:47:03 +08:00
Christopher Lam
972562421e [engine-utilities] deprecate split utility functions
These functions are obsolete with srfi-1
2019-02-20 22:47:01 +08:00
Christopher Lam
9ba0d9658d [test-extras] (create-transaction) adds price trading commodities/currency
this will modify a test which was calibrated to record purchase price
only. fix transaction creation to add prices for both purchase and
sales, and also fix test which was assuming no sale price was bring
recorded.
2019-02-20 21:41:49 +08:00
Christopher Lam
918321aafa [test-extras] for tests: (env-create-multisplit-transaction)
This is the general case for any transaction creation.  Rewrite other
transaction creation routines to use it.  All tests still work
unchanged, which confirms this function works well.

This will allow tests to create multisplit transactions, of an
arbitrary number of splits. If the list-of-split's values are not
balanced (i.e. total 0), the engine will create an Imbalance-CUR
split.

The motivation is to allow creation of complex multisplit
multicommodity transactions eg USD50 + GBP20 (USD25) = EUR66 (USD75)
as well as their prices GBP/USD = 25/20 and EUR/USD = 75/66.

* USD -50
* USD -25 = GBP -20
* USD +75 = EUR +66

This will be useful in creating tests for stock-based reports, whereby
stock sales need splits in STOCK/ASSET/INCOME accounts.
2019-02-20 21:41:49 +08:00
Christopher Lam
4a2b5e9641 [hooks.scm] deprecate hooks.scm
this module has a single function which is used only once. inline it.
2019-02-20 21:09:22 +08:00
Christopher Lam
f64586b873 [app-utils] remove config-var.scm
unused since 1999?
2019-02-20 21:04:23 +08:00
John Ralls
11083d6052 Bug 796989 - some date/time does not honor user locale (bis).
Set the locale for C so that it matches what's set for C++.
2019-02-19 09:49:56 -08:00
Christopher Lam
4f0e9a5168 [options] gnc:warn when looking up old option names
the option lookup mechanism will dynamically translate option
names. warn the user if this takes place so that the report writer may
use new option names.
2019-02-19 22:28:12 +08:00
Frank H. Ellenberger
d7190c0fac Merge branch 'patch-1' of https://github.com/sicelo/Gnucash into maint
Bug 797105 - Incorrect local-symbol for SZL currency
PR #461
2019-02-18 14:09:54 +01:00
Sicelo
07fbb46398
Update SZL section header
Clarify the reason for changing the symbol
2019-02-17 08:10:55 +02:00
Mike Alexander
d4af5244d0 Bug 797106: Do a better job of converting decimal prices to rationals.
Use the Scheme rationalize method to convert the decimal numbers
from Finance::Quote to ratinal numbers.  This avoids rediculous
precision like 8515625000000001/3906250000000000 for 2.18.
2019-02-17 11:58:15 +08:00
Christopher Lam
a4789fcac5 bugfix: fix crasher when loading saved-report with unknown choices.
If a saved-report with e.g. relative date, multichoice option is
unknown, the report would crash, and the Report-Options would
segfault. This commit fixes both: report-date defaults to 'today',
multichoice-options defaults to default-value.

Following this commit, if a report loads a saved-report or .gcm from a
future version, a gnc:warn will be emitted and the report will not
crash; it will use relative-date today. Multichoice will remain the
default value. Report Options will not segfault.

The user will be notified via a gnc:gui-warn dialog
2019-02-17 11:25:06 +08:00
Christopher Lam
a731c9ed9a [gnome-utils] add gnc:gui-warn/error/msg global functions
gnc:gui-[warn|error|msg] are new global functions.

By default they mirror gnc:warn/error/msg. However then gnome is
available, they will display appropriate warn/error/info dialog in
addition to outputting to console.
2019-02-17 11:24:57 +08:00
Sicelo
86be3b9247
Update iso-4217-currencies.xml 2019-02-16 18:08:45 +02:00
Sicelo
96577ff922
Update iso-4217-currencies.xml
Fixing the 'local-symbol' property for the SZL currency from "L" to "E." See Bug 797105.
2019-02-16 01:10:09 +02:00
Christopher Lam
65bfeaf5de [date-utilities] bugfix: date-intervals produces good month deltas
Instead of recursing the date, we calculate the next month using an
index-based multiplier, and apply modulo/remainder as appropriate to
determine the next month/year.

Then we attempt to create new mktime, and if the resulting mktime's
month is not as expected, reduce the mday by 1 until resulting month
is correct. This fixes monthly intervals for end-of-month days.

Test via monthly/quarterly deltas, and also includes leapyear
calculation.
2019-02-13 22:23:44 +08:00
John Ralls
140eb0b110 Log a warning in gnc_get_locale() instead of writing to stderr. 2019-02-12 12:58:42 -08:00
John Ralls
7d7da8e2c4 Bug 797067 - Date displayed incorrectly in register take two.
Revert using boost::locale to generate std::locales as boost::locale-
generated locales don't implement std::locale::facet and there was
a bug in the boost::locale ICU wrapper code that caused the wrong year
to be output for the last 3 days of December.

GCC's libstdc++ supports only the "C" locale on Windows and throws if
one attempts to create any other kind. For dates we work around this
by using wstrftime() to format according to locale and then convert
the UTF16 string to UTF8. wstrftime() interprets the time zone flags
%z, %Z, and %ZP differently so we process those first before calling
strftime. This will have the unfortunate effect of not localizing
timezone names but it's as close as we can get.
2019-02-08 11:56:32 -08:00
Mike Alexander
62a4e73f7f Don't use GNC-DENOM-SIGFIGS when converting prices
to gnc-numeric values.
2019-01-28 19:25:50 -05:00
Mike Alexander
5bd7875437 Revert the part of 923b01e2 which reverses currency quotes less than 1.
Now that GnuCash uses 64 bit numbers in numerics this is not necessary.
It can store a number as small as 1e-9 with 9 significant digits.
2019-01-28 19:25:34 -05:00
Mike Alexander
df19244792 Fix the comments on double_to_gnc_numeric. GNC_DENOM_AUTO is allowed.
GNC_DENOM_AUTO
2019-01-28 19:24:26 -05:00
Mike Alexander
2820af7166 Make test-backend-dbi-basic build and run with libdbi 8.
This may not be the correct fix, but it is plausible and it
makes the test build and run.
2019-01-28 19:23:35 -05:00
Alex Aycinena
7d0adfd0c6 remove unnecessary KVPs and frames related to US Income Tax name and type 2019-01-27 15:58:46 -08:00
Christoph Holtermann
2ab6650e9a Replace deprecated g_type_class_add_private
use G_DEFINE_TYPE_WITH_PRIVATE
and adapt name of private property to work with G_DEFINE_TYPE_WITH_PRIVATE
2019-01-26 08:15:02 +01:00
Christoph Holtermann
2cfc61182e directly use G_DEFINE_TYPE instead of QOF_GOBJECT_GET_TYPE 2019-01-26 08:15:02 +01:00
Christoph Holtermann
1bfcc95998 directly use G_DEFINE_TYPE_WITH_PRIVATE instead of QOF_GOBJECT_GET_TYPE 2019-01-26 08:15:02 +01:00
Christoph Holtermann
658da08008 replace deprecated g_type_class_add_private 2019-01-26 08:15:02 +01:00
John Ralls
84d1c3645d Use NULL, not '\0', to set a char* argument to NULL. 2019-01-25 12:52:14 -08:00
John Ralls
f9f714c78d gnc_pricedb_nth_price: Clarify code and cache results.
Use built-in glib functions to retrieve the list of per-currency price
lists, concatenate them into a single list, instead of doing it all in
hand-rolled loops.

Sorting is preformed by the calling GncTreeViewPrice so this removes
sorting from gnc_pricedb_nth_price.

There's no concurrency concern because gnc_pricedb_nth_price is a
GUI callback and so must run in the GUI thread.
2019-01-25 08:49:03 -08:00
Alex Aycinena
fc15364326 remove unnecesary 'home' level in path for US Income Tax book tax information 2019-01-24 18:36:13 -08:00
John Ralls
3a48672763 Complete reversion of e81bcf6 in gnc-pricedb.c. 2019-01-23 17:54:29 -08:00
John Ralls
020bc5371f Bug 797046 - Tools / Price Database / Currencies UI not working...
since 3.4.
2019-01-19 14:31:10 -08:00
John Ralls
e31f4c3f95 Fix unlocalized date in status bar.
It seems that std::locales created by boost::locale::generator are
not entirely compatible: If used to create a new locale with a facet
for boost::date_time one ends up with the C locale and the facet.

For the time being avoid the problem by using boost::locale to format
dates and times. std::chrono gets calendar functions in C++20 so we
can switch date-time backends once we can adopt it.
2019-01-19 13:41:17 -08:00
Christian Stimming
75b6d14455 Speed-up of dealing with account_imap lists: Replace g_list_append with _prepend and subsequent _reverse.
This is glib's suggested way of dealing with GList in more optimized
way, as g_list_append will have to traverse the list until the end.
2019-01-18 23:52:51 +01:00
Alex Aycinena
46b3e31acf Updated to include codes for version 42, although new codes not implemented yet because data not reliably available 2019-01-17 18:19:26 -08:00
Alex Aycinena
217289d037 Bug #796687, Tax entity name and type don't get saved. Change frame->set to frame->set_path to create missing frames. 2019-01-17 12:32:33 -08:00
Alex Aycinena
8f4f8a1dc4 Update US Income Tax information for 2018. Two forms haven't yet been published. If changes needed, will do in subsequent commit. 2019-01-17 12:15:51 -08:00
Thomas Klausner
3ab5a2be52 Bug 797041 - enum confusion in qoflog. 2019-01-13 16:29:11 -08:00
John Ralls
b4fedff90e Provide a single static instance of C++ locale.
We can't use std::locale::global because all streams imbue it by
default and if it's not 'C' (aka std::locale::classic) then we
must imbue all the streams that we don't want localized, and that's
most of them.

Provides error checking for setting the C++ locale from the environment.
This is necessary both because the environment might have an invalid
locale, which would cause an unhandled exception crash.

On windows std::locale("") can't handle some Microsoft-style locale
strings (e.g. Spanish_Spain) so we use boost::locale's gen("") function
to set the locale--though even that can't handle a Microsoft-style
locale string with an appended charset (e.g. Spanish_Spain.1252) and
that's what glibc's setlocale(LC_ALL, NULL) emits.
2019-01-06 10:13:01 -08:00
John Ralls
cee97be8d4 Add GncDateTime::timestamp().
To provide a C++ implementation of gnc_date_timestamp and to avoid
using the expensive and localized GncDateTime::format().
2019-01-06 10:13:00 -08:00
John Ralls
cec3f6031e Fix broken compile of test-gnc-date.c on Ubuntu 14.04. 2019-01-04 17:01:38 -08:00
John Ralls
9fa7b7f940 Implement a faster date-time serialization function.
Has the side effect of recording all date-times in XML files in UTC
instead of local time with a timezone.
2019-01-04 16:34:33 -08:00
John Ralls
137c920d06 Merge Chris Carson's 'dateFormat' into maint. 2019-01-04 15:50:39 -08:00
John Ralls
a65dd6cc25 Merge Chris Carson's 'refactor-Scrub-c' into maint. 2019-01-04 15:49:42 -08:00
Christopher D. Carson
2b69278650 Re-coded for cached locale.
Testing notes:  Based on the averages of 3 runs, the net
user CPU to save the XML file I use is:
10.2 seconds without this change
7.6 seconds with this change

In my environment the first call to the format routine
in question, the call that sets the cache value, is at
the end of the XML load.
2019-01-01 20:08:47 -06:00
Christopher D. Carson
0e37e059d5 Fix XML load CPU hotspot: Scrub.c xaccTransScrubPostedDate
The refactoring provides roughly 10% reduction in user CPU
use for XML file load by moving an expensive function
to within an if-clause where the result is used.  The diff looks
like a full re-write but only the if statements, indenting,
and commentary changed.
2019-01-01 19:41:16 -06:00
Christian Stimming
eb9e45bc20 Sorting speed-up: Cache the bool value of Transaction's is_closing property.
This value is queried on each comparison of split or txn sort function,
which means it is called quite a lot. Avoiding the KVP lookup of this
property gains a lot in terms of CPU cycles.
2018-12-31 14:50:36 +01:00
Christian Stimming
1eed3db5e7 Some (very minor) translation string improvements.
Fix superfluous space.
Unify case sensitivity in string that appears multiple times.
2018-12-30 22:23:04 +01:00
Christopher Lam
2423aeda42 [engine/test-test-extras] remove duplicated test file 2018-12-29 23:15:46 +08:00
Christopher Lam
0d4575da6c [income-gst-statement] rename options
Further commit to fix 3466ce78b

Discussion as follows
https://code.gnucash.org/logs/2018/12/27.html#T12:31:58
https://code.gnucash.org/logs/2018/12/28.html#T19:12:18
2018-12-29 04:03:45 +01:00
John Ralls
9bfaada356 Bug 796961 - Can't overwrite existing MYSQL database, V3.3.
Because m_exists was left true after dropping it, so the new
database wasn't created.
2018-12-28 13:22:40 -08:00
John Ralls
1116ce909b Bug 796967 - gnclock table not removed when using PostgreSQL.
Because of https://sourceforge.net/p/libdbi-drivers/bugs/24.
This issue causes trouble in save_may_clobber_data() as well, so
work around it by using a SQL query instead of dbi_conn_get_table_list.
2018-12-28 13:22:40 -08:00
Geert Janssens
267852ba76 Add a note on cvt and imbuing locales in a boost::filesystem::path object 2018-12-28 18:47:06 +01:00
Geert Janssens
272ca421b7 Set up filepath utils to determine the GNC_CONFIG_HOME in the same way as GNC_DATA_HOME
Until now GNC_CONFIG_HOME was more or less hard-coded.
Now it can be set via environment variable GNC_CONFIG_HOME.
In addition it will automatically be created to avoid potential
user confusion.
2018-12-28 18:36:52 +01:00
Geert Janssens
ac2e0946ea Rewrite path scrubbing in a c++ way 2018-12-28 16:15:00 +01:00
Robert Fewell
2634f23f87 Bug 767772 - Associated file with transaction is lost
when moving entry between accounts

When using the cut transaction option the 'associated file' value was
not being pasted to the new transaction. Added scheme code to get this
value and save it to new transaction when using 'cut/copy' and then
'paste' operations. When using the duplicate option, a dialogue allows
you to keep the copied association or not. It does not get copied for
autocomplete.
2018-12-28 09:45:50 +01:00
Geert Janssens
d22e1db340 gnc-uri - refer to 'scheme' instead of 'protocol' as that's the more formal term used in uris
This involves renaming 3 functions:
gnc_uri_get_protocol -> gnc_uri_get_scheme
gnc_uri_is_known_protocol -> gnc_uri_is_known_scheme
gnc_uri_is_file_protocol -> gnc_uri_is_file_scheme

The *_protocol variants are marked as deprecated.
Additionally a number of local variables have been renamed from
protocol to scheme to support this change.
2018-12-27 22:33:17 +01:00