Commit Graph

510 Commits

Author SHA1 Message Date
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
Geert Janssens
4b398325ea Redesign gnc-uri-utils
- gnc_uri_get_components will now return NULL as protocol if the input is a normal
  file system path instead of a uri (it used to return 'file')
- gnc_uri_get_protocol will now return NULL if the input is a normal
  file system path instead of a uri (it used to return 'file')
- gnc_uri_is_file_protocol now returns FALSE if protocol is NULL (it used to return TRUE)
- gnc_uri_is_file_uri now returns FALSE if input is a normal file
  system path instead of a uri (it used to return TRUE)
- a new function gnc_uri_targets_local_fs will return TRUE only if its input
  is either a file uri or a normal file system path. This function is now mostly
  used instead of gnc_uri_is_file_uri in the current code base
- a new function gnc_uri_is_uri is added to check whether its input
  is a valid uri (has protocol, path and hostname for non-file uris)
2018-12-27 20:53:33 +01:00
Geert Janssens
06da9e9712 Enable gnc-uri test suite
It was there but never run :(
2018-12-27 20:53:33 +01:00
John Ralls
53680e6100 Merge Bob Fewell's 'fixes03' into maint. 2018-12-25 11:11:27 -08:00
Robert Fewell
5c524c31b2 Add routine to fix Account Color being set to "Not Set"
Previously the account color slot has been populated with "Not Set"
when any field for the account has been edited and saved. This routine
should run once and remove all such entries.
2018-12-24 13:00:07 +00:00
Christopher D. Carson
aaeb639d07 Performance fix in dom_chars_handler: use g_strndup instead of g_strdup
Because the origin string can be extraordinarly long, you get more
benefit from this than you would imagine
2018-12-24 13:46:48 +01:00
YOSHINO Yoshihito
7f1a711567 Bug 796989 - some date/time does not honor user locale
because now it looks for the user locale each time when it formats
datetime, I added Fixme comments.
2018-12-22 01:09:08 +01:00
John Ralls
f5be842c2e boost needs bcrypt.lib for all versions of Windows. 2018-12-16 16:31:06 -08:00
Christoph Holtermann
96e27a4199 typo 2018-12-04 12:05:59 +01:00
John Ralls
e81bcf6e33 Fix the remaining static analysis warnings.
Except two incorrect leak warnings and one about mktemp
 being insecure in the XML backend. See the respective
comments about those.
2018-11-30 15:08:41 +09:00
John Ralls
bf55c30aeb Fix most of the unused assignment errors from static analysis.
There are a very few left that need deeper study, but this gets
rid of most of the noise. For the most part it's just getting rid of
extra variables or removing an assignment that is always
replaced later but before any reads of the variable. A few are
discarded result variables.
2018-11-30 15:08:41 +09:00
John Ralls
876bfd19ad Protect against nullptr dereference, remove unused GError.
Found by clang static analyzer.
2018-11-30 15:08:41 +09:00
John Ralls
24ce92056d Protect from potential nullptr dereferences.
pmtsched is created in only one banch of the opening switch.
Found by clang static analyzer.
2018-11-30 15:08:41 +09:00
John Ralls
8f22c4bed4 Localize variables, ensure that val_imbalance is set, test txn_curr != commodity once.
Found by clang static analyzer.
2018-11-30 15:08:41 +09:00
John Ralls
4ffeb3efac Ensure that a dereferenced variable isn't NULL.
Found by clang static analyzer.
2018-11-30 15:08:41 +09:00
John Ralls
43a30e1c97 Silence clang static analyzer complaint about potential div by 0.
It can't, because if b is 0 the function would have
returned already; since b.m_hi is 0 b.m_lo can't be. The assert
reassures clang that this is the case.
2018-11-30 15:08:41 +09:00
John Ralls
3d1362757b Prevent potential undefined behavior by shifting by a wrapped uint.
Found by clang static analyzer.
2018-11-30 15:08:41 +09:00
John Ralls
606d9cfee6 Prevent potential nullptr dereference.
Found by clang static analyzer.
2018-11-30 15:08:41 +09:00
John Ralls
faba7975ac Fix a bunch of memory allocation errors found by clang static analysis. 2018-11-30 15:08:41 +09:00
John Ralls
61cd7999f3 Fix half-up, half-down, and banker's rounding for negative numbers.
We need to compare the magnitudes of the remainder and the denominator
in order to round negative numbers correctly. Note that while gnc_numeric
is constrained to a positive denominator the C++ rounding functions cannot
assume that constraint in all cases.

Combined with the previous commit, this fixes
Bug 796949 - Incorrect conversion of 0,01 USD to EUR
2018-11-27 22:17:22 +09:00
John Ralls
536606a89c Fix extract_common_prices logic.
So that the returned price tuple has the two commodities of interest
converted to a common currency. Before the first pair that that shared
any random currency would be returned, perhaps creating an absurd result.
2018-11-27 22:17:22 +09:00
Geert Janssens
13f6c4d6d7 Introduce and use gnc_time64_get_day_neutral
This function complements gnc_time64_get_day_begin/end. There was
time64CanonicalDayTime but this returned noon of the given day, where we
want 10:59am in most cases. I haven't changed time64CanonicalDayTime
directly as that may break assumptions in other parts of the code.
Instead I have created a new function that can be gradually introduced.
2018-11-20 21:12:32 +01:00
Geert Janssens
11af81b51b Bug 789674 - Close Book tool regression 2018-11-20 18:55:09 +01:00
Geert Janssens
cd04e805e3 Bug 796919 - Leading '+' character not accepted in amount when value surrounded by quotes
Use a variant of xaccParseAmount that allows to ignore the locale's positive_sign character
or the + sign if locale doesn't define a positive_sign character.

In a future redesign it would probably be better to replace use
of xaccParseAmount with some variant of the gnc-expression-parser
but that would require more that a few tweaks to get right.
2018-11-18 17:23:14 +01:00
Geert Janssens
f13d21b973 Bug 498072 - GnuCash show taxes on invoice when individual taxes is not checked
Use more descriptive option name and tool tip as proposed in the bug.
2018-11-18 15:38:59 +01:00
Robert Fewell
d458e13a7f Remove KVP for assoc_uri when passed an empty string
Change xaccTransSetAssociation so if an empty string is passed the KVP
entry is removed instead of leaving an empty stub.
2018-11-15 15:30:35 +00:00
John Ralls
284d6c1456 Fix travis failure try 2.
stdint.h for Transaction.c too.

Also get rid of unused timeval decl.
2018-11-11 17:43:24 +09:00
John Ralls
73d193606e Fix travis failure.
Linux needs stdint.h for INT64_MAX.
2018-11-11 17:29:06 +09:00
John Ralls
710b122b24 Bug 796940 - Invalid transaction date-posted KVP causes...
date-posted to not be saved.

Check the stored GDate for being in the GncDateTime range as well
as the GDate range before returning it and check trans->date-posted
against INT64_MAX instead of 0 before changing it.
2018-11-11 17:07:34 +09:00
John Ralls
4c1c485db6 Use split SCU when borking random split pairs.
Reduces likelihood of a zero value in the transaction currency.
2018-11-10 11:35:16 +09:00
John Ralls
4b5ee84575 Work around strange struct tm initializer failure. 2018-11-02 13:44:09 -07:00
John Ralls
0e723610f0 Bug 795080 - Some dates reset to 01/01/1970
The first fix for this bug handled structs tm with ambiguous times.
This one fixes the GncDate constructor when the time is ambiguous
because it's in the DST-change hour, using the same add 3 hours,
construct the LDT, and subtract the 3 hours from the result.

The string constructor handles only simple-offset HH:MM timezones and so
is immune to the bug.
2018-11-02 10:45:40 -07:00
Ruben Cheng
36e430c8ba
Update iso-4217-currencies.xml
*) Fix VEB and VEF local-symbol
*) Add new currency for Venezuela (VES - Bolivar Soberano) since August 20th 2018
This is related to Bug 796927
2018-10-31 23:23:02 -04:00
John Ralls
263c5a40ea Merge Chris Lam's 'maint-scheme-progress' into maint. 2018-10-29 13:06:25 -07:00
John Ralls
f6fb1101bd Add bcrypt.lib to engine build flags on Windows < 10.
Seems not to be required on Win10.
2018-10-29 11:27:16 -07:00
Christopher Lam
b59e209618 [test-extras] gnc-pricedb-create skips if commodity = currency 2018-10-28 09:09:03 +08:00
John Ralls
08e28bfc81 Merge Di Mang's Double-semicolon fix into maint. 2018-10-16 08:57:31 -07:00
John Ralls
7a4b06c442 Bug 796878 - test-qofsession fails on x86_32. 2018-10-04 15:44:32 -07:00
Di Mang
893383ce9b removing double semicolons at the end of lines 2018-09-30 19:10:50 +02:00
John Ralls
b7be8d59b7 Remove engine-deprecated.i from CMakeLists.txt.
It wasn't created in the timespec functions deprecation commit.
2018-09-29 13:01:29 -07:00
Geert Janssens
406953c2ae Bug 796820 - References to 'Gnome Bugzilla' should be changed to 'GnuCash Bugzilla'
Additionally use https everywhere to refer to bugs.gnucash.org or bugzilla.gnome.org
2018-09-28 15:00:43 +02:00
John Ralls
26714d2e17 Bug 792446 - Mixed languages in error dialog. 2018-09-27 18:05:42 -07:00
Geert Janssens
2094282790 Merge branch 'block-pref' of https://github.com/Bob-IT/gnucash into maint 2018-09-27 21:57:39 +02:00
Robert Fewell
b6f2b111bc Block registered prefs when preference dialogue loaded
When the preference dialogue is loaded and options are set, the ones
with registered callbacks fire causing parts of Gnucash to be updated.
This was observed with gnc_split_register_load being executed 5 times
for each open register when the preference dialogue was loaded.

To overcome this, a couple of functions have been created to block and
unblock all registered prefs and used while the preference dialogue is
loaded.
2018-09-27 15:57:34 +01:00