Commit Graph

651 Commits

Author SHA1 Message Date
John Ralls
83b1b8adfc Fix typos. 2018-09-16 13:05:49 -07:00
John Ralls
162605f505 Fix Windows binreloc executable finding.
Taking into account the behavior of
g_win32_get_package_installation_directory_of_module when the last
directory element either is or isn't "bin".
2018-09-16 12:36:04 -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
62eb95c05c Fix memory leaks in gncOwnerGetBalanceInCurrency 2018-09-14 11:34:45 +02:00
Geert Janssens
4e71629966 Fix memory leak in xaccTransRetDateDue 2018-09-14 10:47:31 +02:00
John Ralls
10a21cbfac Merge branch 'Bug794526' into maint 2018-09-11 10:46:02 -07: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
Geert Janssens
b866d7d955 Plug memory leak in xaccSplitDestroy
Splits were not marked for deletion if the transaction is read-only
and the account is not marked for deletion yet. The net result is
that split will not be freed later on.
However xaccSplitDestroy is also called from a Transaction's do_destroy.
At that point accounts are not necessarily marked for deletion yet (like
is the case when a datafile is closed). This turned out to be a problem
for invoice post transactions (which are also read only) and hence
would cause memory to leak.
2018-09-10 18:57:39 +02:00
Geert Janssens
1117027f72 An empty GValue is interpreted as NULL reason, which is still a valid cache
Ignoring this would make caching almost useless as there are typically
only very few read-only transactions.
2018-09-10 10:24:49 +02:00
John Ralls
f219bc45aa Bug 794526 - Python bindings can't find loadable modules.
Always use absolute paths for configured directories (BINDIR etc.)
Abstract out the guts of gnc_gbr_find_foo_dir for foo in lib, bin, and data.
etc requires special handling because of the way it's treated if prefix
begins with /opt.

Always fall back on the configured directory if binreloc is disabled and
no default is passed in.
2018-09-09 16:36:39 -07:00
John Ralls
a19dcc7bd4 Fix crash when there's no TRANS_READ_ONLY_REASON slot.
Unsetting an empty g_value raises a fatal error, causing tests to fail
in some environments.

g_free() handles NULLs itself, no need to protect it.
2018-09-09 15:02:53 -07:00
Geert Janssens
d069b67d48 Fix memory leak in xaccTransGetReadOnly
In addition implement a cache for this value as suggested in the comments
as this function is called on every transaction commit.
2018-09-09 22:50:05 +02:00
Geert Janssens
3634e8f59d Fix memory leak using qof_instance_get on a GncGUID
The underlying boxed type will return a copy so we should free this
when no longer needed.
2018-09-09 22:50:05 +02:00
Geert Janssens
4cc61463ab Remove unused variable 2018-09-09 22:50:05 +02:00
John Ralls
b05082a09d Merge Chris Lam's consolidated invoice report into maint. 2018-09-08 14:43:33 -07:00
Geert Janssens
705e866472 Bug 796054 follow up
Now that a separate wiki section has been written for the side effects of this bug
make the memo field of affected splits point to this wiki section.
2018-09-01 16:22:42 +02:00
Geert Janssens
d07f759ca3 Use alignment-safe buffer handling
Casting a char* to a struct containing a uint32_t is not universally safe
due to alignment constraints on reads on some platforms. Copy our possibly
unaligned source data into an aligned area of memory to avoid SIGBUS on
armhf.
Reported by vorlonofportland in PR#403. This commit the John's optimized
version of Vorlon's proposed fix.
2018-09-01 12:07:42 +02:00
Geert Janssens
4c87dd05ec Fix compiler warning issues
- add -Wno-deprecated-declarations to CXX_FLAGS as well. This was
  reported by vorlonofportland in PR#401 to become necessary for glib 2.58
  as that has deprecated g_type_class_add_private which appears in our
  c++ code.
- change -Wno-deprecated-register into -Wregister. The former appeared to
  be a clang dialect and alias for the latter (see
  https://github.com/Barro/compiler-warnings for an overview of clang
  and gcc warnings). It was moved to global CXX_FLAGS as it can only be
  added for g++.
2018-09-01 12:07:38 +02:00
Geert Janssens
131df82135 Merge branch 'date-bugs' of https://github.com/Bob-IT/gnucash into maint 2018-08-31 22:01:45 +02:00
Geert Janssens
baf933acf2 Bug 796054 - unposting and reposting invoice doubles amounts
Add scrub function to unblock the double post transaction
2018-08-31 20:24:39 +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
Geert Janssens
c977c2350a Merge branch 'sort-filter' of https://github.com/Bob-IT/gnucash into maint 2018-08-30 12:18:15 +02:00
John Ralls
704afc6e02 Comment to explain structuring an (env-transfer-foreign). 2018-08-28 15:10:29 -07:00
John Ralls
fe73f52bdb Guard against divide-by-zero errors. 2018-08-28 15:10:29 -07:00
Robert Fewell
2dcb316280 White space removal and change tabs to spaces in qofbook.cpp/h 2018-08-25 11:10:32 +01:00
Robert Fewell
fd750a22eb Cache the number of days read only value
The KVP value for the qof_book_get_num_days_autoreadonly was being
called many times so it makes sense to cache it in the book to avoid
the KVP lookup.
2018-08-25 11:10:24 +01:00
Robert Fewell
a650693d07 New feature for register sort/filter settings move. 2018-08-17 11:31:25 +01:00
Robert Fewell
9423e0913b Remove white space and re-indent gnc-features.c 2018-08-17 11:31:25 +01:00
John Ralls
c08dee67ba Preserve timespec-using functions in Guile bindings.
There's an example of use in text-extras.scm, function
gnc-pricedb-create.

Unfortunately the deprecation messages issue no warnings.
2018-08-16 10:47:41 -07:00
John Ralls
e9098d08d2 Change ISO date format to remove fractional seconds. 2018-08-13 16:19:39 -07:00
John Ralls
35fabe2690 Remove Timespec from gnc-date. 2018-08-13 16:19:39 -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
62b17ca5db Timespec removal, engine odds-and-ends. 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
92a8cf330a Timespec->time64 in business code. 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
b60aef9d2a Remove timespec2dmy.
It had only two uses and one was in a test. Replace those calls with
gnc_localtime_r.
2018-08-12 16:12:19 -07:00
John Ralls
6f89bd62b3 Remove timespec from gnucash/gnome.
With a little API bleed into engine.
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
1e87d069f6 Merge branch 'maint-upgrade-test-balsheet' of https://github.com/christopherlam/gnucash into maint 2018-08-08 16:26:35 +02:00
Geert Janssens
d69d1f6a32 Merge branch 'maint' of https://github.com/yurchor/gnucash into maint 2018-08-08 15:52:51 +02: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
Christopher Lam
7ef4c00579 [easy-invoice] Display/Charge Type rename back to Display/Action
This report had renamed "Action" to "Charge Type". For consistency,
let's rename it back, and add migration path in options.scm for
saved-options. 2 fewer strings for translation.
2018-08-07 20:59:35 +08:00
Christopher Lam
47ba21b8dc [test-extras] export gnc-pricedb-create 2018-08-07 13:26:09 +08:00
John Ralls
78ab26cc2b Fix gncInvoice test failure.
test_suite_gncInvoice sets up the test suite. It's not part of the test
runtime, so stack variables in it have gone out of scope by the time the
tests are actually run. Making invoiceData static makes it permanent so
it exists at runtime.
2018-08-06 14:49:07 -07:00
Geert Janssens
d87fa3a5be Bug 796766 - Credit note creating 'imbalance' with wrong entries
Add fix and regression test.
2018-08-06 13:29:12 +02:00
Geert Janssens
69fef8277f Revert "Add preference to control toolbar appearance"
This reverts commit 3b09313107.
2018-07-31 17:30:07 +02:00
Yuri Chornoivan
f9700ba98d Fix minor typos 2018-07-27 14:23:15 +03:00
John Ralls
216528c130 Merge Bob Fewell's 'fixes8' into maint. 2018-07-23 14:51:01 -07:00
John Ralls
6d605762dd Delete the last vestiges of timepair. 2018-07-23 12:00:54 -07:00
John Ralls
773b070345 Don't set transaction properties via scheme in C code. 2018-07-23 12:00:12 -07:00
Robert Fewell
64778fcad5 Fix error when options dialogue is open when app closed
With the options dialogue open when Gnucash is closed this error is
logged in the trace file, gnc_close_gui_component() component not found.

This is fixed by reversing the components list found for session so the
options dialogue is closed before the report window.
2018-07-22 13:07:57 +01:00
John Ralls
ff91056ab1 Resolve ubuntu 14.04 naming conflict. 2018-07-15 16:55:55 -07:00
John Ralls
a51be5157c Add preference for forcing prices to decimal display.
Anticipating that some users might prefer to see exact prices,
add a preference to General>Numbers to configure whether prices
are rounded to decimals or are displayed as exact fractions.
2018-07-15 14:18:01 -07:00
John Ralls
1fffbaf856 Bug 794755 - Commodity Register displays fractional prices
When printing numbers convert them to a new decimal denominator with
rounding if the passed-in print info specifies that they should be
forced and rounded.

Make the default price settings forced and rounded.

Pass the price currency to gnc_default_price_print_info and
use the currency's fraction * 100 to determine the round-to
denominator and the number of decimal places to display.
2018-07-15 13:20:21 -07:00
Robert Fewell
3b09313107 Add preference to control toolbar appearance
Add preferences to select icon size and item layout on the toolbar.
Fixes Bug 796739 - Toolbar buttons have no labels, part 1 of 3.
2018-07-15 10:40:41 -07: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
Christopher Lam
582265d0c6 [job-report] Prevent Crash if there is no AR account
I think this crash is triggered because the 'account' variable
defaults to the first available AR account. If there's no AR account
it becomes null, and querying null's default book leads to segfault.

I guess I can fix segfault too by fixing gnc_account_get_book.
2018-07-07 12:58:13 -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
f067e8328e Allow saving to xml over an existing sqlite3 file and the other way around
A type check on the pre-existing file was preventing this. The type check however
only makes sense when opening files, not when overwriting.
2018-07-06 22:00:08 +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
Christian Stimming
5f46553f1f Minor KVP performance cleanup
Change some plain string literals to std::string constants, which helps
avoiding typos and also saves some string constructors/destructors
in the KVP lookup. Nevertheless the functions in Account.cpp do not
contribute that much to the overall UI speed, but whatever.
2018-06-24 20:50:46 +02:00
John Ralls
7e4f9a444f Add some files missing from the diat so distcheck passes. 2018-06-23 22:00:34 -07:00
John Ralls
1e6627c4c5 [DBI Backend] Init and finalize the backend in setup and teardown.
Xcode 9's clang creates a separate dbi_instance for each test and so
each one needs to be initialized during its setup and finalized at
teardown.
2018-06-23 17:35:42 -07:00
Geert Janssens
a438a59513 Bug 795944 - Cannot store change to Business Suppliers data
The underlying problem was that the vendor object remained in infant state
That confused the backend code so it used an sql INSERT statement instead
of an UPDATE statement to write back the changes. As the object already
existed in the db this would fail.
The fix is to ensure the object doesn't remain in infant state during
sql loading. See the bug report for a more detailed explanation.
2018-06-23 13:15:46 +02:00
Christian Stimming
92ea3ba8a6 Register speed-up for large files.
The function qof_book_use_split_action_for_num_field gets called quite a
lot in each register display refresh (due to sorting all splits from
Split.x's xaccSplitOrder function), but it always used to use a KVP
lookup, which is rather expensive compared to accessing a gboolean member
variable.

To get rid of this cost, I had to remove the KVP lookup in this
simple-looking function. The pattern is this: A gboolean cache variable is
introduced, along with an isvalid flag. The lookup makes the expensive
KVP lookup once, then caches the value. The GObject property mechanism
offers a callback for when the setter was called, which is used to mark
the cached value as invalid. A parallel setter method (here:
qof_book_set_option) also just marks the cache as invalid. This covers
all setters, and the getters will use the cached value except for their
first invocation.

The NUM_FIELD_SOURCE feature was introduced in 2012 by the very large
commit 7cdd7372 and apparently its costs never were a problem
until the KVP lookup became more costly due to the std::vector
construction and destruction.
2018-06-22 22:54:33 +02:00
John Ralls
f144a8deb7 Revert "Bug 796248 - Editing Scheduled Transaction"
This reverts commit ffe6044cd6.
It breaks loading splits on transactions that have already
been loaded.
2018-06-22 10:14:21 -07:00
John Ralls
696277bbf6 New clang error enforces virtual destructors. 2018-06-22 09:09:33 -07:00
John Ralls
a9f0fe2f93 Merge Chris Lam's 'maint-test-all-charts' into maint. 2018-06-17 14:06:38 -07:00
Christian Stimming
1e3a445007 Optimize calls to get_path_kvp so that std::strings are not always created and deleted immediately.
Turns out that the on-the-fly conversion from const char* (the KVP_OPTION_PATH
constants) to std::string with their immediate deletion afterwards is
a quite costly operation. Avoiding this is surprisingly easy: Just keep
local std::string objects at hand, and they don't have to be created
and deleted anymore.

The more optimized solution might be to turn the std::vector<std::string>
into a std::vector<GQuark>, but this commit at least improves the picture for now.
2018-06-17 22:51:16 +02:00
Christopher Lam
02bb981daa [test-extras] upgrade env-transfer-foreign to update pricedb 2018-06-16 14:18:30 +08:00
John Ralls
9c7fa77d3b Merge Bob Fewell's 'fixes6' into maint. 2018-06-12 16:12:48 -07:00
John Ralls
ffe6044cd6 Bug 796248 - Editing Scheduled Transaction
An extra XaccTransBeginEdit, never committed, for transactions that
the backend tried to load when they were already there. That made
the register think that something else had it open.
2018-06-12 15:49:28 -07:00
John Ralls
c8861d4666 Bug 795276 - Invalid date on price stops file from being parsed.
Instead of reporting an error and declining to load the file (XML)
or failing to enter a value (SQL) when a bad date is found in the
database, use a 0 time stamp (1970-01-01 00:00:00 UTC). Adds a warning
in SQL backends; there was one already in XML.
2018-06-12 14:56:27 -07:00
John Ralls
9e6760f7cb Bug 796527 - invalid currency on scheduled transactions
1. Don't even check for price/exchange rate on template transactions,
there's no point.

2. Extract function get_transaction_currency:
a. Check all split commodities are valid, abort transaction creation if
not.
b. If the template transaction's currency isn't used by any of the
splits set the new transaction's currency to the first-found currency if
there is one, otherwise to the first-found commodity.

3. Fix a minor typo in a comment.
2018-06-11 10:03:16 -07:00
Robert Fewell
1f14d0f629 In qof_scan_date returns valid date when day and month are 0
If you start typing a date in the register with the enable autoreadonly
option starting with a 0, gdate complains when trying to create a valid
date.
2018-06-09 15:04:27 +01:00
John Ralls
6f0a3c4345 Bug 795362 - Special variable "i" not parsed in function calls
Limit the range of the random value to 1..1000 to prevent overflows,
particularly in number-of-periods or number-of-years variables.

While we're at it, g_random_int and g_random_int_range return ints so
piping the result through gnc_double_to_numeric() doesn't make much
sense. That's removed, we just construct a gnc_numeric.
2018-06-08 16:44:31 -07:00
John Ralls
cdcb230a31 Don't look for backend libraries in old autotools subdirs.
Partly addresses Bug 794526
2018-06-07 17:38:04 -07:00
Potuz
e3e1464a01 Bug 794617 - Can't compile with -DWITH_GNUCASH=NO due to scm-gnome-utils
Pricedb.go doesn't need gnc-gnome-utils and we don't need WebKit or
gwenhywfar-gtk3 if we have no GUI.
2018-06-07 14:17:49 -07:00
John Ralls
333a14c0fd Fix ubuntu build failure.
%$^%$ C++11 initializer list behavior.
2018-06-02 17:57:42 -07:00
John Ralls
3b3074c28d Bug 796117 - Connecting 3.1 to an existing mysql db drops all data
Provide a backup recovery function that instead of dropping primaries
and restoring backups merges the primaries and backups. This should
handle a worst-case safe-save failure where the backup tables don't
have a complete set of rows for some reason.
2018-06-02 16:21:49 -07:00
John Ralls
f8045b2735 A wee bit of C++ style. 2018-06-02 16:21:05 -07:00
John Ralls
537fd995a3 Ensure full precision of doubles is saved to SQL.
std::iostream's operator<<(double) uses only 6 digits of precision
by default. We want 12 digits when saving.
2018-06-02 16:20:36 -07:00
John Ralls
9db60ca63c Make float database operations more consistent.
We don't use floats in GnuCash, we use doubles (and those as little as
possible), but dbd-sqlite3 is broken in that it stores only floats.
Simply casting floats to doubles introduces bogus additional digits
that can cause round-trip tests to fail. Instead convert floats to
doubles by multiplying by 10E6, rounding, then dividing by 10E6.
2018-06-02 16:16:41 -07:00
John Ralls
3e052e8dac [DBI Backend] Rework backup-table management.
Removes a public function, GncDbiSqlConnection::table_manage_backup that
should have been private in the first place.

Better encapsulates table renames and drops with private functions and
handles cases where there exist some primary tables and some backup tables.
2018-06-01 14:50:41 -07:00
John Ralls
e23769f078 [DBI Backend] If there's a set error value use that to set the backend error. 2018-06-01 14:13:11 -07:00
John Ralls
f504e39d78 Correct the type of error variables.
C++ doesn't like interchanging enums and ints.
2018-06-01 14:13:11 -07:00
John Ralls
464fdeeb26 [DBI Backend] Remove unused TableOpTypes. 2018-06-01 14:13:10 -07:00
John Ralls
74cbde2d4f normalize date formats the C++ way. 2018-05-28 08:56:01 -07:00
John Ralls
174752e28c Merge Bill Nottingham's 'bad-dates' into maint 2018-05-26 18:10:02 -07:00
John Ralls
aa08689371 Merge Paul Wassi's "Fix Permanent Storage" PR into maint. 2018-05-26 16:35:58 -07:00
John Ralls
243bf8afce Bug 796369 - Notes lost or perhaps just not displaying when using...
SQLite backend.

Release Note: This bug caused data loss if you saved your SQLite3
database to a different file or database.

The problem is that in SQLite3 (though not in MySQL or PgSQL) the
subquery ((SELECT DISTINCT guid FROM transactions)) (note the double
parentheses) returns only the first guid in the subquery's results.

Some transactions are loaded by special queries and those queries are
also used to retrieve the transaction's slots so they weren't affected.
2018-05-25 12:58:39 -07:00
John Ralls
5708707f6c Fix misplaced try block that caused unhandled exception if year out of range. 2018-05-25 09:19:12 -07:00
Paul Wassi
396c955fd5 Fix permanent storage of vendor details.
Since the data types did not match for the billterms and taxtable,
those references/guids were not saved to the database.
2018-05-25 01:56:14 +02:00
Geert Janssens
fcabf6bb96 A more detailed revision of gncEntry and gncInvoice related rounding
First change is to ensure gncEntry rounding is consistent. Internally
calculated values in the entry are never rounded. Consumers of
gncEntry's calculated values can request them either rounded or not.

Next use a pragmatical approach for calculating values on invoices based on
the entry values: do the rounding such that we never
create an unbalanced transaction while posting
That means
- round each entry's net value before summing them in net total
- accumulate all tax totals on invoice level per tax account before rounding
  and round before before summing them in a global tax total

Hopefully this will catch a few more rounding issues in this area.

A complete solution can only offered if we allow users to manually correct
tax entries. This requires changes to user interface and data format
so that's not going to happen in gnucash 3.x.
2018-05-24 18:53:15 +02:00
Bill Nottingham
8b1b25aee5 Modify date formatters to strip out certian specifiers.
strptime/strftime supports various modifiers to their parameters.

 'E' and 'O': alternate locale-specific formats
 (used in default format for Persian, Oriya, Azerbaijani)
 '-': padding
 (used in default format for Czech)

GnuCash passes dates as integer y/m/d without using locale-specific
formats, so we need to strip out 'E' and 'O' from the format when
scanning dates or determining separators in gnc-date.

None of '-', 'E', or 'O' are supported by boost (and '-' causes
errors), so strip them out from formatters in gnc-datetime as well.

See https://bugzilla.gnome.org/show_bug.cgi?id=795247.
2018-05-22 23:37:22 -04:00
Geert Janssens
2e8df1984a Improve rounding for invoice entry values
This will probably need more refinement because the multiplications
are still missing rounding methods, but the changes in this commit
will already allow guile code to correctly create entries.
2018-05-19 20:25:13 +02:00
Christopher Lam
97ab1b19fe test-date-utilities.scm: to SRFI64
Clearer syntax helped find flawed test - while set-tm:mday directly
accepts 1-31, set-tm:mon accepts 0-11 to represent 1-12, therefore
must minus 1. set-tm:year accepts 92 to represent 1992, therefore must
minus 1900.
2018-05-10 22:21:55 +08:00
Christopher Lam
13f31e0691 test-extras.scm: (logging-and) is obsolete
Use the much nicer SRFI-64 forms instead.
2018-05-10 22:21:55 +08:00
Christopher Lam
5e0fc04f7b test-extras.scm: remove dead code
These functions are never used through code.
2018-05-10 22:21:55 +08:00
Christopher Lam
c6032ac6ed srfi64-extras.scm: centralize (gnc:test-runner)
This is good enough to be used widely.
2018-05-10 13:19:03 +08:00
Christopher Lam
dda6730c44 utilities.scm: centralize and modernize addto!
(define-macro) is discouraged in most scheme forms. Change
to (define-syntax), and centralize common macro to utilities.scm
2018-05-10 13:19:03 +08:00
Christopher Lam
4a27285edd html-utilities.scm: new home (gnc:html-render-options-changed)
We want to sanitize render-options-changed, therefore it must return
an html-object. Unfortunately this is not accessible to
app-utils/options.scm. If we move this function to
report-system/html-utilities.scm, it can access html-objects.

Also rename it to gnc:html-render-options-changed
2018-05-10 13:19:03 +08:00
Geert Janssens
1f3cf845c4 Work around a conflict between gcc 8.0 and swig 3.0
The swig 3.0 generated python wrappers trigger a warning converted into an error issued
by gcc 8.0 for using strncpy as follows:
strncpy(buff, "swig_ptr: ", 10);
The reason is this call will truncate the trailing null byte from the string.
This appears to have been fixed in swig master already but that's not released yet
so let disable the warning when compiling the swig wrappers until it is.
2018-05-09 22:18:29 +02:00
gnucash-dev
8b3a874418 Fix typo 2018-05-04 10:04:52 -07:00
Geert Janssens
a9f35ed7ae Lowercase cmake commands
A huge bikeshed fest but it distracted me enough to do it anyway.
2018-05-03 23:18:15 +02:00
Geert Janssens
0c6b92959a Get metadata migration working again when upgrading from 2.6 to 3.1
Due to a typo the old GNC_DOT_DIR path was wrong
($HOME.gnucash instead of $HOME/.gnucash)
2018-04-30 20:59:25 +02:00
Geert Janssens
b761b5a0dc Bug 795377 - Reads and saves Gnucash 2.6.19 XML file, then can't reread it, due to bad date in old file
This commit contains another round of cleanups in the
timespec to time64 conversion. There were a number of
false assumptions that time64 = 0 would be a bad date
in the xml parser. This commit corrects enough of them to
eliminate the bug. Further cleanup is probably advised but
can be done at a later stage.
2018-04-28 12:19:28 +02:00
John Ralls
9c4469d039 Bug 795405 - All Dates in Price Database Off-By-One After 3.0 Upgrade
Also Bug 791825 - Accounting Period dates off by 1.
The DST start/end dates were reversed *and* the DST offset had the wrong
sign in Windows, resulting in the effective timezone always being one to
the west off (i.e. PDT was -9 and PST was -8).
2018-04-27 15:00:28 -07:00
John Ralls
83e993fb80 Add a TimeZoneProvider::dump().
Because gdb can't always see clearly inside m_zone_vector.
2018-04-27 14:16:49 -07:00
John Ralls
f6855bc0f8 Rename zone_vector to m_zone_vector.
To comply with coding spec.
2018-04-27 14:16:49 -07:00
Geert Janssens
d69cdaebf2 Add new test source to distribution list 2018-04-27 09:55:58 +02:00
Geert Janssens
74fd6e046b Add a few unit tests for qofquerycore 2018-04-26 23:06:36 +02:00
Geert Janssens
c71204628d Bug 795031 - 3.0 Crashes on loading when opening 2.6.19 file 2018-04-26 23:06:36 +02:00
Geert Janssens
4aadfbe636 Bug 795040 - GnuCash crashes when searching for a newly created bill 2018-04-26 23:06:35 +02:00
John Ralls
0106a771d0 Bug 795039 - Crash on startup using Technicolor Style sheet in report
Take 3: Catch encoding exceptions from trying to read a string into
Scheme using scm_from_utf8_string and try again using
scm_from_locale_string. If that throws too, give up and log a
warning.
2018-04-26 13:01:00 -07:00
John Ralls
c443160737 Fix Travis failures from transcoding fixes. 2018-04-23 14:02:24 -07:00
John Ralls
14c30344c2 Work around libstdc++ weirdness with codecvt destructor. 2018-04-22 16:51:01 -07:00
John Ralls
35cd165bec Bug 795134 - Improper handle of unicode character in username
Part 1: gnc-filename-utils didn't manage the encoding differences
between Windows (UTF16) and GLib (UTF-8).
2018-04-22 13:55:36 -07:00
Geert Janssens
451bbd53d9 Fix another date test
This may fix this crasher bug on windows:
https://bugzilla.gnome.org/show_bug.cgi?id=795040
However on linux it only fixes a warning so I can't be sure
until after the next nightly.
2018-04-18 19:07:30 +02:00
John Ralls
cad6bb4272 Bug 792105 - Startup takes several minutes, take two.
First, remove the unnecessary locale push & pop on <CT_TIME64>load.

Second, the registry accesses were caused by using g_win32_get_locale
to convert the Microsoft locale strings to POSIX ones. We don't care
what kind of string we get as long as we can pass it back to setlocale,
so remove that.

Third, gnc_push/pop_locale were used only in backend/dbi in a
very limited way and did much more than was necessary, so
convert them to C++ inlines in gnc-backend-dbi.hpp that does
only what we need them to.
2018-04-17 16:32:45 -07:00
John Ralls
39aecb7610 Bug 794936 - 3.0 does not open previously saved sqlite3 files...
properly - corrupted business data

Turned out to be a pointer/value mismatch between <CT_NUMERIC>load()
and most of the setter functions, so the address was getting set
as the value.
2018-04-17 16:32:44 -07:00
Geert Janssens
3138229cf6 A few whitespace fixups 2018-04-17 23:04:21 +02:00
Geert Janssens
06db9bcf2b Fix crash when loading sql book with posted transactions
This crash started to appear as of commit 80dbb9940b because the sequence
of split loading has changed as a result of the query optimizations.
Invoice transactions get loaded before the general transaction loading happens.
However because of this, when an invoice transaction was encountered again
during general transaction loading, it was (correctly) not created again
AND (incorrectly) not opened for subsequent editing. This caused
an assert to fail when the splits for this transaction are loaded
shortly afterwards. The solution is simply to ensure all transactions
are opened for editing during the general transaction loading call.
2018-04-17 23:04:21 +02:00
Geert Janssens
80dbb9940b Fix a couple of warnings introduced by commit 01420adb99
In addition make the code really use an inner join if no additional conditions are set
which gives better performance on at least postgresql
2018-04-17 19:45:39 +02:00
Geert Janssens
87f94abc8d Bug 794916 - Fails to find environment file at startup when installation prefix is '/opt' 2018-04-16 23:25:37 +02:00
John Ralls
40a266fc62 One more catch-by-value error. 2018-04-14 16:03:04 -07:00
John Ralls
4ba77f7b09 Remove another gnc_pop_locale(). 2018-04-14 13:11:23 -07:00
John Ralls
a04fd573ef Bug 792105 - Startup takes several minutes
set/get_locale are apparently very expensive on Mingw64, and setting
the C locale for extracting a string is unnecessary.

Unfortunately the released version of libdbi still uses strtod so
setting the C locale *is* still necessary for retrieving floats
and doubles and for passing queries.

Thanks to Mkubat for the diagnosis.
2018-04-14 12:38:04 -07:00
John Ralls
f680823dbf Bug 795039 - Crash on startup using Technicolor Style sheet in report
The mingw-w64 toolchain bizarrely substitutes scm_to_locale_string()
for scm_to_utf8_string(). This results in latin1 (yeah, "locale" is
a lie) instead of utf8 which causes an assertion in
g_utf8_collate_key().

Perhaps equally bizarre, the compiler doesn't make the substitution
with scm_to_utf8_stringn(), so use that instead.
2018-04-14 10:18:01 -07:00
John Ralls
01420adb99 Bug 772776 - VERY large queries (over 11000 fields in IN clause) slow...
down GnuCash

Replace with joins or subqueries. Affords a 20% speedup on Windows.
2018-04-14 10:18:01 -07:00
John Ralls
e90a662a20 Use subquery instead of instancevec GncSqlTransBackend::load_all. 2018-04-14 10:18:01 -07:00
John Ralls
b739661171 Remove functions marked G_UNUSED.
More noise reduction.
2018-04-14 10:18:01 -07:00
John Ralls
9b64357427 Remove LOAD_TRANSACTIONS_AS_NEEDED from SQL backend.
We're not ready for that and until we are it's just noise.
2018-04-14 10:18:01 -07:00
John Ralls
e4d0ad9dda Reduce use of gnc_sql_slots_load_for_instancevec. 2018-04-14 10:18:01 -07:00
Geert Janssens
dcfc1280bd Base invoice posted status on the presence of a posted transaction rather than a posted account
Bills and invoices that are posted and subsequently unposted again still store their
posted account internally as a convenience to the user (upon reposting the old
account will be offered by default) so it's not a reliable test for the posted state.
The posted transaction on the other hand is guaranteed to only exist when the invoice is
posted. This should fix a slew of small and perhaps larger side effects, such as
a posted bill still appearing as editable, critical warnings when creating new bills/invoices
and so on.
2018-04-14 18:46:26 +02:00
John Ralls
4a97269e4b Correct a g_log_level in test_gnc_pricedb_lookup_day. 2018-04-12 15:17:01 -07:00
John Ralls
85cc574d50 Prevent throw in gnc-pricedb.
If a price lookup is given an invalid time64/timespec (i.e. INT64_MAX)
then just return NULL instead of trying to find the nearest price.
2018-04-12 15:17:01 -07:00
John Ralls
16ba1e39b1 Bug 795080 - Some dates reset to 01/01/1970
An odd corner case: BST apparently came off of DST at 23:00 26 Oct 2014,
so midnight that day was ambiguous about being DST or not; that causes
the local_date_time constructor to throw in spite of the tm.is_dst element
being 0 (meaning pick standard time).

Instead of just failing in that case, try constructing a local_date_time
three hours later then adjust it back three hours. If *that* doesn't work
then throw a std::invalid argument.
2018-04-12 15:17:01 -07:00
John Ralls
c05aeb85ec Merge Bill Nottingham's exception type fix into unstable. 2018-04-09 15:12:56 -07:00
John Ralls
192a3c3d2b Set GNC_VCS at build time instead of when making the tarball.
Because the tarball is always made from a VCS repo.
2018-04-09 15:10:25 -07:00
John Ralls
7a0f0d57c8 Bug 782144 - git-master - Save Corrupts Data File / Not Open Data File
After much thrashing this turned out to be caused by a date string
with a 3-digit year and that caused an unexpected boost::bad_cast
exception from boost::posix_time::time_from_string().

To prevent that and anything like it, pre-parse the string with
regular expressions to classify them and split out the timezone
if there is one. If neither (perhaps eventually none) of the
regexes match throw std::invalid_argument. The C function will
catch this and return 0.
2018-04-08 17:37:39 -07:00
Bill Nottingham
434dd9520c Adjust catch syntax to avoid GCC8 warnings. 2018-04-03 22:02:44 -04:00
John Ralls
dc6d86efdb Convert to a two-digit version number. 2018-03-31 18:00:15 -07:00
John Ralls
f084fc67f7 Catch guid_syntax_exception in build_bayes. 2018-03-31 17:11:36 -07:00
Geert Janssens
4053f2ca53 Fix read and write of business counters and counter_formats
These are book options, but not stored under the default options frame (sigh)
So add exception code to properly access them.
2018-03-31 18:27:43 +02:00
Geert Janssens
d6a5cc9feb Merge branch 'imap-editor-fix' of https://github.com/Bob-IT/gnucash into unstable 2018-03-31 17:09:45 +02:00
Christopher Lam
f910d931f7 gncInvoice: complete removal gncInvoiceDateExists 2018-03-31 05:35:49 +08:00
Christopher Lam
b99dee1736 Replace gncInvoiceDateExists to gncInvoiceIsPosted
This commit partially reverts commit 862956a760 which exported
gncInvoiceDateExists. Remove this API and use gncInvoiceIsPosted
instead.
2018-03-31 05:35:49 +08:00
John Ralls
a23f103ebb Bug 794730 - SIGSEGV when entering an exchange rate, Part 2
91f4b19 changed the test for gncInvoiceDateExists from date != 0
to date != INT64_MAX, which isn't backwards compatible, so test
for both. But the submitted file had a posted date of -1 so
gncInvoiceIsPosted returned true anyway. That's not consistent with
the logic in dialog-invoice.c, which checked gncInvoicePostedAcc != NULL,
a better test. The result was that the "Post" button lit up but
gncInvoicePost returned immediately, doing nothing, so change
gncInvoiceIsPosted to use gncInvoicePostedAcc instead.
2018-03-30 11:19:51 -07:00
Geert Janssens
7271ce3dee Add feature kvp frame to the dbi test file 2018-03-30 19:02:57 +02:00
Geert Janssens
152277274f Fix slot loading in sql backend
Be smarter about what is path and key for each slot.
Instead of assuming a slash is always a path separator (first attempt
on unstable) or never a separator (second attempt),
track the parent path while loading kvp slots from the db
and deduce the slot's name by substracting this parent path.
2018-03-30 19:02:57 +02:00
Robert Fewell
255d7194d8 Fix the gtests for the changes made to ImapInfo structure 2018-03-29 17:57:24 +01:00
Robert Fewell
6c43c3afe0 Fix Imap Editor to reflect the changes in kvp paths
There were several problems that broke the Imap Editor that have been
fixed due to kvp changes. The import-map-bayes entries were being added
to the tree view based on the number token entries squared. Retrieving
import-map entries resulted in an empty list and also deleting entries
from the tree view failed.
2018-03-29 17:32:57 +01:00
John Ralls
dedb5265f0 Merge branch 'maint' into unstable 2018-03-25 09:36:21 -07:00
Robert Fewell
f1dd8cfaf1 Component not found error when accounts are deleted
When accounts are deleted that have an open register window a component
not found error is triggered. After the account is destroyed, a call to
'gnc_resume_gui_refresh' calls 'gnc_gui_refresh_internal' and this then
calls 'find_component_ids_by_class' which is used in order resulting in
'register-single' being unregistered before 'GncPluginPageRegister' and
hence 'ld' being freed but the register not knowing this. Reversing the
list fixes this.
2018-03-21 13:11:39 +00:00
luc14n0
a893a632e9 Add COMPILE_GSCHEMAS to allow disabling gschemas compilation 2018-03-18 12:30:13 -07:00
John Ralls
4ecd9c2dd4 Fix the Python Console for Python3.
Replacing libgncmod-python, libgncmod-core-utils-python, and
libgncmod-app-utils-python with _sw_core_utils and _sw_app_utils.
The latter two are the modules that init.py wants to load and with
Python3 Swig appears to no longer make them available via libgncmod.

Note that there may still be some problems with actually using the
console, but it at least loads at startup without complaint.
2018-03-18 11:59:13 -07:00
John Ralls
1f7edb23f6 Merge Bob Fewell's assorted GUI fixups PR 310 into unstable.
Although the PR was titled "Some [fixes] for missing transient parent
warnings", it actually has a bugfix and an assorted collection of
GUI cleanups that happen to include a couple of transient-parent fixes.
2018-03-17 16:04:17 -07:00
John Ralls
8fe2cb6fa8 Fix date corruption in SQL load.
Four date elements were affected: GncEntry::date, GncEntry::date_entered,
GncInvoice::opened, and GncInvoice::posted. The problem arose during the
cleansing of Timespec from the reports; the setter functions for those
elements were converted to time64 but no provision was made to the SQL
backend to pass them time64 instead of Timespec*.

This commit adds a new column type, CT_TIME64, and changes the column
types for those elements to CT_TIME64.
2018-03-16 16:47:11 -07:00
John Ralls
e5561bd7ab Fix lost Bayesian matches in SQL backend.
The import-map-bayes uses a three-part key that uses the same delimiter
as a path and the SQL backend was throwing away everything except the
account guid.

Added more slot types including import-map-bayes ones to the test xml
file to help debug this and to catch it in the future.

Also don't pass std::string.c_str() to a std::vector<std::string>
constructor, just pass the string.
2018-03-16 13:59:04 -07:00
John Ralls
74d94650ed Avoid crash when committing a date outside of the valid range
Insert a NULL in its place.
2018-03-15 16:28:01 -07:00
fell
9b8901248c Merge branch 'maint' into unstable 2018-03-15 18:12:03 +01:00
Robert Fewell
28b2e732ab When doing a file save from the a new start we have no key file
Test for Key_file not being NULL before trying to free it.
2018-03-12 06:48:01 +00:00
fell
fdfa6f528c Merge branch 'maint' into unstable 2018-03-10 11:06:59 +01:00
John Ralls
867fdce4e4 Gcc-4.8 doesn't have std::codecvt.
Use boost::locale::conv::utf_to_utf instead.
2018-03-09 16:28:00 -08:00
John Ralls
c3180ab374 Operator << fix. 2018-03-09 13:07:29 -08:00
John Ralls
5520fae838 Bug 793941 - 2.7.4: test failure on i686: 59 - test-gnc-timezone
Don't test before 1916, that's not a common GnuCash use-case.
2018-03-06 09:56:13 -08:00
John Ralls
36d729652b Speed up GUID equality comparison. 2018-03-06 09:48:38 -08:00
Geert Janssens
30fb1dc479 Merge branch 'unstable-bugfix' of https://github.com/christopherlam/gnucash into unstable 2018-03-05 16:57:00 +01:00
Geert Janssens
e2d69b174e Merge branch 'master' of https://github.com/nielsegberts/gnucash into unstable 2018-03-05 16:54:24 +01:00
Christopher Lam
551e98435d remove begindate in qofquery
This was producing a date corresponding to 01-01-1970. make-zdate was
being used in aging.scm as a hack to search all splits prior to
end-date. fix the date query logic to set begin-date match to #f.
2018-03-05 11:12:13 +08:00
Christopher Lam
4f98391a27 test-TR: unit tests
initial attempt
2018-03-01 20:55:17 +08:00
Christopher Lam
8fef1adcc4 date-utilities: bugfix weekly render
This was introduced by 48bdab3.
2018-03-01 12:14:53 +08:00
Niels
7ef8e6d489 Fix fall through in Account.cpp
Found with -Wimplicit-fallthrough, but older versions of GCC don't support it. So it will take some effort to add it to the build config.

I think it did not result in a reproducible bug.
2018-02-28 22:23:15 +00:00
Christopher Lam
d8d552ee8a options.scm: tidy (gnc:render-options-changed)
This small change introduces \n into the HTML render.
2018-03-01 05:30:48 +08:00
Geert Janssens
ad1664604f Cleanup namespace usage for boost::locale
In a previous commit I wrongly believed xgettext might not find
our strings if we used the fully namespaced boost::locale::translate or
aliased bl::translate instead of just translate. However that's
wrong, so I have changed the code to always use bl::translate.
2018-02-28 16:50:20 +01:00
Geert Janssens
c29b9c9cbf Remove autotools-only path exception to find reports
With it we can also remove the hack to find standard reports while running
from the build tree.
2018-02-28 12:08:37 +01:00
Geert Janssens
72a48c0884 Improve config and app data migration to handle renaming of config<version>.user to config-user.scm on all platforms 2018-02-26 18:58:22 +01:00
John Ralls
d4476d06b4 Block events while creating scheduled transactions.
Events update the UI, which is slow, and if there are a lot of SXes
because it's an old file that can be significant.
2018-02-24 13:02:50 -08:00
Geert Janssens
10ab87d95c Make travis happy
On older stdlibc++ the default constructor of a stringstream is deleted.
2018-02-24 21:36:39 +01:00
Geert Janssens
61a21d12c6 Look for user editable config files in gnc_userconfig_dir instead of gnc_userdata_dir
At present these are
- log.conf
- config-user.scm (previously config.user-2.0)

Implement one-time migration of these files to the proper directory if they previously exist
Look for a log.conf file in gnc_userconfig_dir instead of gnc_userdata_dir

Note this commit also uses boost::locale::translate for the first time.
We may need to fine-tune our use, but in the current state strings marked
for translation using that function are already picked up for gnucash.pot.
2018-02-24 20:39:26 +01:00
John Ralls
765c117aac Optimize GncDateTime string constructor.
Turns out the stream facet parser is really slow. Since we have a
well-constrained universe of input formats we don't really need that
overhead. This got a 33% improvement in loading a large SQLite database.
2018-02-24 11:12:13 -08:00
Geert Janssens
e186d77a16 Merge branch 'unstable-prepare-SRFI64' of https://github.com/christopherlam/gnucash into unstable 2018-02-23 11:48:42 +01:00
Christopher Lam
f7378e9332 TR & options: upgrade HTML to XHTML
Upgrade <br> tags to <br /> to allow well-formed XML parsing.
2018-02-23 18:19:59 +08:00
Andreas Müller
128fce3ed8 Bug 787095 - Gnucash Crashes when opening old XML file 2018-02-22 15:59:12 -08:00
John Ralls
bab3bc7e93 Merge Bob Fewell's "Cache a couple of split register preferences...
into unstable
2018-02-22 15:53:30 -08:00
John Ralls
a4399ee732 Bug 792157 - Cannot create account with different currency
Restore force-insert logic that had gotten lost in the C++ conversion.
2018-02-20 17:32:22 -08:00
Robert Fewell
955696b0e7 Cache a couple of split register preferences
Two preferences were being used heavily in the drawing of the register
so it makes sense for them to be saved in the split_register structure
so they can be easily be referenced.
2018-02-21 00:54:49 +00:00
John Ralls
78705dc8be Bug 792833 - User specifies source of 'num' field'; either...
transaction number or split action (requires at least GnuCash 2.5.0)

Strip leading delimiters from KVP keys when reading them from the
database. Leading delimiters are incorrectly included in databases
created with GnuCash 2.6.x.
2018-02-20 12:02:38 -08:00
Geert Janssens
50e2a3def7 Use a platform dependent package name for gnc_user[config|data]_dir
Windows and OS X expect the directory name to be capitalized while linux typically uses an all-lowercase name.
2018-02-19 22:53:32 +01:00
John Ralls
36ad5064e4 Move gnc:substring-replace-from-to back to utilities.scm
It's used in report.scm as well as qif-imp.
2018-02-19 13:27:44 -08:00
John Ralls
9865934410 Reduce warning about failing to dlopen a module to debug.
There's another warning for runtime about not being able to load
a specified module and this one creates a lot of noise during a parallel
build.
2018-02-19 12:27:59 -08:00
Geert Janssens
62fd179f87 Adjust gnc_userconfig_dir and get_userconfig_home to the former returns a subdirectory of the latter
Also add a few comments to make the distinction more clear.
2018-02-19 20:31:51 +01:00
Geert Janssens
27256357f5 Merge branch 'BUG792809' of https://github.com/Bob-IT/gnucash into unstable 2018-02-19 20:31:33 +01:00
John Ralls
5929bb3bf8 Move string.scm to qif-imp, the only place it's used. 2018-02-19 11:25:08 -08:00
John Ralls
4ad2359872 Remove unused functions from utilities.scm
moving safe-strcmp to aging.scm, it's sole use.
2018-02-19 11:10:14 -08:00
John Ralls
720acddff2 Restore fin.scm, incorrectly removed earlier.
But put it in app-utils where it's used and load it explicitly.
2018-02-19 10:50:38 -08:00
fell
464281644c Merge branch 'maint' into unstable
Should resolve issue mentioned in PR #277
Conflicts:
	libgnucash/app-utils/gnc-sx-instance-model.c: resolved
	po/de.po: changes in maint ignored
2018-02-19 15:25:53 +01:00
John Ralls
f4965ae2ac Move direct check dependencies to the originating CMakeLists.txt.
Removing transitive dependencies from being declared direct.
2018-02-18 22:16:27 -08:00
John Ralls
605f3466cb Rename the gnc-module test libraries to be consistent with other modules. 2018-02-18 16:07:25 -08:00
John Ralls
a5f46a5e45 More Scheme dependency additions. 2018-02-18 15:59:00 -08:00
Robert Fewell
b2ed250db1 Change gsettings upgrade test so old_maj_min is < 207
With the original value of 208, the use-gnucash-color-theme kept on
being reset to what ever the use-theme-colors was, by default false.
2018-02-18 22:41:39 +00:00
Robert Fewell
7c9ac17cb6 Move the user CSS settings file
Move the CSS settings file to a location based on XDG_CONFIG_HOME which
is OS dependant but with slight changes for Windows and OS X.

- Windows: CSIDL_APPDATA/Gnucash
- OS X: $HOME/Application Support/Gnucash
- Linux: $XDG_CONFIG_HOME/gnucash (or the default $HOME/.config/gnucash)
2018-02-18 22:40:45 +00:00
John Ralls
48bdab38d4 Replace sprintf with Guile's built-in format. 2018-02-17 15:24:44 -08:00
Geert Janssens
e3cd9f88c9 Merge branch 'unstable-TR-progress' of https://github.com/christopherlam/gnucash into unstable 2018-02-17 23:22:23 +01:00
Geert Janssens
07c3162a73 Fix a few leftovers from work on main.scm
- Load proper file in gnucash-bin.c
- Load string.scm (now in gnucash subdir) to make reports and qif-import work again
2018-02-17 21:09:07 +01:00
Geert Janssens
de4b72dc11 Drop install rule for previously removed (scm) config file 2018-02-17 20:09:36 +01:00
Christopher Lam
b261eb18b3 Revert options.scm lookup-options renaming
and use (gnc:error) as advised
2018-02-17 08:17:01 +08:00
Christopher Lam
276a7d24d2 REWRITE income-gst-statement.scm
This commit rewrites income-gst-statement.scm to be a derivation
of transaction.scm, modifying the options database and passing
custom arguments to the trep-renderer.

This should hopefully reduce risk of errors.
2018-02-17 08:17:01 +08:00
Christopher Lam
88b3446299 ADD-API: gnc:option-make-internal!, gnc:unregister-option
This commit adds 2 additional helper calls, primarily useful for
derived reports.

gnc:option-make-internal! will hide an existing option. e.g.
a derived report can set the value for a Display/* option and
hide it from the user.

gnc:unregister-option will unregister option. This is primarily
useful for derived options e.g. another report copies from
transaction.scm and removes some options and recreates them with
different parameters.

For example, unregister existing option from section "Accounts"
name "Accounts", and recreate with different parameters e.g.
limited account types.
2018-02-17 08:16:23 +08:00
Christopher Lam
12f3099f59 (infobox)->(gnc:render-options-changed) in options.scm
This commit will change (infobox) to a general-purpose
renderer for "all options changed by user" in options.scm
and can be inserted into any report. It reduces the
number of strings required.
2018-02-17 08:16:23 +08:00
John Ralls
cd8f2b7c7e Rename libgnucash/scm/main.scm to utilities.scm
Because it hasn't been "main" since GnuCash became a C program.
2018-02-16 15:52:19 -08:00
John Ralls
32f6958ebb We're done modularizing. About 16 years ago. 2018-02-16 15:41:47 -08:00
John Ralls
8b0d9425e9 Remove some obsolete and unused Scheme files. 2018-02-16 15:37:46 -08:00
John Ralls
26e51339a6 Rework the Scheme target dependencies.
Should fix Bug 793122 - 2.7.3: ninja build fails
along with the nagging parallel-build problems.
2018-02-16 14:28:46 -08:00
John Ralls
04408650c1 Fix double free, caused test to crash on Mac. 2018-02-15 11:04:15 -08:00
John Ralls
6b49b3ba4c Bug 792763 - deleting a transaction can cause a SIGSEGV
Prevent a NULL transaction from crashing xaccTransCountSplits and
prevent gnc_plugin_business_update_menus from calling it with a
NULL transaction.
2018-02-02 13:05:20 -08:00
Geert Janssens
59fb8efaf9 Merge branch 'maint' into unstable 2018-02-02 18:57:24 +01:00
Geert Janssens
0d4f6e054d Improve gnc_data_home verification and creation
- Don't attempt to create a subdirectory of a non-existing home directory (use tmpdir as base directory in that case)
- Make sure all tests run in an environment with GNC_BUILDDIR and GNC_UNINSTALLED set. Otherwise
  the one-shot old .gnucash to new GNC_DATA_HOME migration may already have run at build time,
  preventing us from informing the user a run time.
- Re-enable the userdata-dir with invalid home test (linux only).
2018-02-02 10:24:04 +01:00
Geert Janssens
0f5bb35166 Disable the proper test... 2018-02-01 22:31:27 +01:00
Geert Janssens
90517b69ce Temporarily disable test that breaks on travis only
It needs some more tweaking to cope with the false
assumption the builder can't create a temporary directory on /
2018-02-01 20:43:49 +01:00
Geert Janssens
2f16b092f5 Simplify filepath init code
It will no longer attempt to use /home/janssege/.gnucash. That was
requiring lots of extra conditions.
It will also default to a base directory (gnc_data_home) in the
build dir if it detects the code is run during building or testing.
That again allows to simplify it as there's no need for temp dir
juggling in case the build environment doesn't have a writable home dir.
2018-02-01 19:17:17 +01:00
Geert Janssens
3c13f565d3 Merge branch 'unstable-fix-business-reports' of https://github.com/christopherlam/gnucash into unstable 2018-01-31 18:44:04 +01:00
Geert Janssens
ff24970f5f Add GENERATE_SWIG_WRAPPERS option to control the generation of swig wrappers independently of whether we're building from git
The swig wrappers don't really depend on git (but rather on swig) and there can be
situations the builder wants to generate the wrappers also from a tar ball.
2018-01-31 16:16:59 +01:00
Christopher Lam
862956a760 BUGFIX: invoice posted-date is no longer 0 for unposted invoices
This commit fixes business reports caused by 91f4b19039
whereby the posted-date for unposted invoice was changed
from 0 to MAXINT. Now we need to use (gncInvoiceIsPosted)
or (gncInvoiceDateExists) instead.
2018-01-30 19:29:04 +08:00
Geert Janssens
49a936c1fd Rewrite gnc_add_swig_guile_command to work in dist tarball as well
When building from git it will add targets to generate the swig files.
When building from tarball it will just point at the generated source
files from the tarball.
2018-01-29 19:46:44 +01:00
Geert Janssens
36cb167b68 Rewrite gnc_add_swig_python_command to work in dist tarball as well
When building from git it will add targets to generate the swig files.
When building from tarball it will just point at the generated source
files from the tarball.
2018-01-29 19:46:44 +01:00
Geert Janssens
ec213360f3 Review which built files are really needed in the dist tarball
Several were only there because they used to be generated via autogen.sh
and hence had to be included because autogen.sh was not supposed to be run
in a tarball based build.
A few others aren't clear so I have left them in for now:
- gnucash.1 (man page)
- gnucash-design.info (because it's unclear what we want to do with that one)

These files should clearly be in the tarball:
- gnucash.pot -> for our translators
- ChangeLog -> can't be generated outside of a git repo
- gnc-vcs-info.h -> can't be generated outside of a git repo
- guile/python bindings -> to avoid a swig dependency when building from tarball
2018-01-29 19:46:44 +01:00
Geert Janssens
4317d8a8f6 Improve handling of generated distributable files
- the two dist_add_... macros now both take a list of file names
as argument so more files can be added at once to the dist tarball.
- dist_add_generated now creates the right target by itself. There's
  no need to pass one any more
- make the swig generated *.py module files explicit output files
- change a couple of custom_targets into custom_commands. The only
  reason they were defined as targets was to ensure they got built
  before the dist tarball. This is now properly handled by the
  dist_add_... macros.
- correctly handle dependency on swig-runtime.h (using OBJECT_DEPENDS
  was not the way to do it according to that property's help page)
2018-01-29 19:46:44 +01:00
Geert Janssens
3dff4e5211 Fix make dist on a clean checkout
cmake with unix makefiles fails to resolve dist dependencies
added from COPY_FROM_BUILD if these dependencies aren't built yet.

This commit replaces the COPY_FROM_BUILD based logic with two new functions
'dist_add_configured' and 'dist_add_generated' to indicate which files should
be included in the dist tarball. The latter also adds a target level dependency
to the dist tarball custom command. Hence the former should
be used for files that get generated during a cmake run while the latter
should be used for files generated as the result of a 'make/ninja-build' run
(like files for which an add_custom_command rule exists).

Note: this commit also temporarily disables the dist target when building
from a tarball (and hence it won't be tested in distcheck either). This
will be handled in a future commit.
2018-01-29 19:46:44 +01:00
Geert Janssens
18feaa16a7 Remove support code to load qof backend in autotools based build environment 2018-01-26 18:26:06 +01:00
Geert Janssens
00396db560 Remove the .in extension from test-real-data.sh and stop configuring it for autotools
We have dropped support for autotools and cmake invokes this script using /bin/bash <script>
So the exact shebang value is not relevant any more
2018-01-26 18:26:06 +01:00
Geert Janssens
0f4a72b49f Remove unused file 2018-01-26 18:26:06 +01:00
Geert Janssens
85bfbd8e82 Some minor cleanups after the autotools removal
This includes removal of the now unused make-gnucash-potfiles.in,
checking for CMakeLists.txt rather than Makefile.am in gnc-vcs-info,
upating the HACKING file,
and generally updating references to autotools.

I have kept "Makefile.*" exclude patterns in our CMakeLists.txt files
because they may still be lingering in the source directory from
previous autogen.sh runs. At some point these should probably be
removed as well still, together with the gitignore references to them.
2018-01-26 18:22:48 +01:00
John Ralls
43ad7accda Remove stray addition from 34cc103e94. 2018-01-25 14:17:23 -08:00
John Ralls
a7cfedb9dd Remove overview links to nonexistant articles. 2018-01-25 13:45:02 -08:00
John Ralls
34cc103e94 Add doxygen target. 2018-01-25 13:45:02 -08:00
Geert Janssens
52b0c06d30 Merge branch 'maint' into unstable
Conflicts:
- gnucash/gnome-utils/gnc-main-window.c
  I have chosen to ignore the changes pulled in from maint. The same change will
  be reimplemented in a followup commit.
- po/ru.po
  Same here. The translation conflicted too much and there's a
  translation update available for unstable I will pull in soon.
2018-01-25 10:24:53 +01:00