Commit Graph

131 Commits

Author SHA1 Message Date
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
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
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
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
badda88224 Clear, not empty.
Found by gcc when setting C++17 on master.
2019-10-05 11:44:09 -07: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
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
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
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
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
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
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
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
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
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
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
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
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
faba7975ac Fix a bunch of memory allocation errors found by clang static analysis. 2018-11-30 15:08:41 +09:00
Di Mang
893383ce9b removing double semicolons at the end of lines 2018-09-30 19:10:50 +02: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
26a179872d Don't create 2 new books for every new session.
And don't ask to save a not-dirty or empty book, fixing
Bug 794870 - If no book is opened, gnucash still asks if the user wants
to save changes when opening a file
2018-09-23 16:42:11 -07:00
John Ralls
6d2ef90313 Fix a magic number. 2018-09-21 13:00:34 -07:00
Geert Janssens
5057703d30 Sql backend - show progress similar to how it's done for xml backend
That is let the percentage increase gradually. The current granularity is still
very rough, but at least it gives an indication of getting closer to fully
loading the data. The previous configuration on the other hand only suggested
something was happening but with no indication where in the load process
gnucash was.
2018-09-15 17:48:37 +02:00
Geert Janssens
5775662b52 Raise edit level of all accounts before loading transactions and splits
This prevents calling xaccAccountRecomputeBalanceInCurrency on each split that gets added,
which was exponentially increasing load times. On a huge test book the
load time dropped from 53 minutes to 1m20s.
2018-09-15 17:05:16 +02:00
Geert Janssens
221c46585c Sql backend - load transactions before business objects to reduce individual slot queries 2018-09-15 16:38:55 +02:00
Geert Janssens
48b29f5e91 Fix memory leak in char* type KvpValue and fix improper uses
The core issue was that the delete visitor was never called because its parameter
type (char *) didn't match the boost::variant type (const char *).
Fixing the visitor's parameter type also require a const_cast
back to char * because that's what g_free takes as argument.

The rest of this commit is merely fixing KvpValue instantiations that
tried to create a char* KvpValue from a stack based const string instead
of a heap allocated one. That would bomb out on calling the
delete visitor.
2018-09-10 19:49:43 +02:00
John Ralls
fc368b91d2 Restore the timespec_val column name in the slots table.
Renaming it would require a backwards-incompatible schema change,
something that shouldn't happen in the middle of a stable series.
2018-08-30 17:03:41 -07:00
John Ralls
20f6e4e690 Remove Timespec from the SQL backend. 2018-08-13 11:52:43 -07:00
John Ralls
755773ac4c Clean up timespec comments in the XML backend.
Noting where the word must stay; most significantly for KVP types and for
parsing Version 1 XML files.
2018-08-13 11:52:43 -07:00
John Ralls
b32a8a9390 Remove time64_to_string and string_to_time64 and their tests.
Each was used exactly once and simply wrapped a function call.
Also replace static function time_parse_failure that just returned a
constant with the constant.
2018-08-13 11:52:43 -07:00
John Ralls
358cd979d9 Remove Timespec from the main engine classes (Transaction, Split, & Account. 2018-08-13 11:52:42 -07:00
John Ralls
fee589b28c Remove Timespec from pricedb.
Includes removing the time64 specialized functions because the regular ones
handle time64 now.
2018-08-13 11:52:42 -07:00
John Ralls
c8b372e390 Convert GNC_TYPE_TIMESPEC to GNC_TYPE_TIME64, Kvp::Type::Timespec to Kvp::Type::Time64
They have to go together because of using gvalues to hide KVP from most of
GnuCash.
2018-08-12 16:12:19 -07:00
John Ralls
2f861bc2a4 Ensure all C++ class member raw pointers are default-initialized to nullptr. 2018-08-10 12:21:28 -07:00
Geert Janssens
239ee6797a Fix crash when cancelling a Save As... overwrite action
This was discovered while trying to fix bug 796792. However that bug itself
is totally unrelated.
2018-08-08 15:47:09 +02:00
John Ralls
43af50bd8a Bug 796759 - --add-price-quotes <sql file> leaves a lock on the file.
First, save isn't necessary if the book is dirty, so don't... but that
means that the book has to be marked dirty after a session swap. No more
laziness.

Second, regardless of the outcome of inner_main_add_price_quotes the
session must be destroyed to remove the lock.

A couple of cleanups in QofSessionImpl::save as well: Rewrote the
descriptive comment to reflect how it really works when the backend has
gotten disconnected and removed the superfluous qof_book_set_backend
with the backend that we'd *just gotten from the book*.
2018-07-14 17:09:22 -07:00
John Ralls
de927d535d Fix test-backend-dbi for Postgress and MySQL.
Pass MySQL database exists errors and skip creating the database
if it exists.
2018-07-13 16:34:42 -07:00
John Ralls
756f444ac3 Update bug tracker URL
Change all instances of bugzilla.gnome.org to bugs.gnucash.org, reflecting
our migration to a self-hosted bug tracker.

Inform the Translation Project Coordinator at release that this affects
translatable strings and that all message catalogs have been updated.
2018-07-13 09:49:33 -07:00
Geert Janssens
9d5712ef09 Use same 'force' logic sequence for sqlite and other dbs 2018-07-06 22:32:01 +02:00
Geert Janssens
875781847a Bug 796724 - Can't overwrite gnucash DB on MariaDB 2018-07-06 22:30:15 +02:00
Geert Janssens
9ab06bc9b3 Bug 789594 - Unable to overwrite sqlite3 database file 2018-07-05 22:41:56 +02:00
Geert Janssens
240c4bd2cf Whitespace cosmetics 2018-07-05 22:41:56 +02:00
John Ralls
f7ed46a35b Bug 796248 - Editing Scheduled Transaction, take 2.
In addition to not begining to edit already-loaded transactions,
don't try to load splits that are already loaded. It shouldn't
be possible to load a transaction without also loading its splits.
2018-06-26 15:04:23 -07:00
John Ralls
4e04f6e51d Don't warn about an invalid date if it's just an empty column. 2018-06-26 15:00:51 -07:00