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.
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.
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.
- 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).
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.
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.
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.
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.
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.
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
- 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)
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.
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.
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.
Thanks to Robert Merkel for reporting them.
* Build gnucash-design.info if makeinfo is available, but don't complain
if it isn't.
* Fail Cmake if LibXSLT and xsltproc aren't found. Those are required to
build the gschemas and GnuCash won't work without them.
* Fix the WebKit detection so that it isn't faked out into thinking it has
WebKit2Gtk-4.0 when it's WebKit2Gtk-3.0 and cmake is run with a
CMakeCache.txt present.
Resolved conflicts:
gnucash/gnome-search/dialog-search.c
gnucash/gnome-utils/gnc-splash.c
gnucash/import-export/aqb/gnc-plugin-aqbanking.c
gnucash/import-export/import-account-matcher.c
po/de.po
src/report/standard-reports/budget-barchart.scm
src/report/standard-reports/budget.scm
Note the de.po conflict was resolved by dropping all changes
and merging the file again with gnucash.pot (generated after
the merge but before committing).
GLib's scribbling of freed memory is enabled on Arch so attempting to
read the deleted members of inst and book crash instead of reaturning
invalid results. These weren't really useful tests anyway.
The first attempt to fix this, a17bc85a, doesn't work because the
boost::date_time constructor gets enough information in most cases to
generate a date, just not the one we expect. This change looks for '-' in
the fourth position and if it's there assumes iso-extended format, otherwise
it assumes delimiter-less ISO without the 'T', i.e. %Y%m%d%H%M%S.
This commit adds a compatibiliy shim. Although the rest of gnucash
can be converted to time64, this shim allows a Gnucash session to
load reports saved with timepairs.
This change will fix 'num-of-weeks-since-1/jan/1970' which formerly used quotient to remove
the fractional part of the division. For negative values of num-of-weeks, the number is truncated
in the wrong direction (i.e. towards 0). This change uses floor instead to ensure the num-of-weeks
found is the nearest integer LESS than the fractional number.
Set a feature to prevent versions older that 2.6.20 from loading a
database from which they cannot read the dates. Ideally we would do this
only if the database is written to, but the current persistence design
includes committing back to the database during the load so the net
effect is that the flag would be set anyway.
This allows direct conversion between Scheme numbers and gnc_numeric
without the performance or accuracy penalties arising from using doubles
as an intermediary.
This commit introduces a new feature flag:
GNC_FEATURE_GUID_FLAT_BAYESIAN. It signifies that the bayes import map
data are stored flat and by guid. Any time bayes import map data are
accessed, they are converted if necessary.
We need to allocate enough space for the terminating null character.
Also, I double-checked the documents for std::basic_string::c_str () and
verified that it does guarantee the terminating null, so I put a comment
in the code that depends on that.
Before, it was necessary to remove '/' from tokens so that they won't be
divided up within kvp. Now that kvp doesn't parse tokens, it's okay to
pass '/', and it's better not to translate user-provided tokens if at all
possible.
The conversion assumed there were only three levels to bayes import
map kvp: IMAP token, user-supplied token, GUID/account name. In
actuality, since user-supplied tokens could have the delimiter in them,
there could be several. This fix takes that into account like so:
IMAP token, potentially several user-supplied tokens, GUID/account name.
The import map is undergoing two conversions at the same time: account names
to guids and an hierarchical representation to a flat representation in KVP.
The bayes data are stored in the KVP store. Before this commit, they are
stored under /import-map-bayes/<token>/<account guid>/count (where count
is the datum that "matters" in bayes matching).
The problem with this is that any token including the kvp delimiter
(currently '/') gets divided, and is not found correctly during bayes
kvp searching. The quickest solution to this is to replace all "/"
characters with some other character. That has been done, along with a
re-structuring of the bayes matching code to take advantage of c++
features to make the code more concise and readable.
Also modified some test functions to fix leaks and double-frees: the
same kvp value can't be in the kvp tree twice.
Also, when I added code to clean up after the tests, some things started
breaking due to double-delete. Apparently const_cast was hiding some
programming errors. Really? You don't say? When giving a GUID* to KvpValue,
the latter takes ownership of the former.
The nested representation was very noisy. Now, the string representation
shows one line per value with the full prefix which is also more
expressive than the old version.
The template avoids the need to cast to and from void*, and adds flexibility to
the targeted function's signature.
test-stuff.h defines a macro, "failure" which is used as an identifier
in the standard IO library, so I moved any inclusion of test-stuff.h to
the last include position so that "failure" wouldn't be defined before
the IO library was included.
Since Account.c is now Account.cpp, the function signatures look a bit
different internally. The tests rely on function signatures in error
messages. Instead of trying to figure out what the exact
function signature might be, I use a substring matching strategy to
ensure that the correct error was issued.
The preference schema migration collects all schema mutations that can occur
when upgrading to a newer gnucash version. The old gconf to gsettings conversion is
integrated in this system as well. Newer schema mutations will happen based on version
number upgrades though.
The preference that got replaced is "use-theme-colors". Based on discussion in bug 746163
(https://bugzilla.gnome.org/show_bug.cgi?id=746163) and gnucash-docs PR#105
(https://github.com/Gnucash/gnucash-docs/pull/105) this has been replaced with
"use-gnucash-color-theme" with inverted meaning. The old option is kept around for one or
two major release cycles to allow seamless conversion.
Sets paths for finding componenents depending on the state of ENABLE_BINRELOC,
GNC_UNINSTALLED, GNC_BUILDDIR and whether any install paths have been set
outside of CMAKE_INSTALL_PREFIX.
GNUInstallDirs changes the name of CMAKE_INSTALL_LIBDIR depending on the
operating system and distro. When CMAKE_INSTALL_PREFIX is /usr,
/usr/local, or any subdirectory of /opt it also changes
CMAKE_INSTALL_FULL_SYSCONFDIR to /etc. An earlier commit by Aaron Laws
mirrors the name of CMAKE_INSTALL_LIBDIR to the build library directory.
It's possible for builders to set any of the install directories
anywhere they please.
Setting any directory outside of CMAKE_INSTALL_PREFIX breaks Binreloc so
the toplevel CMakeLists.txt now detects that and disables Binreloc.
If Binreloc is enabled then all path queries use it to find paths. This
works in the build directory because the gnucash executable and all of
the test programs are in build_directory/bin and LIBDIR, DATADIR, and
SYSCONFDIR can be found in the same root path.
If Binreloc is disabled then in order to build or run programs from the
build directory one must set GNC_UNINSTALLED and set GNC_BUILDDIR to the
absolute path of the build directory. When those are set GNC_BUILDDIR
replaces CMAKE_INSTALL_PREFIX in all paths that are subdirectories of
CMAKE_INSTALL_PREFIX; paths that are not in CMAKE_INSTALL_PREFIX are
appended whole to GNC_BUILDDIR. This process is constent between CMake
and gnc_path_get_foo. GnuCash is unlikely to run from a DESTDIR without
Binreloc.
Only string values should be quoted in queries; in particular NULL
isn't a string value and must not be quoted.
Note that this is a less than perfect solution because it doesn't use
the Database's quoting function and so doesn't escape quotes, linefeeds,
or carriage returns inside the string. That's because the SQL generating
logic is independent of the connection class and can't easily get to it.
Wherin the problem is that MySQL's TIMESTAMP has a date range of
1970-01-01 00:00:01 to 2038-01-19 03:14:07 and is unable to handle
time_t of 0. MySQL's TIMESTAMP also assumes that input is in the server's
timezone and adjusts it to UTC. GnuCash has already done that conversion.
For each subclass, getting rid of GNC_SQL_OBJECT_BACKEND_VERSION which
was a bit misguided.
Also remove the bogus test the skipped loading a table if its version
didn't match GNC_SQL_OBJECT_BACKEND_VERSION which was even more misguided.
I.e., remove the shell invocation and with it the need to set the shebang.
Surprisingly this required some build-system modifications particularly
for cmake in order to correctly set the environment.
There seems to be more than one problem that causes the exception handler ("catch") to
get lost on Windows:
* Throwing from a constructor called from a member function of another object of the same
class. That's fixed here for the GncNumeric string constructor, but there's at least one other
instance I'm still working on in GncNumeric::to_decimal.
* Hidden memory allocation in a stack-allocated object like std::string, std::istringstream,
or boost::smatch: The throw causes the object to go out of scope which calls its destructor
and in that case the catch reference is either lost or never compiled in.
This change ifdefs out the creation of detailed exception messages on Windows to avoid
the destruction of the std::istringstream and its attached std::string, creates a series of
helper functions to ensure that the boost::smatch is in a non-throwing scope, and puts the
computed values directly into the member variables instead of delegating the construction
to a temporary and then copying out the values. The last item is more correct anyway, as
C++ constructor delegation is supposed to happen in the member initialization part rather
than the function body.
With these changes the exceptions from the GncNumeric string constructor are handled
correctly.
This will avoid a ninja-build from picking up a config.h generated by the autotools build
(in the root build directory). Picking up the wrong config.h may lead to all kinds of
subtle issues if the autotools run was done with different options than the cmake run.
The reconcile account dialog always displays a value of 0.00 as the
Ending Balance, regardless of account and statement date.
This is caused by function xaccAccountGetReconcilePostponeBalance
returning the wrong value, returning TRUE when it should return FALSE,
and setting balance to the default {0,1}.
The code uses bal.denom!=0 as an indicator that a valid balance was
received in variable v. However, bal is initialized to {0,1}
making the test always true even when we didn't receive a valid
value in variable v.
Thus, this function returns TRUE with *balance={0,1} when no valid
balance was found in "reconcile-info/postpone/balance".
This patch fixes the function to return FALSE if v doesn't hold
a valid value or if bal.denom is set to 0.
gtk-mac-bundler can't access the executable's rpath list so it can't
follow dependencies if they're not in $install_dir/lib from @rpath.
Autotools always sets absolute path install names so this should have no
adverse affects on other Mac builds.
This effectively replaces the use of GNUCASH_BUILD_DATE with GNUCASH_SCM_REV_DATE.
The latter is extracted from the current commit if building from some kind of vcs
(currently only works correctly for svn and git). The info extracted while building
from vcs is then also added to the dist tarball so it's available when building
from tarball as well (via the file libgnucash/core-utils/gnc-vcs-info.h).
The same date is also used to set the date in gnucash' man page document.
A practical detail: I have changed the substitution variables in the man page template
from @- -@ to ${} so we could leverage CONFIGURE_FILE in cmake. The necessary
related adjustments have also been made to Makefile.am's substitution rules.
userdata_home is a different directory on each platform we support (default /home/janssege/.local/share on linux for example)
and gnc_userdata_home is normally userdata_home/GnuCash.
These directories may not always exist (yet) in all circumstances, so properly handle
all of these possible situations.
- have gnc_validate_directory throw as well in case of a missing directory
that it shouldn't create. This allows to remove 3 other throws
- slightly adjust the error message in case of missing directory
- never migrate when the final directory is a temporary (sub)directory
Instead of building libgncmod-app-utils-python as a stand-alone library
because gncmod-app-utils.c can be compiled only with guile thanks to
declaring scm_init_sw_app_utils_module. Linux linkers will just mark it
'U' but the MacOS linker errors out.
The utf8 conversion is only used in the Windows specific section so there's no
need to define an overloaded function on std::string in this case.
Also CMakeLists.txt doesn't require the MingW specific library name setting
for boost::filesystem. Just removing the hardcoded one allows the build to
pick the right name up from the Boost_LIBRARIES variable.
This latter file can be created by the administrator next to the environment
file in order to override parameters set in environment file.
The reason for this is the environment file is always overwritten
during installation, while environment.local is never touched by
the installers. So making the changes in there ensures they persist
acros gnucash updates.
- Linux: use whatever the xdg spec dictates
- Windows: use AppData(Roaming)
- OS X/Quarz: use NSApplicationSupportDirectory special directory, which
typically resolves to $HOME/Library/Application Support
If the preferred directory can't be used the code will fallback to
$HOME/.gnucash (the old location) if it exists. It won't create it
however. Instead if missing it will fall back to the platform's
temporary directory.
Code is added also to automatically migrate all data from the old
location to the new (only the first time).
Instead of using the more generic string constructor. The struct tm
constructor is several times faster and this change speeds up
transaction loading by 2x.
Setting a feature writes to KVP which in the SQL backend causes the book
to be written out, which is rather expensive. Doing this in a loop (as
is the case in convert_imap_account, is quite slow, and this change
afforded a 4x speedup.
There are now options to specify which commodities to remove prices
from as well as options to leave none or the last one for the week,
month, Quarter, year and a scaled option.
cmake:
- add test-app-utils
- rename test-link-module to test-link-module-app-utils
- add gtest-import-map
autotools:
- move gtest-import-map from TEST_PROGS to TESTS (autotools) so it shows up in the colored results list
It is split into
- /libgnucash (for the non-gui bits)
- /gnucash (for the gui)
- /common (misc source files used by both)
- /bindings (currently only holds python bindings)
This is the first step in restructuring the code. It will need much
more fine tuning later on.