From 5921c63a014516ab0ae01ec3614aa63202380f91 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sun, 5 Jul 2015 16:33:52 -0700 Subject: [PATCH 01/25] Update the copyright date for Help|About to 2015. Only 6 months late! --- src/gnome-utils/gnc-main-window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index 048d00f02a..474fad05af 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -4377,7 +4377,7 @@ gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window) { const gchar *fixed_message = _("The GnuCash personal finance manager. " "The GNU way to manage your money!"); - const gchar *copyright = _("© 1997-2014 Contributors"); + const gchar *copyright = _("© 1997-2015 Contributors"); gchar **authors = get_file_strsplit("AUTHORS"); gchar **documenters = get_file_strsplit("DOCUMENTERS"); gchar *license = get_file("LICENSE"); From 42b3bfbbfe3c67d3c9cbfee6035ef9d2b8afc061 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 7 Jul 2015 13:02:18 -0700 Subject: [PATCH 02/25] Restore Date::Manip to quotes modules. Gnc-fq-helper needs it to parse date and time strings from Finance::Quote. The comment about using the iso-date field is removed because F::Q no longer provides it. --- src/quotes/gnc-fq-helper.in | 34 +++++++++++++++------------------- src/quotes/gnc-fq-update.in | 23 ++++++++++++----------- 2 files changed, 27 insertions(+), 30 deletions(-) mode change 100644 => 100755 src/quotes/gnc-fq-helper.in mode change 100644 => 100755 src/quotes/gnc-fq-update.in diff --git a/src/quotes/gnc-fq-helper.in b/src/quotes/gnc-fq-helper.in old mode 100644 new mode 100755 index f6759bbbf6..c2c91d4ca7 --- a/src/quotes/gnc-fq-helper.in +++ b/src/quotes/gnc-fq-helper.in @@ -2,17 +2,17 @@ ###################################################################### ### gnc-fq-helper - present a scheme interface to Finance::Quote ### Copyright 2001 Rob Browning -### -### This program is free software; you can redistribute it and/or -### modify it under the terms of the GNU General Public License as -### published by the Free Software Foundation; either version 2 of -### the License, or (at your option) any later version. -### -### This program is distributed in the hope that it will be useful, -### but WITHOUT ANY WARRANTY; without even the implied warranty of -### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -### GNU General Public License for more details. -### +### +### This program is free software; you can redistribute it and/or +### modify it under the terms of the GNU General Public License as +### published by the Free Software Foundation; either version 2 of +### the License, or (at your option) any later version. +### +### This program is distributed in the hope that it will be useful, +### but WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +### GNU General Public License for more details. +### ### You should have received a copy of the GNU General Public License ### along with this program# if not, contact: ### @@ -25,11 +25,7 @@ use strict; use English; use FileHandle; -# The following include is needed for the ParseDateString function. -# This should eventually be replaced with a requirement for F::Q -# version 1.11 (or better) and the use of the 'isodate' field to -# handle the date part of the conversion. Still need a method to -# handle the time conversion. +# Date::Manip provides ParseDate, ParseDateString, and UnixTime. use Date::Manip; =head1 NAME @@ -122,7 +118,7 @@ non-zero - failure # signature so this works OK. sub check_modules { - my @modules = qw(Finance::Quote); + my @modules = qw(Finance::Quote Date::Manip); my @missing; foreach my $mod (@modules) { @@ -223,7 +219,7 @@ sub get_quote_time { my $parsestr = $datestr; if(!$timestr) { - #fix date handling for quotes with no time. + #fix date handling for quotes with no time. #Keeps gnucash from getting date wrong in west longitude places. $parsestr .= " 12:00:00" } else { @@ -415,7 +411,7 @@ __END__ # $timezone = 0; # } else { # return 0; -# } +# } # } # sub get_quote_utc { diff --git a/src/quotes/gnc-fq-update.in b/src/quotes/gnc-fq-update.in old mode 100644 new mode 100755 index 3aed182044..2002086fbf --- a/src/quotes/gnc-fq-update.in +++ b/src/quotes/gnc-fq-update.in @@ -2,17 +2,17 @@ ###################################################################### ### gnc-fq-update - presents a scheme interface to Finance::Quote ### Copyright 2001 Gnumatic, Inc. -### -### This program is free software; you can redistribute it and/or -### modify it under the terms of the GNU General Public License as -### published by the Free Software Foundation; either version 2 of -### the License, or (at your option) any later version. -### -### This program is distributed in the hope that it will be useful, -### but WITHOUT ANY WARRANTY; without even the implied warranty of -### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -### GNU General Public License for more details. -### +### +### This program is free software; you can redistribute it and/or +### modify it under the terms of the GNU General Public License as +### published by the Free Software Foundation; either version 2 of +### the License, or (at your option) any later version. +### +### This program is distributed in the hope that it will be useful, +### but WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +### GNU General Public License for more details. +### ### You should have received a copy of the GNU General Public License ### along with this program# if not, contact: ### @@ -36,6 +36,7 @@ if ($( != 0) { exit 0 if ($input ne "y"); } +CPAN::Shell->install('Date::Manip'); #Required by gnc-fq-helper CPAN::Shell->install('Finance::Quote'); ## Local Variables: From 7d940a5d91729c8834808a6d5fd9a1e956eaa80f Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 7 Jul 2015 17:04:10 -0700 Subject: [PATCH 03/25] Bug 749077 - wrongfully invalidating any account save location/path starting with ".gnucash" --- src/gnome-utils/gnc-file.c | 68 +++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/src/gnome-utils/gnc-file.c b/src/gnome-utils/gnc-file.c index ed19d03e63..4150fcc959 100644 --- a/src/gnome-utils/gnc-file.c +++ b/src/gnome-utils/gnc-file.c @@ -1091,6 +1091,35 @@ gnc_file_export (void) LEAVE (" "); } +static gboolean +check_file_path (const char *path) +{ + /* Remember the directory as the default. */ + gchar *default_dir = g_path_get_dirname(path); + const gchar *dotgnucash = gnc_dotgnucash_dir(); + gnc_set_default_directory (GNC_PREFS_GROUP_OPEN_SAVE, default_dir); + + /* Prevent user to store file in GnuCash' private configuration + * directory (~/.gnucash by default in linux, but can be overridden) + */ + DEBUG("User path: %s, dotgnucash_dir: %s", path, + gnc_dotgnucash_dir()); + while (strcmp (default_dir, "/") != 0 && strcmp(default_dir, ".") != 0) + { + char *dirpath = default_dir; + if (strcmp(default_dir, dotgnucash) == 0) + { + g_free (dirpath); + return TRUE; + } + default_dir = g_path_get_dirname (dirpath); + g_free (dirpath); + } + g_free(default_dir); + return FALSE; +} + + void gnc_file_do_export(const char * filename) { @@ -1139,24 +1168,12 @@ gnc_file_do_export(const char * filename) } /* Some extra steps for file based uri's only */ - if (gnc_uri_is_file_protocol(protocol)) + if (gnc_uri_is_file_protocol(protocol) && check_file_path (path)) { - /* Remember the directory as the default. */ - gchar *default_dir = g_path_get_dirname(path); - gnc_set_default_directory (GNC_PREFS_GROUP_OPEN_SAVE, default_dir); - g_free(default_dir); - - /* Prevent user to store file in GnuCash' private configuration - * directory (~/.gnucash by default in linux, but can be overridden) - */ - DEBUG("User path: %s, dotgnucash_dir: %s", path, gnc_dotgnucash_dir()); - if (g_str_has_prefix(path, gnc_dotgnucash_dir())) - { - show_session_error (ERR_FILEIO_RESERVED_WRITE, newfile, GNC_FILE_DIALOG_SAVE); - return; - } + show_session_error (ERR_FILEIO_RESERVED_WRITE, newfile, + GNC_FILE_DIALOG_SAVE); + return; } - /* Check to see if the user specified the same file as the current * file. If so, prevent the export from happening to avoid killing this file */ current_session = gnc_get_current_session (); @@ -1377,22 +1394,11 @@ gnc_file_do_save_as (const char* filename) } /* Some extra steps for file based uri's only */ - if (gnc_uri_is_file_protocol(protocol)) + if (gnc_uri_is_file_protocol(protocol) && check_file_path (path)) { - /* Remember the directory as the default. */ - gchar *default_dir = g_path_get_dirname(path); - gnc_set_default_directory (GNC_PREFS_GROUP_OPEN_SAVE, default_dir); - g_free(default_dir); - - /* Prevent user to store file in GnuCash' private configuration - * directory (~/.gnucash by default in linux, but can be overridden) - */ - DEBUG("User path: %s, dotgnucash_dir: %s", path, gnc_dotgnucash_dir()); - if (g_str_has_prefix(path, gnc_dotgnucash_dir())) - { - show_session_error (ERR_FILEIO_RESERVED_WRITE, newfile, GNC_FILE_DIALOG_SAVE); - return; - } + show_session_error (ERR_FILEIO_RESERVED_WRITE, newfile, + GNC_FILE_DIALOG_SAVE); + return; } /* Check to see if the user specified the same file as the current From b741c8e1de4384ea302fc073d287af7ef4ca96d0 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 10 Jul 2015 12:43:25 -0700 Subject: [PATCH 04/25] Initialize GError to NULL or it doesn't work. --- src/core-utils/gnc-environment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core-utils/gnc-environment.c b/src/core-utils/gnc-environment.c index 51e74f4b99..06b2055bfe 100644 --- a/src/core-utils/gnc-environment.c +++ b/src/core-utils/gnc-environment.c @@ -102,7 +102,7 @@ gnc_environment_setup (void) gchar *config_path; gchar *env_file; GKeyFile *keyfile = g_key_file_new(); - GError *error; + GError *error = NULL; gchar **env_vars; gsize param_count; gint i; From d2fa23dd5f8164a14ee1af72d06a177208652d42 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 10 Jul 2015 12:45:12 -0700 Subject: [PATCH 05/25] Bug 752204 - .gml2 files are modified during build Turn off compression so that they aren't, except when scrub changes them to a new format. In those cases the changes should be committed. --- src/backend/xml/test/test-load-xml2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/backend/xml/test/test-load-xml2.c b/src/backend/xml/test/test-load-xml2.c index 814d7a5ce2..da77e17c86 100644 --- a/src/backend/xml/test/test-load-xml2.c +++ b/src/backend/xml/test/test-load-xml2.c @@ -42,6 +42,7 @@ #include #include "../gnc-backend-xml.h" #include "../io-gncxml-v2.h" +#include #include #include @@ -91,6 +92,7 @@ test_load_file(const char *filename) remove_locks(filename); ignore_lock = (g_strcmp0(g_getenv("SRCDIR"), ".") != 0); + gnc_prefs_set_file_save_compressed(FALSE); qof_session_begin(session, filename, ignore_lock, FALSE, TRUE); qof_session_load(session, NULL); @@ -105,6 +107,7 @@ test_load_file(const char *filename) "qof error=%d for file [%s]", qof_session_get_error(session), filename); /* Uncomment the line below to generate corrected files */ + gnc_prefs_set_file_save_compressed(FALSE); qof_session_save( session, NULL ); qof_session_end(session); } From a25fa861ebf061a42d2eced20877c775f161f17c Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 10 Jul 2015 15:31:25 -0700 Subject: [PATCH 06/25] Bug 752203 - `make check` fails in "runTests.py": No module named unittest_support because unittest_support.py is built only when building from VCS and wasn't included in EXTRA_DIST. --- src/test-core/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test-core/Makefile.am b/src/test-core/Makefile.am index 16bb21deb4..5570efe523 100644 --- a/src/test-core/Makefile.am +++ b/src/test-core/Makefile.am @@ -123,6 +123,7 @@ EXTRA_DIST = \ $(SCM_FILES) \ swig-unittest-support-python.c \ swig-unittest-support-guile.c \ + unittest_support.py \ unittest-support.i MAINTAINERCLEANFILES = \ From 211b923cd7bdadba3accaaf0ec7bd3d7c4619f63 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 11 Jul 2015 09:55:06 -0700 Subject: [PATCH 07/25] Bug 752204 - .gml2 files are modified during build, take 2. Turns out that there are changes as well as compression, particularly if the timezone is different from the one from the last commit of the gml2 files. Since there's no real benefit to saving the files most of the time, don't, but leave the save line in, commented out, to make it easy to write new files if necessary. --- src/backend/xml/test/test-load-xml2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/backend/xml/test/test-load-xml2.c b/src/backend/xml/test/test-load-xml2.c index da77e17c86..34592ca843 100644 --- a/src/backend/xml/test/test-load-xml2.c +++ b/src/backend/xml/test/test-load-xml2.c @@ -92,7 +92,7 @@ test_load_file(const char *filename) remove_locks(filename); ignore_lock = (g_strcmp0(g_getenv("SRCDIR"), ".") != 0); - gnc_prefs_set_file_save_compressed(FALSE); +/* gnc_prefs_set_file_save_compressed(FALSE); */ qof_session_begin(session, filename, ignore_lock, FALSE, TRUE); qof_session_load(session, NULL); @@ -107,8 +107,7 @@ test_load_file(const char *filename) "qof error=%d for file [%s]", qof_session_get_error(session), filename); /* Uncomment the line below to generate corrected files */ - gnc_prefs_set_file_save_compressed(FALSE); - qof_session_save( session, NULL ); +/* qof_session_save( session, NULL ); */ qof_session_end(session); } From 2137cb6d38aacfbe2d087563982d5a9613d324ee Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 11 Jul 2015 11:20:56 -0700 Subject: [PATCH 08/25] Bug 747795 - Attached file not found. MSWin only. ShellExecuteW("open") doesn't decode http escapes on file: IRIs. --- src/gnome-utils/gnc-gnome-utils.c | 32 +++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/gnome-utils/gnc-gnome-utils.c b/src/gnome-utils/gnc-gnome-utils.c index 02bed117d8..d0e5b9f977 100644 --- a/src/gnome-utils/gnc-gnome-utils.c +++ b/src/gnome-utils/gnc-gnome-utils.c @@ -430,19 +430,31 @@ gnc_launch_assoc (const char *uri) void gnc_launch_assoc (const char *uri) { - wchar_t *winuri = (wchar_t *)g_utf8_to_utf16(uri, -1, NULL, NULL, NULL); - wchar_t *wincmd = (wchar_t *)g_utf8_to_utf16("open", -1, NULL, NULL, NULL); + wchar_t *winuri = NULL; + /* ShellExecuteW open doesn't decode http escapes if it's passed a + * file URI so we have to do it. */ + if (strcmp (g_uri_parse_scheme(uri), "file") == 0) + { + gchar *filename = g_filename_from_uri (uri, NULL, NULL); + winuri = (wchar_t *)g_utf8_to_utf16(filename, -1, NULL, NULL, NULL); + } + else + winuri = (wchar_t *)g_utf8_to_utf16(uri, -1, NULL, NULL, NULL); + if (winuri) { - if ((INT_PTR)ShellExecuteW(NULL, wincmd, winuri, NULL, NULL, SW_SHOWNORMAL) <= 32) - { - const gchar *message = - _("GnuCash could not find the associated file."); - gnc_error_dialog(NULL, "%s", message); - } - g_free (winuri); + wchar_t *wincmd = (wchar_t *)g_utf8_to_utf16("open", -1, + NULL, NULL, NULL); + if ((INT_PTR)ShellExecuteW(NULL, wincmd, winuri, + NULL, NULL, SW_SHOWNORMAL) <= 32) + { + const gchar *message = + _("GnuCash could not find the associated file"); + gnc_error_dialog(NULL, "%s: %s", message, uri); + } + g_free (wincmd); + g_free (winuri); } - g_free (wincmd); } #else From cfb54e08b8b4135be5c1ea5a1d3193e02d80a678 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sun, 12 Jul 2015 15:08:45 -0700 Subject: [PATCH 09/25] Bug 746998 - "Months Remaining" spinbox in Loan Assistant is non-obvious Provide a tool tip explaining what it's for. --- src/gnome/gtkbuilder/assistant-loan.glade | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gnome/gtkbuilder/assistant-loan.glade b/src/gnome/gtkbuilder/assistant-loan.glade index 76a020ac19..d2427bf6e9 100644 --- a/src/gnome/gtkbuilder/assistant-loan.glade +++ b/src/gnome/gtkbuilder/assistant-loan.glade @@ -138,6 +138,7 @@ If you make a mistake or want to make changes later, you can edit the created Sc True True 1 + Enter the number of months still to be paid off. This determines both the remaining principle and the duration of the scheduled transaction. 3 From 2dd38a9c6089139cbb6e76749c8d53b9c09d4be8 Mon Sep 17 00:00:00 2001 From: Bastien Scher Date: Sat, 11 Jul 2015 16:40:49 +0200 Subject: [PATCH 10/25] Fix two French strings --- po/fr.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/po/fr.po b/po/fr.po index 7fac220083..ff6fc18ee3 100644 --- a/po/fr.po +++ b/po/fr.po @@ -17520,12 +17520,12 @@ msgstr "Virgule (,)" #: ../src/import-export/csv-exp/assistant-csv-export.glade.h:8 #: ../src/import-export/csv-imp/assistant-csv-trans-import.glade.h:25 msgid "Colon (:)" -msgstr "Colonne (:)" +msgstr "Deux-points (:)" #: ../src/import-export/csv-exp/assistant-csv-export.glade.h:9 #: ../src/import-export/csv-imp/assistant-csv-trans-import.glade.h:26 msgid "Semicolon (;)" -msgstr "Demie-colonne (;)" +msgstr "Point-virgule (;)" # messages-i18n.c:257 #: ../src/import-export/csv-exp/assistant-csv-export.glade.h:11 From 6d5002d91c2ac5577f430b7c739a78c080996d20 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 25 Jul 2015 13:35:37 -0700 Subject: [PATCH 11/25] Uninstall the python bindings. --- src/optional/python-bindings/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/optional/python-bindings/Makefile.am b/src/optional/python-bindings/Makefile.am index 8bd31780f5..e9364fe7c6 100644 --- a/src/optional/python-bindings/Makefile.am +++ b/src/optional/python-bindings/Makefile.am @@ -133,3 +133,6 @@ CLEANFILES = $(BUILT_SOURCES) .py-links gnucash_core.c.py clean-local: rm -rf gnucash + +uninstall-local: + rm -rf ${pkgpyexecdir} From d2798b8c3f1076756428180b9f5200d0171ce907 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sun, 26 Jul 2015 13:11:45 -0700 Subject: [PATCH 12/25] Bug 752879 - Finance::Quote TZ Date::Manip config variable is deprecated Rewrite get_quote_time() to use the modern OO interface to Date::Manip. This requires perl-5.12 or later, so require that. schemify_date() isn't used anywhere, so remove that. --- src/quotes/gnc-fq-helper.in | 55 ++++++++++--------------------------- 1 file changed, 15 insertions(+), 40 deletions(-) diff --git a/src/quotes/gnc-fq-helper.in b/src/quotes/gnc-fq-helper.in index c2c91d4ca7..16dd452b8e 100755 --- a/src/quotes/gnc-fq-helper.in +++ b/src/quotes/gnc-fq-helper.in @@ -114,6 +114,10 @@ non-zero - failure =cut +# Set a base date with the current time in the current TZ: +my $base_date = new Date::Manip::Date; +$base_date->parse("now"); + # The methods we know about. For now we assume they all have the same # signature so this works OK. @@ -190,18 +194,6 @@ sub schemify_num { } } -sub schemify_date { - # return the date in epoch seconds. - my ($datestr) = @_; - - my $date = ParseDate($datestr); - my $result = UnixDate($date, "%s"); - if($result !~ /^(\+|-)?\d+$/) { - $result = "failed-conversion"; - } - return("$result"); -} - # sub schemify_range { # #convert range in form ``num1 - num2'' to ``(num1 num2)''. # } @@ -212,33 +204,19 @@ sub get_quote_time { my $datestr = $$quotehash{$item, 'date'}; my $timestr = $$quotehash{$item, 'time'}; + my $format = "%Y-%m-%d %H:%M:%S"; - if(!$datestr) { - return undef; + if ($datestr) { + my $parsestr = $datestr . " " . ($timestr ? $timestr : "12:00:00"); + my $date = $base_date->new(); + my $err = $date->parse($parsestr); + if ($err) { + print $date->err(), " $parsestr\n"; + return $base_date->printf($format); + } + return $date->printf($format); } - - my $parsestr = $datestr; - if(!$timestr) { - #fix date handling for quotes with no time. - #Keeps gnucash from getting date wrong in west longitude places. - $parsestr .= " 12:00:00" - } else { - $parsestr .= " $timestr"; - } - - $parsestr = ParseDateString($parsestr); - - my $result = UnixDate($parsestr, "\"%Y-%m-%d %H:%M:%S\""); - if(!$result) { - # Fix date handling for quotes with no date: assume local date - (my $second,my $minute,my $hour,my $dayofmonth,my $month,my $year,my $dayofweek,my $dayofyear,my $daylightsaving) = localtime(); -# $result = "\"".sprintf("%04d-%02d-%02d%02d:%02d:%02d",($year+1900),++$month,$dayOfMonth,$hour,$minute,$second)."\""; - $result = "\"" . sprintf("%04d-%02d-%02d", ($year+1900), ++$month, $dayofmonth) . " 12:00:00\""; - } - if($result !~ /^\"\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\"$/) { - $result = "failed-conversion"; - } - return $result; + return $base_date->printf($format); } sub schemify_quote { @@ -341,9 +319,6 @@ sub parse_input_line { # Check for and load non-standard modules check_modules (); -# Help Date::Manip on Windows -Date_Init("TZ=UTC") if ($^O eq "MSWin32" && (!$ENV{'TZ'})); - # Create a stockquote object. my $quoter = Finance::Quote->new(); my $prgnam = "gnc-fq-helper"; From 3ccaec6e381843b5e7f5ac03f199fc27fb9de2a4 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Mon, 27 Jul 2015 15:59:12 -0700 Subject: [PATCH 13/25] Make backend sync errors survive to the session. The backends were using qof_backend_get_error() to test for sync errors. This function clears the error, so the tests resulted in the error being cleared before the session could see it and so it thought that the sync had succeeded. Replace those uses of qof_backend_get_error() with a new function qof_backend_check_error() that doesn't clear the error. --- src/backend/dbi/gnc-backend-dbi.c | 2 +- src/backend/sql/gnc-backend-sql.c | 3 ++- src/backend/xml/io-gncxml-v2.c | 20 +++++++++----------- src/libqof/qof/qofbackend.c | 7 +++++++ src/libqof/qof/qofbackend.h | 8 ++++++++ 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/backend/dbi/gnc-backend-dbi.c b/src/backend/dbi/gnc-backend-dbi.c index 6733de392b..79b7116707 100644 --- a/src/backend/dbi/gnc-backend-dbi.c +++ b/src/backend/dbi/gnc-backend-dbi.c @@ -1685,7 +1685,7 @@ gnc_dbi_safe_sync_all( QofBackend *qbe, QofBook *book ) be->primary_book = book; gnc_sql_sync_all( &be->sql_be, book ); - if ( ERR_BACKEND_NO_ERR != qof_backend_get_error( qbe ) ) + if (qof_backend_check_error (qbe)) { conn_table_operation( (GncSqlConnection*)conn, table_list, rollback ); diff --git a/src/backend/sql/gnc-backend-sql.c b/src/backend/sql/gnc-backend-sql.c index dc819db87f..61406373c9 100644 --- a/src/backend/sql/gnc-backend-sql.c +++ b/src/backend/sql/gnc-backend-sql.c @@ -512,7 +512,8 @@ gnc_sql_sync_all( GncSqlBackend* be, /*@ dependent @*/ QofBook *book ) } else { - qof_backend_set_error( (QofBackend*)be, ERR_BACKEND_SERVER_ERR ); + if (!qof_backend_check_error ((QofBackend*)be)) + qof_backend_set_error( (QofBackend*)be, ERR_BACKEND_SERVER_ERR ); is_ok = gnc_sql_connection_rollback_transaction( be->conn ); } finish_progress( be ); diff --git a/src/backend/xml/io-gncxml-v2.c b/src/backend/xml/io-gncxml-v2.c index c7ab52eaef..051c94c8d1 100644 --- a/src/backend/xml/io-gncxml-v2.c +++ b/src/backend/xml/io-gncxml-v2.c @@ -1033,7 +1033,7 @@ write_book(FILE *out, QofBook *book, sixtp_gdv2 *gd) g_list_length(gnc_book_get_schedxactions(book)->sx_list), "budget", qof_collection_count( qof_book_get_collection(book, GNC_ID_BUDGET)), - "price", gnc_pricedb_get_num_prices(gnc_pricedb_get_db(book)), + "price", gnc_pricedb_get_num_prices(gnc_pricedb_get_db(book)), NULL)) return FALSE; @@ -1131,11 +1131,11 @@ write_pricedb(FILE *out, QofBook *book, sixtp_gdv2 *gd) /* Write out the parent pricedb tag then loop to write out each price. We do it this way instead of just calling xmlElemDump so that we can increment the progress bar as we go. */ - - if (fprintf( out, "<%s version=\"%s\">\n", parent->name, + + if (fprintf( out, "<%s version=\"%s\">\n", parent->name, xmlGetProp(parent, BAD_CAST "version")) < 0) return FALSE; - + /* We create our own output buffer so we can call xmlNodeDumpOutput to get the indendation correct. */ outbuf = xmlOutputBufferCreateFile(out, NULL); @@ -1144,7 +1144,7 @@ write_pricedb(FILE *out, QofBook *book, sixtp_gdv2 *gd) xmlFreeNode(parent); return FALSE; } - + for (node = parent->children; node; node = node->next) { /* Write two spaces since xmlNodeDumpOutput doesn't indent the first line */ @@ -1152,14 +1152,14 @@ write_pricedb(FILE *out, QofBook *book, sixtp_gdv2 *gd) xmlNodeDumpOutput(outbuf, NULL, node, 1, 1, NULL); /* It also doesn't terminate the last line */ xmlOutputBufferWrite(outbuf, 1, "\n"); - if (ferror(out)) + if (ferror(out)) break; gd->counter.prices_loaded += 1; run_callback(gd, "prices"); } - + xmlOutputBufferClose(outbuf); - + if (ferror(out) || fprintf(out, "\n", parent->name) < 0) { xmlFreeNode(parent); @@ -1670,8 +1670,7 @@ gnc_book_write_accounts_to_xml_file_v2( if (out && fclose(out)) success = FALSE; - if (!success - && qof_backend_get_error(be) == ERR_BACKEND_NO_ERR) + if (!success && !qof_backend_check_error(be)) { /* Use a generic write error code */ @@ -2186,4 +2185,3 @@ gnc_xml2_parse_with_subst (FileBackend *fbe, QofBook *book, GHashTable *subst) return success; } - diff --git a/src/libqof/qof/qofbackend.c b/src/libqof/qof/qofbackend.c index 6a8ab60616..07dfab0dca 100644 --- a/src/libqof/qof/qofbackend.c +++ b/src/libqof/qof/qofbackend.c @@ -64,6 +64,13 @@ qof_backend_get_error (QofBackend *be) return err; } +gboolean +qof_backend_check_error (QofBackend *be) +{ + g_return_val_if_fail (be != NULL, TRUE); + return be->last_err != ERR_BACKEND_NO_ERR; +} + void qof_backend_set_message (QofBackend *be, const char *format, ...) { diff --git a/src/libqof/qof/qofbackend.h b/src/libqof/qof/qofbackend.h index 13aed89c4d..5b4e41179d 100644 --- a/src/libqof/qof/qofbackend.h +++ b/src/libqof/qof/qofbackend.h @@ -166,6 +166,14 @@ void qof_backend_set_error (QofBackend *be, QofBackendError err); */ QofBackendError qof_backend_get_error (QofBackend *be); +/** Report if the backend is in an error state. + * Since get_error resets the error state, its use for branching as the backend + * bubbles back up to the session would make the session think that there was + * no error. + * \param be The backend being tested. + * \return TRUE if the backend has an error set. + */ +gboolean qof_backend_check_error (QofBackend *be); /** \brief Load a QOF-compatible backend shared library. From 124a2479efe8778f1a09cf386b4b9025d1b34049 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Tue, 28 Jul 2015 17:12:24 +0200 Subject: [PATCH 14/25] Bug 752035 - Transaction Report Filter By not Always Working Make sure the internal split function get_corr_account_split behaves consistently on multi-split transactions. The transaction report depends on this. Add test case to catch potential regressions Simplify filter test function in transaction report. --- src/engine/Split.c | 36 ++-------- src/engine/Split.h | 6 ++ src/engine/test/utest-Split.c | 26 +++++++ src/report/report-system/report-system.scm | 1 - src/report/report-system/report-utilities.scm | 3 - src/report/standard-reports/transaction.scm | 67 ++++++++++--------- 6 files changed, 75 insertions(+), 64 deletions(-) diff --git a/src/engine/Split.c b/src/engine/Split.c index 64055a3c33..8d34c2396d 100644 --- a/src/engine/Split.c +++ b/src/engine/Split.c @@ -1383,40 +1383,18 @@ get_corr_account_split(const Split *sa, const Split **retval) { const Split *current_split; - GList *node; - gnc_numeric sa_value, current_value; - gboolean sa_value_positive, current_value_positive, seen_one = FALSE; *retval = NULL; g_return_val_if_fail(sa, FALSE); - sa_value = xaccSplitGetValue (sa); - sa_value_positive = gnc_numeric_positive_p(sa_value); + if (xaccTransCountSplits (sa->parent) > 2) + return FALSE; - for (node = sa->parent->splits; node; node = node->next) - { - current_split = node->data; - if (current_split == sa) continue; - - if (!xaccTransStillHasSplit(sa->parent, current_split)) continue; - current_value = xaccSplitGetValue (current_split); - current_value_positive = gnc_numeric_positive_p(current_value); - if ((sa_value_positive && !current_value_positive) || - (!sa_value_positive && current_value_positive)) - { - if (seen_one) - { - *retval = NULL; - return FALSE; - } - else - { - *retval = current_split; - seen_one = TRUE; - } - } - } - return seen_one; + *retval = xaccSplitGetOtherSplit (sa); + if (*retval) + return TRUE; + else + return FALSE; } /* TODO: these static consts can be shared. */ diff --git a/src/engine/Split.h b/src/engine/Split.h index d240bd83c1..9b0235bb83 100644 --- a/src/engine/Split.h +++ b/src/engine/Split.h @@ -441,6 +441,12 @@ int xaccSplitCompareOtherAccountCodes(const Split *sa, const Split *sb); * were added for the transaction report, and is in C because the code * was already written in C for the above functions and duplication * is silly. + * + * Note that this will only return a real value in case of a + * two-split transaction as that is the only situation in which + * a reliable value can be returned. In other situations + * "-- Split Transaction --" will be returned as Account Name + * or "Split" for Account Code. */ char * xaccSplitGetCorrAccountFullName(const Split *sa); diff --git a/src/engine/test/utest-Split.c b/src/engine/test/utest-Split.c index d3dcc6e66a..0064a8b1dc 100644 --- a/src/engine/test/utest-Split.c +++ b/src/engine/test/utest-Split.c @@ -1265,10 +1265,15 @@ test_get_corr_account_split (Fixture *fixture, gconstpointer pData) Split *split1 = xaccMallocSplit (book); Split *split2 = xaccMallocSplit (book); Split *split3 = xaccMallocSplit (book); + Split *split4 = xaccMallocSplit (book); + Split *split5 = xaccMallocSplit (book); const Split *result = NULL; + const gnc_numeric factor = gnc_numeric_create (2, 1); Account *acc1 = xaccMallocAccount (book); Account *acc2 = xaccMallocAccount (book); Account *acc3 = xaccMallocAccount (book); + Account *acc4 = xaccMallocAccount (book); + Account *acc5 = xaccMallocAccount (book); #if defined(__clang__) && __clang_major__ < 6 #define _func "gboolean get_corr_account_split(const Split *, const Split **)" #else @@ -1285,14 +1290,23 @@ test_get_corr_account_split (Fixture *fixture, gconstpointer pData) xaccAccountSetCommodity (acc1, fixture->curr); xaccAccountSetCommodity (acc2, fixture->curr); xaccAccountSetCommodity (acc3, fixture->curr); + xaccAccountSetCommodity (acc4, fixture->curr); + xaccAccountSetCommodity (acc5, fixture->curr); split1->acc = acc1; split2->acc = acc2; split3->acc = acc3; + split4->acc = acc4; + split5->acc = acc5; split1->value = gnc_numeric_create (456, 240); split2->value = gnc_numeric_neg (fixture->split->value); split3->value = gnc_numeric_neg (split1->value); + split4->value = gnc_numeric_neg (gnc_numeric_mul (fixture->split->value, + factor, + GNC_DENOM_AUTO, + GNC_HOW_RND_NEVER)); + split5->value = fixture->split->value; g_assert (!fixture->func->get_corr_account_split(fixture->split, &result)); g_assert (result == NULL); @@ -1309,6 +1323,18 @@ test_get_corr_account_split (Fixture *fixture, gconstpointer pData) xaccSplitSetParent (split3, txn); xaccTransCommitEdit (txn); + g_assert (!fixture->func->get_corr_account_split(fixture->split, &result)); + g_assert (result == NULL); + + /* Test for bug 752035 */ + xaccTransBeginEdit (txn); + xaccSplitSetParent (split1, NULL); + xaccSplitSetParent (split2, NULL); + xaccSplitSetParent (split3, NULL); + xaccSplitSetParent (split4, txn); + xaccSplitSetParent (split5, txn); + xaccTransCommitEdit (txn); + g_assert (!fixture->func->get_corr_account_split(fixture->split, &result)); g_assert (result == NULL); g_assert_cmpint (check->hits, ==, 0); diff --git a/src/report/report-system/report-system.scm b/src/report/report-system/report-system.scm index 9af2efc149..9d5a7b9d26 100644 --- a/src/report/report-system/report-system.scm +++ b/src/report/report-system/report-system.scm @@ -648,7 +648,6 @@ (export gnc:account-get-type-string-plural) (export gnc:accounts-get-commodities) (export gnc:get-current-account-tree-depth) -(export gnc:split-get-corr-account-full-name) (export gnc:acccounts-get-all-subaccounts) (export gnc:make-stats-collector) (export gnc:make-drcr-collector) diff --git a/src/report/report-system/report-utilities.scm b/src/report/report-system/report-utilities.scm index 61d14ce816..7597c82020 100644 --- a/src/report/report-system/report-utilities.scm +++ b/src/report/report-system/report-utilities.scm @@ -143,9 +143,6 @@ (let ((root (gnc-get-current-root-account))) (gnc-account-get-tree-depth root))) -(define (gnc:split-get-corr-account-full-name split) - (xaccSplitGetCorrAccountFullName split)) - ;; Get all children of this list of accounts. (define (gnc:acccounts-get-all-subaccounts accountlist) diff --git a/src/report/standard-reports/transaction.scm b/src/report/standard-reports/transaction.scm index a8b2e60c39..f010b8b942 100644 --- a/src/report/standard-reports/transaction.scm +++ b/src/report/standard-reports/transaction.scm @@ -1378,40 +1378,45 @@ Credit Card, and Income accounts."))))) name-sortkey name-subtotal name-date-subtotal 3 2)) - (define (get-other-account-names account-list) - ( map (lambda (acct) (gnc-account-get-full-name acct)) account-list)) + ;;(define (get-other-account-names account-list) + ;; ( map (lambda (acct) (gnc-account-get-full-name acct)) account-list)) - (define (is-filter-member split account-list splits-ok?) - (let ((fullname (gnc:split-get-corr-account-full-name split))) + (define (is-filter-member split account-list) + (let* ((txn (xaccSplitGetParent split)) + (splitcount (xaccTransCountSplits txn))) - (if (string=? fullname (_ "-- Split Transaction --")) - ;; Yep, this is a split transaction. + (cond + ;; A 2-split transaction - test separately so it can be optimized + ;; to significantly reduce the number of splits to traverse + ;; in guile code + ((= splitcount 2) + (let* ((other (xaccSplitGetOtherSplit split)) + (other-acct (xaccSplitGetAccount other))) + (member other-acct account-list))) - (if splits-ok? - (let* ((txn (xaccSplitGetParent split)) - (splits (xaccTransGetSplitList txn))) + ;; A multi-split transaction - run over all splits + ((> splitcount 2) + (let ((splits (xaccTransGetSplitList txn))) - ;; Walk through the list of splits. - ;; if we reach the end, return #f - ;; if the 'this' != 'split' and the split->account is a member - ;; of the account-list, then return #t, else recurse - (define (is-member splits) - (if (null? splits) - #f - (let* ((this (car splits)) - (rest (cdr splits)) - (acct (xaccSplitGetAccount this))) - (if (and (not (eq? this split)) - (member acct account-list)) - #t - (is-member rest))))) + ;; Walk through the list of splits. + ;; if we reach the end, return #f + ;; if the 'this' != 'split' and the split->account is a member + ;; of the account-list, then return #t, else recurse + (define (is-member splits) + (if (null? splits) + #f + (let* ((this (car splits)) + (rest (cdr splits)) + (acct (xaccSplitGetAccount this))) + (if (and (not (eq? this split)) + (member acct account-list)) + #t + (is-member rest))))) - (is-member splits)) - #f) + (is-member splits))) - ;; Nope, this is a regular transaction - (member fullname (get-other-account-names account-list)) - ))) + ;; Single transaction splits + (else #f)))) (gnc:report-starting reportname) @@ -1467,7 +1472,7 @@ Credit Card, and Income accounts."))))) (set! splits (qof-query-run query)) - ;;(gnc:warn "Splits in trep-renderer:" splits) + (gnc:warn "Splits in trep-renderer:" splits) ;;(gnc:warn "Filter account names:" (get-other-account-names c_account_2)) @@ -1477,7 +1482,7 @@ Credit Card, and Income accounts."))))) (begin ;;(gnc:warn "Including Filter Accounts") (set! splits (filter (lambda (split) - (is-filter-member split c_account_2 #t)) + (is-filter-member split c_account_2)) splits)) ) ) @@ -1486,7 +1491,7 @@ Credit Card, and Income accounts."))))) (begin ;;(gnc:warn "Excluding Filter Accounts") (set! splits (filter (lambda (split) - (not (is-filter-member split c_account_2 #t))) + (not (is-filter-member split c_account_2))) splits)) ) ) From 2663dc96e247ac0dfbc32a4d78669c168293b93d Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 28 Jul 2015 11:45:22 -0700 Subject: [PATCH 15/25] Improve the test-templates README and update the templates to current practice. --- test-templates/README | 29 +++++++++---- test-templates/test-module.c | 5 +-- test-templates/test-suite.c | 45 ++++++++++++-------- test-templates/testmain.c | 82 +++++++++++++++++++++++++++++------- 4 files changed, 116 insertions(+), 45 deletions(-) diff --git a/test-templates/README b/test-templates/README index df749f4902..0a5a026dc3 100644 --- a/test-templates/README +++ b/test-templates/README @@ -9,22 +9,35 @@ If there is already a test directory with make check tests in it, copy the contents of the Makefile.am in this directory to the existing Makefile.am; otherwise, copy the Makefile.am to your test directory. -Copy test-module.c and test-suite.c to your test directory and rename -them appropriately. You will very likely want several copies of -test-suite.c, one corresponding to each c file in the module directory -that you're testing. +There are two groups of templates here: testmain.c is for a standalone test +program that doesn't group tests into suites. test-module.c and test-suite.c +support collecting a large number of tests separated in suites into a single +test program. In most cases you'll want to use the latter. + +For a single file test program, copy testmain.c into your test directory, +renaming it appropriately. Write fixtures and test functions as needed and +register them in main(). Create a target in Makefile.am which has this file as +its source. + +To use suites, copy test-module.c and test-suite.c to your test directory and +rename them appropriately. You will very likely want several copies of +test-suite.c, one corresponding to each c file in the module directory that +you're testing. Edit the test module file to call the (renamed) test_suite_module() in each test-suite file. Add tests and fixtures as needed to the -test-suite files and add them to the (renamed) test_suite_module() +test-suite files and register them in the (renamed) test_suite_module() function. Edit Makefile.am according to the comments in the file. -Run autogen.sh and configure. "make check" will run all tests; "make -test" will run only the GLib unit tests not guarded by conditionals -(see test-suite.c). +Run autogen.sh and configure. "make check" will run all tests; "make test" will +run only the GLib unit tests not guarded by conditionals (see test-suite.c). For +more control, use gtester as documented in the GLib docs. See http://www.mail-archive.com/gtk-devel-list@gnome.org/msg06994.html and http://library.gnome.org/devel/glib/stable/glib-Testing.html for detailed documentation. + +There are some helpful macros and message-trapping functions in +src/test-core/unittest-support.h. diff --git a/test-templates/test-module.c b/test-templates/test-module.c index 5e1fdf213a..8686198774 100644 --- a/test-templates/test-module.c +++ b/test-templates/test-module.c @@ -31,8 +31,7 @@ extern GTestSuite *test_suite_module3(); extern GTestSuite *test_suite_module4(); int -main (int argc, - char *argv[]) +main (int argc, char *argv[]) { qof_init(); /* You may or may not need this, depending on * whether the module you're testing or any @@ -48,5 +47,3 @@ main (int argc, return g_test_run(); /* Run the result */ } - - diff --git a/test-templates/test-suite.c b/test-templates/test-suite.c index 181a534644..a8f1832487 100644 --- a/test-templates/test-suite.c +++ b/test-templates/test-suite.c @@ -20,10 +20,13 @@ * Boston, MA 02110-1301, USA gnu@gnu.org * \********************************************************************/ +/* This is a template test suite. Copy it to the test directory and name it for + * the corresponding file you're testing with a "utest-" prefix. Add it to the + * test_program_SOURCES in Makefile.am. + */ #include #include -/* This is optional; you only need it if you have external fixtures or mocks. */ -#include "test_module_support.h" +#include /* Header for this module and any others that you need */ #include @@ -31,7 +34,10 @@ * creates a nested set of test suites for us based on this path. */ static const gchar *suitename = "module/module_1"; -/* Test fixture: A struct, a setup function, and a teardown function are passed to g_test_add(); add getters, setters, and whatever other functions you need to call from your test functions. */ +/* Test fixture: A struct, a setup function, and a teardown function are passed + * to g_test_add(); add getters, setters, and whatever other functions you need + * to call from your test functions. + */ typedef struct { gint foo; @@ -39,15 +45,17 @@ typedef struct } Fixture; static void -setup_module_test(Fixture *fixture, gconstpointer pData) +setup (Fixture *fixture, gconstpointer pData) { - /* Do something useful */ + /* Whatever is needed to populate the fixture and initialize your module for + * running a single test. + */ } static void -teardown_module_test(Fixture *fixture, gconstpointer pData) +teardown (Fixture *fixture, gconstpointer pData) { - /* Clean up after ourselves */ + /* Whatever cleanup is needed at the end of the test. */ } static void @@ -92,22 +100,23 @@ test_performance_function( void ) * You can also emit arbitrary messages into the test report with * g_test_message( const char* format, ... ) */ -GTestSuite* -test_suite_module1 ( void ) +void +test_suite_module1 (void) { Datatype data = something(); - g_test_add_func( suitename, test_function ); - g_test_add_data_func( suitename, (gconstpointer)(&data), - test_function_with_data ); - g_test_add( suitename, Fixture, - data, - setup_module_test, - test_function_with_fixture, - teardown_module_test); + GNC_TEST_ADD_FUNC (suitename, "Test Name 1", test_function); + { + gchar *testpath = g_strdup_printf ("%s/Test Name 2", suitename); + g_test_add_data_func( suitename, (gconstpointer)(&data), + test_function_with_data ); + g_free (testpath); + } + GNC_TEST_ADD (suitename, "Test Name 3", Fixture, data, setup, + test_function_with_fixture, teardown); /* Other conditionals are g_test_quick(), g_test_slow(), and * g_test_thorough() */ if ( g_test_perf() ) { - g_test_add_func( suitename, test_performance_func ); + GNC_TEST_ADD_FUNC (suitename, "Test Name 4", test_performance_func); } } diff --git a/test-templates/testmain.c b/test-templates/testmain.c index a1c2908d62..ba53fb938d 100644 --- a/test-templates/testmain.c +++ b/test-templates/testmain.c @@ -21,26 +21,78 @@ \********************************************************************/ -/* This is a template test program. Copy it to the test sudirectory and rename it test_modulename.c. (Use the same modulename that you gave Makefile.am in the same directory. -Write and link other test files */ -#include +/** + * This is a template test program. Copy it to the test sudirectory and rename + * it test_modulename.c. (Use the same modulename that you gave Makefile.am in + * the same directory. + */ +#include +#include +/* Add any headers you need for the functions you're testing. */ + +/* Test fixture: A struct, a setup function, and a teardown function are passed + * to g_test_add(); add getters, setters, and whatever other functions you need + * to call from your test functions. + */ +typedef struct +{ + int a; + char* b; +} Fixture; + +static void +setup (Fixture *fixture, gconstpointer pData) +{ + /* Whatever is needed to populate the fixture and initialize your module for + * running a single test. + */ +} + +static void +teardown (Fixture *fixture, gconstpointer pData) +{ + /* Whatever cleanup is needed at the end of the test. */ +} + +static void +example_without_fixture (void) +{ + /* This test doesn't need the fixture or any preconditions. You might use + * this for a constructor test, for example. + */ +} + +static void +example_with_data( gconstpointer data ) +{ + /* We want to be able to call this function more than once with different + * data. + */ +} + +static void +example_with_fixture (Fixture *fixture, gconstpointer pData) +{ + /* This one uses the fixture. */ +} int -main (int argc, - char *argv[]) +main (int argc, char *argv[]) { - gtk_test_init (&argc, &argv); // initialize test program - /* Add test functions and suites. See + qof_init(); /* You may or may not need this, depending on + * whether the module you're testing or any + * dependencies use GObject. */ + qof_log_init_filename_special("/dev/null"); /* Initialize the + * gnucash logging system. Your tests will + * crash on the first logging call otherwise */ + g_test_init (&argc, &argv, NULL); // initialize test program + /* Add test functions. See * http://library.gnome.org/devel/glib/stable/glib-Testing.html for * details. Unfortunately, GLib-Testing doesn't provide the automatic * registration features of more sophisitcated frameworks. */ - g_test_add_func ("/TESTPROG/Test Case Name", test_case_test_func); - ScannerFixture, // fixture structure type - NULL, // unused data argument - scanner_fixture_setup, // fixture setup - test_scanner_symbols, // test function - scanner_fixture_teardown); // fixture teardown + g_test_add_func ("/TESTPROG/Test Case Name 1", example_without_fixture); + g_test_add_data_func ("/TESTPROG/Test Case Name 2", NULL); + g_test_add ("/TESTPROG/Test Case Name", Fixture, NULL, setup, + example_with_fixture, teardown); return g_test_run(); } - - From a4b0519303834905aa783af14f37160db738d667 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 28 Jul 2015 12:44:25 -0700 Subject: [PATCH 16/25] Fix up and improve the Doxygen documentation in unittest-support.h. --- src/test-core/unittest-support.h | 85 ++++++++++++++++++++++++-------- test-templates/README | 3 +- 2 files changed, 67 insertions(+), 21 deletions(-) diff --git a/src/test-core/unittest-support.h b/src/test-core/unittest-support.h index fa4d07bbf6..3497d902f0 100644 --- a/src/test-core/unittest-support.h +++ b/src/test-core/unittest-support.h @@ -25,11 +25,22 @@ #include #include +/** @file unittest-support.h + * @brief Macros and logging-capture functions to ease writing GLib-testing + * based unit tests. + */ + +/** @name Unit Test Macros + * These macros facilitate combining a suite name and a test name to make a path + * when registering a test function with the corresponding g_test_add and + * g_test_add_func. Create a const char* suitename somewhere in the file and + * pass it as the first parameter, and the test name as the second. The + * remaining parameters are the same as in the underlying function. + */ /** - * Use this macro to format informative test path output when using g_test_add. - * Suite stands for tests' pack, while path for individual test name. -*/ + * Wraps gnc_test_add() for test functions needing a fixture. + */ #define GNC_TEST_ADD( suite, path, fixture, data, setup, test, teardown )\ {\ @@ -39,9 +50,8 @@ } /** - * Use this macro to format informative test path output when using g_test_add_func. - * Suite stands for tests' pack, while path for individual test name. -*/ + * Wraps gnc_test_add_func() for test functions which don't require a fixture. + */ #define GNC_TEST_ADD_FUNC( suite, path, test )\ {\ @@ -49,9 +59,8 @@ g_test_add_func( testpath, test );\ g_free( testpath );\ } - -/** - * Suppressing Expected Errors +/** @} */ +/** @name Suppressing Expected Errors * * Functions for suppressing expected errors during tests. Pass * @@ -74,6 +83,7 @@ * NB: If you have more than one fatal error in a test function be * sure to use the test_list_handler: You can have only one fatal * handler. + * @{ */ /** @@ -115,6 +125,11 @@ TestErrorStruct* test_error_struct_new (gchar *log_domain, */ void test_error_struct_free (TestErrorStruct *); +/** + * Holds a handler instance with its TestErrorStruct, handler id, and whether + * it's a list handler. A test fixture can be set up to hold a GSList of these + * so that they can be automatically unregistered and freed during teardown. + */ typedef struct { TestErrorStruct *error; @@ -158,7 +173,9 @@ GSList *test_log_set_handler (GSList *list, TestErrorStruct *error, GSList *test_log_set_fatal_handler (GSList *list, TestErrorStruct *error, GLogFunc handler); -/* Clears all the log handlers. Pass this to g_slist_free() in teardown */ +/** + * Clears all the log handlers. Pass this to g_slist_free() in teardown. + */ void test_free_log_handler (gpointer item); /** @@ -193,8 +210,7 @@ gboolean test_null_handler (const char *log_domain, GLogLevelFlags log_level, * Call test_add_error for each TestErrorStruct to check against and * test_clear_error_list when you no longer expect the errors. */ -void test_add_error (TestErrorStruct *error); -void test_clear_error_list (void); +void test_add_error (TestErrorStruct *error)voidvoid test_clear_error_list (void); /** * Checks received errors against the list created by @@ -236,7 +252,14 @@ gpointer test_reset_data( void ); */ void test_free( gpointer data ); -/* TestSignal is an opaque struct used to mock handling signals +/** @} + */ +/** @name Test Signals + * Test the emission of signals from objects. Signals are used to coordinate the + * behavior of the GUI with events in other parts of the program. @{ + */ +/** + * TestSignal is an opaque struct used to mock handling signals * emitted by functions-under-test. It registers a handler and counts * how many times it is called with the right instance and type. The * struct is allocated using g_slice_new, and it registers a @@ -249,30 +272,51 @@ void test_free( gpointer data ); * passed to test_signal_new should be NULL to avoid the test. */ typedef gpointer TestSignal; + +/** + * Create a test signal. + * @param entity: The QofInstance emitting the signal + * @param eventType: The type of the signal + * @param event_data: Any data required by the signal or NULL if none is. + * @return A newly created TestSignal. Use test_signal_free to release it. + */ + TestSignal test_signal_new (QofInstance *entity, QofEventId eventType, gpointer event_data); -/* test_signal_return_hits gets the number of times the TestSignal has - * been called. +/** + * gets the number of times the TestSignal has been called. */ guint test_signal_return_hits (TestSignal sig); -/* test_signal_assert_hits is a convenience macro which wraps - * test_signal_return_hits with and equality assertion. +/** + * Convenience macro which wraps test_signal_return_hits with and equality + * assertion. */ #define test_signal_assert_hits(sig, hits) \ g_assert_cmpint (test_signal_return_hits (sig), ==, hits) +/** + * Free a test signal. + */ void test_signal_free (TestSignal sig); -/* test_object_checked_destroy unrefs obj and returns true if its finalize - * method was called. +/** @} + */ + +/** @name Testing for object disposal + * Sometimes we need to make sure that certain objects that we've created aren't leaking. These functions can help. + * @{ + */ + +/** + * Unrefs obj and returns true if its finalize method was called. */ gboolean test_object_checked_destroy (GObject *obj); /** - * test_destroy() ensures that a GObject is still alive at the time + * Ensures that a GObject is still alive at the time * it's called and that it is finalized. The first assertion will * trigger if you pass it a ponter which isn't a GObject -- which * could be the case if the object has already been finalized. Then it @@ -284,6 +328,7 @@ gboolean test_object_checked_destroy (GObject *obj); g_assert (obj != NULL && G_IS_OBJECT (obj)); \ g_assert (test_object_checked_destroy (G_OBJECT (obj))) +/** @} */ /* For Scheme testing access: void gnc_log_init_filename_special (gchar *filename); void gnc_log_shutdown (void); diff --git a/test-templates/README b/test-templates/README index 0a5a026dc3..10d8fa6baf 100644 --- a/test-templates/README +++ b/test-templates/README @@ -40,4 +40,5 @@ and http://library.gnome.org/devel/glib/stable/glib-Testing.html for detailed documentation. There are some helpful macros and message-trapping functions in -src/test-core/unittest-support.h. +src/test-core/unittest-support.h, whose Doxygen documentation is at +http://code.gnucash.org/docs/head/unittest-support_8h_source.html From 9333344ee099559dfe4358b581caf50eebea0ddf Mon Sep 17 00:00:00 2001 From: Mike Evans Date: Thu, 30 Jul 2015 13:01:02 +0100 Subject: [PATCH 17/25] Fix apparent typo preventing build. --- src/test-core/unittest-support.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test-core/unittest-support.h b/src/test-core/unittest-support.h index 3497d902f0..ba1f96007d 100644 --- a/src/test-core/unittest-support.h +++ b/src/test-core/unittest-support.h @@ -210,7 +210,8 @@ gboolean test_null_handler (const char *log_domain, GLogLevelFlags log_level, * Call test_add_error for each TestErrorStruct to check against and * test_clear_error_list when you no longer expect the errors. */ -void test_add_error (TestErrorStruct *error)voidvoid test_clear_error_list (void); +void test_add_error (TestErrorStruct *error); +void test_clear_error_list (void); /** * Checks received errors against the list created by From 567f61fe3ccf058a1a24b84b0cb18efd5781d50c Mon Sep 17 00:00:00 2001 From: John Ralls Date: Thu, 30 Jul 2015 09:56:28 -0700 Subject: [PATCH 18/25] Add make_testfile suggestion to test-templates README. --- test-templates/README | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test-templates/README b/test-templates/README index 10d8fa6baf..bfabd7c573 100644 --- a/test-templates/README +++ b/test-templates/README @@ -29,6 +29,13 @@ each test-suite file. Add tests and fixtures as needed to the test-suite files and register them in the (renamed) test_suite_module() function. +Alternatively you can use the make_testfile perl program in this directory to +create a skeleton test-suite file for your target file. In addition to creating +a template test function for each function in the target source file and a +template test-suite function at the end, it will comment each template function +with the usage of that function both internally and externally. Run `perldoc +make_testfile` to read more. + Edit Makefile.am according to the comments in the file. Run autogen.sh and configure. "make check" will run all tests; "make test" will From 1bf8326f54973b97d18ea37c9d87a43fd435b2de Mon Sep 17 00:00:00 2001 From: Mechtilde Date: Sat, 9 May 2015 11:47:20 +0200 Subject: [PATCH 19/25] add translation for reports --- po/de.po | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/po/de.po b/po/de.po index 1b02975780..01e6ebcf4e 100644 --- a/po/de.po +++ b/po/de.po @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: gnucash-2.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-01-19 21:02+0100\n" -"PO-Revision-Date: 2015-04-11 08:40+0200\n" +"PO-Revision-Date: 2015-05-09 11:42+0200\n" "Last-Translator: Mechtilde \n" "Language-Team: GnuCash-de \n" "Language: German\n" @@ -14921,7 +14921,7 @@ msgstr "Ausgewählte Buchungen abgleichen löschen" #: ../src/gnome/window-reconcile2.c:2218 ../src/gnome/window-reconcile.c:2218 #, fuzzy msgid "_Unreconcile Selection" -msgstr "_Nicht abgeglichen" +msgstr "_Nicht abgeglichen/Auswahl" #: ../src/gnome/window-reconcile2.c:2219 ../src/gnome/window-reconcile.c:2219 #, fuzzy @@ -18570,6 +18570,11 @@ msgid "" "Configuration\" from\n" "the Reports menu or tool bar." msgstr "" +"Gespeicherte Berichtskonfigurationen werden erstellt, wenn ein Bericht das " +"erste Mal aus dem Menü 'Berichte' geöffnet wird.\n" +"Nachdem Sie die Berichtsoptionen an Ihren Bedarf angepasst haben, wählen " +"Sie \" Berichtskonfiguration speichern\" aus\n" +"dem Menü 'Bericht' oder der Symbolleiste." #: ../src/report/report-gnome/dialog-report-column-view.c:321 msgid "Contents" From 2a775024a3a10652321a4c7a2faacede3625780a Mon Sep 17 00:00:00 2001 From: Mechtilde Date: Sat, 23 May 2015 16:20:27 +0200 Subject: [PATCH 20/25] added more German translation --- po/de.po | 69 ++++++++++++++++---------------------------------------- 1 file changed, 20 insertions(+), 49 deletions(-) diff --git a/po/de.po b/po/de.po index 01e6ebcf4e..f84901169a 100644 --- a/po/de.po +++ b/po/de.po @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: gnucash-2.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-01-19 21:02+0100\n" -"PO-Revision-Date: 2015-05-09 11:42+0200\n" +"PO-Revision-Date: 2015-05-23 16:19+0200\n" "Last-Translator: Mechtilde \n" "Language-Team: GnuCash-de \n" "Language: German\n" @@ -8982,7 +8982,6 @@ msgstr "" "müssen nun geändert werden. Klicken Sie Ok, um sie zu ändern." #: ../src/gnome/gtkbuilder/dialog-sx.glade.h:4 -#, fuzzy msgid "Since Last Run" msgstr "Seit-letztem-Aufruf Fenster" @@ -8995,25 +8994,21 @@ msgid "_Run when data file opened" msgstr "Seit-Letztem-Aufruf Fenster starten, wenn eine _Datei geöffnet wird" #: ../src/gnome/gtkbuilder/dialog-sx.glade.h:7 -#, fuzzy msgid "Run the \"since last run\" process when a file is opened." msgstr "" -"Das Fenster »Seit letztem Aufruf« anzeigen, wenn eine Datei geöffnet wird " -"oder beim Programmstart von GnuCash." +"Lasse den »Seit letztem Aufruf« Pozess laufen, eine Datei geöffnet wird " #: ../src/gnome/gtkbuilder/dialog-sx.glade.h:8 -#, fuzzy msgid "_Show notification window" -msgstr "Verlaufs_fenster anzeigen" +msgstr "Benachrichtigungs_fenster anzeigen" #: ../src/gnome/gtkbuilder/dialog-sx.glade.h:9 -#, fuzzy msgid "" "Show the notification window for the \"since last run\" process when a file " "is opened." msgstr "" -"Das Fenster »Seit letztem Aufruf« anzeigen, wenn eine Datei geöffnet wird " -"oder beim Programmstart von GnuCash." +"Das Benachrichtigungsfenster »Seit letztem Aufruf« anzeigen, wenn eine " +"Datei geöffnet wird " #: ../src/gnome/gtkbuilder/dialog-sx.glade.h:10 msgid "_Auto-create new transactions" @@ -9194,7 +9189,6 @@ msgid "Income Tax Identity" msgstr "Art der Steuererklärung" #: ../src/gnome/gtkbuilder/dialog-tax-info.glade.h:5 -#, fuzzy msgid "Click to change Tax Name and/or Tax Type." msgstr "Anklicken, um Name oder Typ der Steuern zu ändern" @@ -9432,9 +9426,8 @@ msgstr "Alle auswählen" #: ../src/gnome/gtkbuilder/gnc-plugin-page-register2.glade.h:24 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:25 -#, fuzzy msgid "Sa_ve Filter" -msgstr "%s in Datei speichern" +msgstr "Filter speichern" #: ../src/gnome/gtkbuilder/gnc-plugin-page-register2.glade.h:25 #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:51 @@ -9499,7 +9492,6 @@ msgstr "_Betrag" #. src/report/standard-reports/transaction.scm #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:38 #: ../intl-scm/guile-strings.c:4570 ../intl-scm/guile-strings.c:4626 -#, fuzzy msgid "Sort by amount." msgstr "Sortieren nach Summe" @@ -9510,14 +9502,12 @@ msgstr "Buchungstext" #. src/report/standard-reports/transaction.scm #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:40 #: ../intl-scm/guile-strings.c:4586 ../intl-scm/guile-strings.c:4638 -#, fuzzy msgid "Sort by memo." msgstr "Sortiere nach Buchungstext" #. src/report/standard-reports/transaction.scm #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:42 #: ../intl-scm/guile-strings.c:4574 ../intl-scm/guile-strings.c:4630 -#, fuzzy msgid "Sort by description." msgstr "Sortieren nach Beschreibung" @@ -9526,23 +9516,20 @@ msgid "_Action" msgstr "A_ktionen" #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:44 -#, fuzzy msgid "Sort by action field." -msgstr "Sortiere nach Aktion" +msgstr "Sortiere nach Aktionsfeld" #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:45 msgid "_Notes" msgstr "_Bemerkung" #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:46 -#, fuzzy msgid "Sort by notes field." -msgstr "Sortiere nach Bemerkung" +msgstr "Sortiere nach Bemerkungsfeld" #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:47 -#, fuzzy msgid "Sa_ve Sort Order" -msgstr "Sortierreihenfolge" +msgstr "Sortierreihenfolge speichern" #: ../src/gnome/gtkbuilder/gnc-plugin-page-register.glade.h:48 #, fuzzy @@ -11107,7 +11094,6 @@ msgid "View..." msgstr "Ansicht..." #: ../src/gnome-utils/gnc-gnome-utils.c:236 -#, fuzzy msgid "" "GnuCash could not find the files for the help documentation. This is likely " "because the 'gnucash-docs' package is not installed" @@ -11463,9 +11449,8 @@ msgstr "" "GnuCash: Ihr privater Finanzmanager. Die freie Lösung zur Finanzverwaltung." #: ../src/gnome-utils/gnc-main-window.c:4379 -#, fuzzy msgid "© 1997-2014 Contributors" -msgstr "© 1997-2013 Mitarbeiter" +msgstr "© 1997-2015 Mitwirkende" #. Translators: the following string will be shown in Help->About->Credits #. * Enter your name or that of your team and an email contact for feedback. @@ -13452,7 +13437,6 @@ msgid "Use _formal accounting labels" msgstr "Buchungsüberschriften aus _Rechnungswesen" #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:20 -#, fuzzy msgid "Use only 'debit' and 'credit' instead of informal synonyms." msgstr "Nur 'Soll' und 'Haben' anstatt informeller Bezeichnungen benutzen" @@ -13656,7 +13640,6 @@ msgid "Display ne_gative amounts in red" msgstr "Negative Beträge in rot anzeigen" #: ../src/gnome-utils/gtkbuilder/dialog-preferences.glade.h:77 -#, fuzzy msgid "Display negative amounts in red." msgstr "Negative Beträge in rot anzeigen" @@ -16210,7 +16193,6 @@ msgid "To Num." msgstr "Bis Nr." #: ../src/import-export/csv-exp/csv-transactions-export.c:425 -#, fuzzy msgid "From Num." msgstr "Von Nr." @@ -16253,14 +16235,12 @@ msgid "notes" msgstr "Bemerkung" #: ../src/import-export/csv-exp/csv-tree-export.c:157 -#, fuzzy msgid "commoditym" -msgstr "Devise/Wertpapier" +msgstr "Devise/Wertpapier M" #: ../src/import-export/csv-exp/csv-tree-export.c:157 -#, fuzzy msgid "commodityn" -msgstr "Devise/Wertpapier" +msgstr "Devise/Wertpapier N" #: ../src/import-export/csv-exp/csv-tree-export.c:158 msgid "hidden" @@ -18386,13 +18366,12 @@ msgid "T-Num" msgstr "B.-Nr." #: ../src/register/ledger-core/split-register-model.c:381 -#, fuzzy msgid "Exch. Rate" msgstr "Wechselkurs:" #: ../src/register/ledger-core/split-register-model.c:398 msgid "Oth. Curr." -msgstr "" +msgstr "Andere Währung" #: ../src/register/ledger-core/split-register-model.c:415 #: ../src/register/ledger-core/split-register-model.c:439 @@ -18507,22 +18486,18 @@ msgid "List" msgstr "Liste" #: ../src/report/report-gnome/dialog-custom-report.c:421 -#, fuzzy msgid "You must select a report configuration to load." -msgstr "Sie müssen einen Bericht auswählen, den Sie erstellen wollen." +msgstr "Sie müssen eine Berichtskonfiguration auswählen, die Sie erstellen wollen." #: ../src/report/report-gnome/dialog-custom-report.c:432 -#, fuzzy msgid "You must select a report configuration to delete." -msgstr "Sie müssen einen Bericht auswählen, den Sie löschen wollen." +msgstr "Sie müssen einen Berichtskonfiguration auswählen, die Sie löschen wollen." #: ../src/report/report-gnome/dialog-custom-report.c:441 -#, fuzzy msgid "Unable to change report configuration name." -msgstr "Berichtsname konnte nicht geändert werden." +msgstr "Berichtskonfiguration konnte nicht geändert werden." #: ../src/report/report-gnome/dialog-custom-report.c:453 -#, fuzzy msgid "" "A saved report configuration with this name already exists, please choose " "another name." @@ -18531,14 +18506,12 @@ msgstr "" "Sie einen anderen Namen ein." #: ../src/report/report-gnome/dialog-custom-report.c:477 -#, fuzzy msgid "Load report configuration" -msgstr "Name der Konfiguration ändern" +msgstr "Berichtskonfiguration laden" #: ../src/report/report-gnome/dialog-custom-report.c:479 -#, fuzzy msgid "Edit report configuration name" -msgstr "Name der Konfiguration ändern" +msgstr "Berichtskonfiguration ändern" #: ../src/report/report-gnome/dialog-custom-report.c:481 msgid "Delete report configuration" @@ -21101,7 +21074,7 @@ msgstr "" #. src/report/business-reports/invoice.scm #: ../intl-scm/guile-strings.c:910 ../intl-scm/guile-strings.c:1092 #: ../intl-scm/guile-strings.c:1302 -msgid "Thank you for your patronage" +msgid "Thank you for your patronage!" msgstr "Vielen Dank für das uns engegengebrachte Vertrauen!" #. src/report/business-reports/easy-invoice.scm @@ -26931,16 +26904,14 @@ msgstr "Willkommen zu GnuCash" #. src/report/utility-reports/welcome-to-gnucash.scm #: ../intl-scm/guile-strings.c:5846 -#, fuzzy msgid "Welcome to GnuCash ~a !" msgstr "Willkommen zu GnuCash" #. src/report/utility-reports/welcome-to-gnucash.scm #: ../intl-scm/guile-strings.c:5848 -#, fuzzy msgid "GnuCash ~a has lots of nice features. Here are a few." msgstr "" -"GnuCash 2.4 hat viele neue Funktionen. Hier werden einige Beispiele gegeben." +"GnuCash hat viele neue Funktionen. Hier sind einige Beispiele." #. src/scm/price-quotes.scm #: ../intl-scm/guile-strings.c:5852 ../intl-scm/guile-strings.c:5854 From 226b1b29f14321eb4d7657eb93f2e0e19b01acb7 Mon Sep 17 00:00:00 2001 From: Mechtilde Date: Mon, 25 May 2015 17:39:07 +0200 Subject: [PATCH 21/25] even more German translation --- po/de.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/po/de.po b/po/de.po index f84901169a..73de6e38ac 100644 --- a/po/de.po +++ b/po/de.po @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: gnucash-2.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-01-19 21:02+0100\n" -"PO-Revision-Date: 2015-05-23 16:19+0200\n" +"PO-Revision-Date: 2015-05-25 17:38+0200\n" "Last-Translator: Mechtilde \n" "Language-Team: GnuCash-de \n" "Language: German\n" From 373b1e8b4e87a72c07a367b39c7b70e24a8288de Mon Sep 17 00:00:00 2001 From: Mechtilde Date: Sat, 4 Jul 2015 17:58:21 +0200 Subject: [PATCH 22/25] some more German translations --- po/de.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/po/de.po b/po/de.po index 73de6e38ac..161d645ed6 100644 --- a/po/de.po +++ b/po/de.po @@ -8996,7 +8996,7 @@ msgstr "Seit-Letztem-Aufruf Fenster starten, wenn eine _Datei geöffnet wird" #: ../src/gnome/gtkbuilder/dialog-sx.glade.h:7 msgid "Run the \"since last run\" process when a file is opened." msgstr "" -"Lasse den »Seit letztem Aufruf« Pozess laufen, eine Datei geöffnet wird " +"Lasse den »Seit letztem Aufruf« Pozess laufen, wenn eine Datei geöffnet wird " #: ../src/gnome/gtkbuilder/dialog-sx.glade.h:8 msgid "_Show notification window" @@ -14904,7 +14904,7 @@ msgstr "Ausgewählte Buchungen abgleichen löschen" #: ../src/gnome/window-reconcile2.c:2218 ../src/gnome/window-reconcile.c:2218 #, fuzzy msgid "_Unreconcile Selection" -msgstr "_Nicht abgeglichen/Auswahl" +msgstr "_Nicht abgegliche Auswahl" #: ../src/gnome/window-reconcile2.c:2219 ../src/gnome/window-reconcile.c:2219 #, fuzzy From 9d16d969eae2440c28a1ee1effdb03d508549a93 Mon Sep 17 00:00:00 2001 From: Mechtilde Date: Sun, 5 Jul 2015 19:05:24 +0200 Subject: [PATCH 23/25] New German translations - after sending the others to Frank --- po/de.po | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/po/de.po b/po/de.po index 161d645ed6..da1b1ded67 100644 --- a/po/de.po +++ b/po/de.po @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: gnucash-2.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-01-19 21:02+0100\n" -"PO-Revision-Date: 2015-05-25 17:38+0200\n" +"PO-Revision-Date: 2015-07-04 19:03+0200\n" "Last-Translator: Mechtilde \n" "Language-Team: GnuCash-de \n" "Language: German\n" @@ -5777,9 +5777,9 @@ msgstr "Kontobuch als Bericht für dieses Konto öffnen" #: ../src/gnome/gnc-plugin-page-register2.c:392 #: ../src/gnome/gnc-plugin-page-register.c:401 -#, fuzzy + msgid "Account Report - Single Transaction" -msgstr "Online-Überweisung eingeben" +msgstr "Kontenbuch - Einzelüberweisung" #: ../src/gnome/gnc-plugin-page-register2.c:393 #: ../src/gnome/gnc-plugin-page-register.c:402 @@ -14787,8 +14787,7 @@ msgstr "Haben" #: ../src/gnome/window-reconcile2.c:1270 ../src/gnome/window-reconcile.c:1270 msgid "Are you sure you want to delete the selected transaction?" -msgstr "" -"Sind Sie sicher, dass Sie den ausgewählten Buchungssatz löschen wollen?" +msgstr "Sind Sie sicher, dass Sie den ausgewählten Buchungssatz löschen wollen?" #. statement date title/value #: ../src/gnome/window-reconcile2.c:1800 ../src/gnome/window-reconcile.c:1800 @@ -14902,14 +14901,12 @@ msgid "Reconcile the selected transactions" msgstr "Ausgewählte Buchungen abgleichen löschen" #: ../src/gnome/window-reconcile2.c:2218 ../src/gnome/window-reconcile.c:2218 -#, fuzzy msgid "_Unreconcile Selection" -msgstr "_Nicht abgegliche Auswahl" +msgstr "_Nicht abgeglichene Auswahl" #: ../src/gnome/window-reconcile2.c:2219 ../src/gnome/window-reconcile.c:2219 -#, fuzzy msgid "Unreconcile the selected transactions" -msgstr "Ausgewählten Buchungssatz löschen" +msgstr "Ausgewählten Buchungssatz nicht abgleichen" #: ../src/gnome/window-reconcile2.c:2227 ../src/gnome/window-reconcile.c:2227 msgid "Open the GnuCash help window" @@ -15706,14 +15703,13 @@ msgid "" "Result of Online Banking job: \n" "Account booked balance is %s" msgstr "" -"Ergebnis der Saldenabfrage:\n" +"Ergebnis der Saldenabfrage: \n" "Gebuchter Saldo des Kontos ist %s" #: ../src/import-export/aqb/gnc-ab-utils.c:969 #, c-format msgid "For your information: This account also has a noted balance of %s\n" -msgstr "" -"Zu Ihrer Information: Dieses Konto hat außerdem folgenden Saldo an zur " +msgstr "Zu Ihrer Information: Dieses Konto hat außerdem folgenden Saldo an zur " "Ausführung vorgemerkten Aufträgen: %s\n" #: ../src/import-export/aqb/gnc-ab-utils.c:976 From b41c86da31a02a6498c8f9529cd3763f5df74f79 Mon Sep 17 00:00:00 2001 From: Mechtilde Date: Fri, 10 Jul 2015 20:53:26 +0200 Subject: [PATCH 24/25] More new German translation --- po/de.po | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/po/de.po b/po/de.po index da1b1ded67..3ad394d6e6 100644 --- a/po/de.po +++ b/po/de.po @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: gnucash-2.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-01-19 21:02+0100\n" -"PO-Revision-Date: 2015-07-04 19:03+0200\n" +"PO-Revision-Date: 2015-07-10 20:51+0200\n" "Last-Translator: Mechtilde \n" "Language-Team: GnuCash-de \n" "Language: German\n" @@ -9865,9 +9865,8 @@ msgstr "entspricht nicht regulärem Ausdruck" #. Build and connect the case-sensitive check button; defaults to off #: ../src/gnome-search/search-string.c:329 -#, fuzzy msgid "Match case" -msgstr "Passt?" +msgstr "Groß-/Kleinschreibung beachten" #: ../src/gnome/top-level.c:98 #, c-format @@ -11118,14 +11117,12 @@ msgstr "Die Dateien für die Hilfe-Dokumentation konnten nicht gefunden werden." #: ../src/gnome-utils/gnc-gnome-utils.c:415 #: ../src/gnome-utils/gnc-gnome-utils.c:440 -#, fuzzy msgid "GnuCash could not find the associated file." -msgstr "GnuCash konnte keine exklusive Schreibberechtigung für %s erreichen." +msgstr "GnuCash konnte die dazugehörige Datei nicht finden." #: ../src/gnome-utils/gnc-gnome-utils.c:466 -#, fuzzy msgid "GnuCash could not open the associated URI:" -msgstr "GnuCash konnte keine exklusive Schreibberechtigung für %s erreichen." +msgstr "GnuCash konnte die dazugehörige URI nicht öffnen." #: ../src/gnome-utils/gnc-icons.c:19 msgid "_Delete Account" @@ -11576,22 +11573,17 @@ msgid "Save Transaction before proceeding?" msgstr "Buchungsänderungen speichern, bevor es weitergeht?" #: ../src/gnome-utils/gnc-tree-control-split-reg.c:133 -#, fuzzy msgid "" "The current transaction has been changed. Would you like to record the " "changes before proceeding, or cancel?" msgstr "" -"Der aktuelle Eintrag wurde verändert. Wollen Sie die Änderungen speichern, " -"bevor Sie die Kopie erstellen, oder soll der Kopiervorgang abgebrochen " -"werden?" +"Der aktuelle Buchung wurde verändert. Wollen Sie die Änderungen aufzeichnen, " +"bevor Sie weitermachen oder abbrechen. " #: ../src/gnome-utils/gnc-tree-control-split-reg.c:185 -#, fuzzy msgid "This transaction is being edited in a different register." msgstr "" -"Diese Buchung wird bereits von einem anderen Kontofenster aus bearbeitet. " -"Bitte beenden Sie zuerst diese Bearbeitung, indem Sie in dem anderen " -"Kontofenster »Eingabe« oder »Abbrechen« wählen. " +"Diese Buchung wird bereits in einem anderen Kontofenster bearbeitet. " #: ../src/gnome-utils/gnc-tree-control-split-reg.c:205 #: ../src/register/ledger-core/split-register-control.c:58 From 18196171ad58eb8a8e4805c9736cb368e6c26f16 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 1 Aug 2015 16:26:53 -0700 Subject: [PATCH 25/25] Bug 753146 - free(): invalid pointer on duplicate transaction when Use Split Action Field for Number is set. --- src/register/ledger-core/split-register.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/register/ledger-core/split-register.c b/src/register/ledger-core/split-register.c index 90b831af85..35316331d8 100644 --- a/src/register/ledger-core/split-register.c +++ b/src/register/ledger-core/split-register.c @@ -494,7 +494,7 @@ gnc_split_register_duplicate_current (SplitRegister *reg) /* We are on a split in an expanded transaction. * Just copy the split and add it to the transaction. - * However, if the split-action field is being used as the register + * However, if the split-action field is being used as the register * number, and the action field is a number, request a new value or * cancel. Need to get next number and update account last num from * split account not register account, which may be the same or not */ @@ -566,8 +566,8 @@ gnc_split_register_duplicate_current (SplitRegister *reg) int split_index; const char *in_num = NULL; const char *in_tnum = NULL; - char *out_num; - char *out_tnum; + char *out_num = NULL; + char *out_tnum = NULL; time64 date; gboolean use_autoreadonly = qof_book_uses_autoreadonly(gnc_get_current_book());