Commit Graph

17990 Commits

Author SHA1 Message Date
Guy Taylor
34bab999a5 Fix coredump in Python when using "get_namespaces"
The Python API incorectly had GncCommodityTable.get_namespaces() defined
as a list of GncCommodityNamespace over the correct list of String. This
fixes the issue and adds a test for GncCommodityTable.get_namespaces()
and GncCommodityTable.get_namespaces_list().

Note: This is not a direct fix as I could not get SWIG to detect/convert
"GList *" to a "gchar *" to a Python str list.
2017-05-17 10:40:21 +02:00
Guy Taylor
3cd2a6554c Enable Python tests in Travis CI 2017-05-17 01:28:43 +01:00
Geert Janssens
e0af43d413 Properly handle import of reconcile state.
Gnucash exports this state localized it should expect a localized state on import.
2017-05-03 12:19:04 +02:00
Geert Janssens
3603ec1aa8 Document supported date formats in the saved csv settings 2017-05-03 09:44:36 +02:00
Geert Janssens
9af57849ba Use GncDate in csv importer
This removes all date specific functionality from the importer
2017-05-02 23:16:21 +02:00
Geert Janssens
7df29b572a Add copy constructor and assignment operator to GncDate 2017-05-02 23:09:36 +02:00
Geert Janssens
5070037314 Add comparison operators for GncDate
Note the operands are const GncDate& because the GncDate has no copy
constructor/assigment operator (any other definition would fail
when used with variables of type boost::optional<GncDate>)
2017-05-01 16:24:01 +02:00
Geert Janssens
1a3595cbeb Convert gnc_dmy2timespec{,_end,_neutral} to use the equivalent GncDateTime constructor
This required a couple of tweaks to the tests because:
- the invalid date returned for impossible conversions is different between the old implementation and the cpp edition
- unhandled glib warnings caused the tests to abort
2017-04-28 18:41:04 +02:00
Geert Janssens
7a037932ae Align day end time as used in the GncDateTime constructor and gnc_dmy2timespec_end
The former was using 23:59:00 while existing code was using 23:59:59. To avoid
disruptions, stick with the latter in our cpp code as well.
2017-04-28 18:41:04 +02:00
Geert Janssens
586b89c6ca Fix John's remarks 2017-04-28 18:41:04 +02:00
Geert Janssens
610f6309a3 Fix double free abort in gtest-gnc-datetime.cpp
This double free happened after the introduction of a class variable (static member variable
to GndDate and the test compiling in gnc-datetime.cpp *and* at the same time linking to
gnc-qof. This apparently threw off internal memory management. Removing either of linking to
gnc-qof or compiling in the source file solved it.
Credits go to John Ralls for debugging this.
2017-04-28 18:41:04 +02:00
Geert Janssens
209f971589 Add constructor to create GncDate from string and predefined date format
Primary use case is for parsing dates from external sources (importers)
2017-04-28 18:41:04 +02:00
Geert Janssens
9b30bb2b62 Various small fixups in csv importer
- Use descriptive names instead of numbers in std::get<>
- Remove unused parameters
- Fix some doxigen comments
2017-04-28 18:41:04 +02:00
Geert Janssens
b7bcd792f6 Align cmake rational/numeric test invocation with Makefile based one
This invocation avoids linking in gnc-qof and instead will
directly pull in all sources required.
2017-04-28 18:41:04 +02:00
Geert Janssens
b5530bd41f Fix autotools based build
For some reason gnc-vcs-info.h isn't found properly any more although
the relevant parts of the Makefiles haven't changed compared to the
maint branch. Perhaps a compiler option has changed ? Anyway simply
adding its path explicitly does fix it.
2017-04-26 11:10:30 +02:00
Geert Janssens
391955975b Fix static code checker warnings about parameter definition in doxygen comments
Apparently these shouldn't suffixed with a colon (:)
2017-04-20 23:19:08 +02:00
Geert Janssens
d1ff16138e Add GncDateTime constructor taking a GncDate as parameter
As a GncDate doesn't have any time information, this has to be made up.
GnuCash uses 3 times-of-day quite a lot:
- start-of-day (00:00 local time)
- end-of-day (23:59 local time)
- neutral time (10:59 utc, chosen to minimize
  day offsetting when converting to/from localtime)

A second parameter to the new constructor will tell it to use one of these presets.
2017-04-20 23:18:01 +02:00
Geert Janssens
724f8aa784 Swap GncDate and GncDateTime in preparation of a future commit 2017-04-20 21:42:24 +02:00
John Ralls
b2b32e29fa Work around googletest bug 920.
https://github.com/google/googletest/issues/920, already addressed in configure.ac.
2017-04-17 11:52:44 -07:00
John Ralls
bf3052206e Merge branch 'pr141' 2017-04-16 07:20:15 -07:00
Nitin Anand
4da080d363 Fix crash while saving scheduled transaction template 2017-04-16 13:12:02 +05:30
Mike Alexander
c7226ddd4f Delete left over line from previous merge conflict. 2017-04-10 01:37:23 -04:00
Mike Alexander
ce79222f05 Merge branch 'maint' 2017-04-10 01:27:47 -04:00
Mike Alexander
a2687bcbe3 Fix the SWIG Guile wrapping of functions that have a "struct tm" parameter.
The biggest problem was that a pointer to an out of scope struct tm was
passed to the wrapped function.  With opt level 2, clang doesn't bother
setting the contents of the struct since it goes out of scope without being
used.  This caused the transaction report to never report anything since
the start and end times it got were ridiculous.

Also most functions that take a struct tm pointer can change the contents
of the struct (if only to normalize it) so pass the new values back to Scheme.

Finally all calls to gnc_localtime and gnc_gmtime from Scheme leaked a struct tm
and calling gnc_tm_free from Scheme is a really bad idea so don't wrap it.
2017-04-09 16:25:45 -04:00
Mike Alexander
cdc94c7131 Calling sigfigs_denom with a zero crashes due to a divide by zero. 2017-04-08 19:48:23 -04:00
Mike Alexander
6933ab765d Add an XCode target to run the numeric unit tests and rename the main target to GnuCash. 2017-04-08 19:48:12 -04:00
Mike Alexander
85d2442521 Update XCode file lists and sort them alphabetically. 2017-04-08 19:47:59 -04:00
Mike Alexander
d18fce775f Fix a crash in scrub_sx_split_numeric introduced in b3eb9d0. 2017-04-08 19:41:21 -04:00
Mike Alexander
bfa5090db9 gnc_numeric_convert should return an invalid number unchanged instead of crashing. 2017-04-08 19:40:08 -04:00
John Ralls
5ff319205d Revert "Some instrumentation output..."
This reverts commit 2035806db7 that I
didn't want to push in the first place.
2017-04-08 09:27:15 -07:00
John Ralls
8ec92f2fe3 Change GTest annotations to use the right class name for GncInt128 tests. 2017-04-08 09:18:34 -07:00
John Ralls
2035806db7 Some instrumentation output for how much the numerator or denominator is shifted. 2017-04-07 12:39:47 -07:00
John Ralls
fd6234f58f Better manage truncation in GncRational::round_to_numeric.
Mike Alexander brought this up with a test case that failed to round down
sufficiently; he found that reducing the rounding denominator by 2 sufficed
to make his test case pass.

In fact the sizing of the replacement denominator by shifting the larger of
the numerator or denominator by an arbitrary 62 bits was not correct most
of the time, so instead we begin with a shift of the full lower leg worth,
try to do the conversion, and if the conversion is still “big” shift the
larger value one more and try the operation again, repeating until the
result will fit in a GncNumeric.
2017-04-07 12:38:55 -07:00
John Ralls
a467d0d397 Fix GncInt128 maxbits to account for the flag bits. 2017-04-07 12:29:04 -07:00
John Ralls
de1c56b53d Fix carrying to the wrong end of the lower leg in left shift. 2017-04-07 12:27:59 -07:00
John Ralls
e55b78614c Fix a magic number in GncInt128. 2017-04-07 12:26:51 -07:00
John Ralls
e20009a08d Save Changes Bug 780889 - Split-register transactions result in invalid...
price:type "transaction".

Add 'transaction' to the schema and document it in gnc-pricedb.h.
2017-04-03 21:16:43 -07:00
John Ralls
6e7334fe88 Add some tests looking for a GncInt128 divide overflow problem.
Problem mentioned in mail from Mike Alexander; this test doesn't find it.
2017-04-02 16:33:01 -07:00
John Ralls
844a6db32b Bug 780845 - link in github repo README file needs correction/editing 2017-04-02 09:22:16 -07:00
John Ralls
5a58b93a71 Bug 780845 - link in github repo README file needs correction/editing 2017-04-02 09:21:03 -07:00
John Ralls
f9d23de8c0 Merge Ueli Neiderer's swift-transactiontxt branch into maint. 2017-03-30 12:42:59 -07:00
Ueli Niederer
768df3b709 Obey GNUcash coding style
Corrected brace position.
2017-03-30 12:39:37 -07:00
Ueli Niederer
448d97553f Added a preference to control import behaivour of transaction text
In order to allow to revert the newly introduced behaviour of putting
transaction text in front of the extracted purpose, the feature can now
be disabled through the preferences dialog.
2017-03-30 12:39:37 -07:00
Ueli Niederer
0ad94ddcc0 Including the transaction text into the purpose text
Some banks include additional purpose information for a transaction in
non-swift-section 17 (aka transaction text). If available, this
transaction text is put in front of the other purpose texts to provide
full transaction information.

While the final solution is still under discussion. This change is a
first low-impact implementation backported and distilled from the work
discussed in gnucash/gnucash#139.
2017-03-30 12:39:37 -07:00
John Ralls
b3eb9d0d8a Use qof_instance_set/get instead of g_object_set/get. 2017-03-28 11:53:05 -07:00
John Ralls
baef4029b2 Merge branch 'maint' 2017-03-28 11:49:50 -07:00
Mike Alexander
2b777b9848 Remove the xxx_with_error functions from Python bindings.
They were removed from GnuCash in b199593 In January.
2017-03-26 19:19:11 -04:00
John Ralls
509ce16add Release 2.6.16 2017-03-25 17:23:18 -07:00
John Ralls
3109fc5cc4 Reduce the gate on get_random_gnc_numeric.
Fixing Bug 779217 increased the maximum denominator by 10, and that led
to overflows when converting large numbers' denominators from 100 to the
new max.
2017-03-25 17:15:37 -07:00
John Ralls
a4ea79122d Update translations ca, nl, and sr from the translation project. 2017-03-25 15:39:04 -07:00