gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Tue Jan 1 16:14:16 EST 2019
Updated via https://github.com/Gnucash/gnucash/commit/3a105f07 (commit)
via https://github.com/Gnucash/gnucash/commit/95bee405 (commit)
via https://github.com/Gnucash/gnucash/commit/cc3bb4ef (commit)
from https://github.com/Gnucash/gnucash/commit/0f53b6c8 (commit)
commit 3a105f0728984df7f063110acc8390c93722d581
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Jan 1 13:12:39 2019 -0800
Catch boost::locale character-conversion exceptions.
Partial cause of the crash reported in Bug 797002.
diff --git a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
index e460d3c..777caf4 100644
--- a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
+++ b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
@@ -2065,9 +2065,22 @@ CsvImpTransAssist::assist_summary_page_prepare ()
gen.add_messages_domain(GETTEXT_PACKAGE);
auto text = std::string("<span size=\"medium\"><b>");
+ try
+ {
/* Translators: {1} will be replaced with a filename */
- text += (bl::format (bl::translate ("The transactions were imported from file '{1}'.")) % m_file_name).str(gen(""));
- text += "</b></span>";
+ text += (bl::format (bl::translate ("The transactions were imported from file '{1}'.")) % m_file_name).str(gen(""));
+ text += "</b></span>";
+ }
+ catch (const bl::conv::conversion_error& err)
+ {
+ PERR("Transcoding error: %s", err.what());
+ text += "The transactions were imported from the file.</b></span>";
+ }
+ catch (const bl::conv::invalid_charset_error& err)
+ {
+ PERR("Invalid charset error: %s", err.what());
+ text += "The transactions were imported from the file.</b></span>";
+ }
gtk_label_set_markup (GTK_LABEL(summary_label), text.c_str());
}
commit 95bee405cf5568f5899287ba62058cf894361676
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Wed Jan 2 00:00:56 2019 +0800
[test-transaction] fix a test which was hardcoded to 2018.
This test was hard-coded to pass in 2018. Fix.
diff --git a/gnucash/report/standard-reports/test/test-transaction.scm b/gnucash/report/standard-reports/test/test-transaction.scm
index 755aba2..2f428e2 100644
--- a/gnucash/report/standard-reports/test/test-transaction.scm
+++ b/gnucash/report/standard-reports/test/test-transaction.scm
@@ -652,8 +652,8 @@
(list "Grand Total" "$2,280.00" "$2,280.00")
(get-row-col sxml -1 #f))
(test-equal "dual amount column, first transaction correct"
- (list "01/03/18" "$103 income" "Root.Asset.Bank" "$103.00" "$103.00")
- (get-row-col sxml 1 #f)))
+ (list "$103 income" "Root.Asset.Bank" "$103.00" "$103.00")
+ (cdr (get-row-col sxml 1 #f))))
)
(test-end "display options")
commit cc3bb4ef20fb5f9de6e5b08687817f89fe94e9a6
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Sun Dec 30 08:55:46 2018 +0800
[report-utilities] deprecate gnc:account-get-pos-trans-total-interval
this function is only used in trial-balance. move function locally and
deprecate exported function.
diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index de91cc4..170a51a 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -754,6 +754,8 @@ flawed. see report-utilities.scm. please update reports.")
;; *ignores* any closing entries
(define (gnc:account-get-pos-trans-total-interval
account-list type start-date end-date)
+ (issue-deprecation-warning
+ "(gnc:account-get-pos-trans-total-interval) is deprecated.")
(let* ((str-query (qof-query-create-for-splits))
(sign-query (qof-query-create-for-splits))
(total-query #f)
diff --git a/gnucash/report/standard-reports/trial-balance.scm b/gnucash/report/standard-reports/trial-balance.scm
index 73693ea..4f6c8c7 100644
--- a/gnucash/report/standard-reports/trial-balance.scm
+++ b/gnucash/report/standard-reports/trial-balance.scm
@@ -320,6 +320,57 @@
options))
+(define (account-get-pos-trans-total-interval
+ account-list type start-date end-date)
+ (let* ((str-query (qof-query-create-for-splits))
+ (sign-query (qof-query-create-for-splits))
+ (total-query #f)
+ (get-val (lambda (alist key)
+ (let ((lst (assoc-ref alist key)))
+ (and lst (car lst)))))
+ (matchstr (get-val type 'str))
+ (case-sens (and (get-val type 'cased) #t))
+ (regexp (and (get-val type 'regexp) #t))
+ (pos? (and (get-val type 'positive) #t))
+ (total (gnc:make-commodity-collector)))
+ (qof-query-set-book str-query (gnc-get-current-book))
+ (qof-query-set-book sign-query (gnc-get-current-book))
+ (gnc:query-set-match-non-voids-only! str-query (gnc-get-current-book))
+ (gnc:query-set-match-non-voids-only! sign-query (gnc-get-current-book))
+ (xaccQueryAddAccountMatch str-query account-list QOF-GUID-MATCH-ANY QOF-QUERY-AND)
+ (xaccQueryAddAccountMatch sign-query account-list QOF-GUID-MATCH-ANY QOF-QUERY-AND)
+ (xaccQueryAddDateMatchTT str-query
+ (and start-date #t) (or start-date 0)
+ (and end-date #t) (or end-date 0)
+ QOF-QUERY-AND)
+ (xaccQueryAddDateMatchTT sign-query
+ (and start-date #t) (or start-date 0)
+ (and end-date #t) (or end-date 0)
+ QOF-QUERY-AND)
+ (xaccQueryAddDescriptionMatch
+ str-query matchstr case-sens regexp QOF-COMPARE-CONTAINS QOF-QUERY-AND)
+ (set! total-query
+ ;; this is a tad inefficient, but its a simple way to accomplish
+ ;; description match inversion...
+ (if pos?
+ (qof-query-merge-in-place sign-query str-query QOF-QUERY-AND)
+ (let ((inv-query (qof-query-invert str-query)))
+ (qof-query-merge-in-place
+ sign-query inv-query QOF-QUERY-AND)
+ qof-query-destroy inv-query)))
+ (qof-query-destroy str-query)
+
+ (map
+ (lambda (split)
+ (let* ((shares (xaccSplitGetAmount split))
+ (acct-comm (xaccAccountGetCommodity
+ (xaccSplitGetAccount split))))
+ (unless (negative? shares)
+ (total 'add acct-comm shares))))
+ (qof-query-run total-query))
+ (qof-query-destroy total-query)
+ total))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; trial-balance-renderer
;; set up the document and add the table
@@ -766,7 +817,7 @@
(pos-adjusting
(and ga-or-is?
adjusting
- (gnc:account-get-pos-trans-total-interval
+ (account-get-pos-trans-total-interval
group
(list (list 'str adjusting-str)
(list 'cased adjusting-cased)
Summary of changes:
.../csv-imp/assistant-csv-trans-import.cpp | 17 ++++++-
gnucash/report/report-system/report-utilities.scm | 2 +
.../standard-reports/test/test-transaction.scm | 4 +-
gnucash/report/standard-reports/trial-balance.scm | 53 +++++++++++++++++++++-
4 files changed, 71 insertions(+), 5 deletions(-)
More information about the gnucash-changes
mailing list