gnucash maint: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Tue Mar 12 05:44:02 EDT 2019
Updated via https://github.com/Gnucash/gnucash/commit/fc805d61 (commit)
via https://github.com/Gnucash/gnucash/commit/4ee0c3ef (commit)
from https://github.com/Gnucash/gnucash/commit/d6f4831a (commit)
commit fc805d6155ae7037af82fc0831c6b9e355073b86
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Mar 12 17:03:46 2019 +0800
[report-utilities] fix gnc:strify for value/commodity collectors
this debugging tool was flawed and was not able to strify the value
collector. we have to forego the procedure->str strify function
because scheme isn't typed and procedures would be called by the
value-collector section.
diff --git a/gnucash/report/report-system/report-utilities.scm b/gnucash/report/report-system/report-utilities.scm
index 3bacd3a28..8fb4f9e1b 100644
--- a/gnucash/report/report-system/report-utilities.scm
+++ b/gnucash/report/report-system/report-utilities.scm
@@ -1093,17 +1093,14 @@ flawed. see report-utilities.scm. please update reports.")
(map gnc:strify (coll 'format gnc:make-gnc-monetary #f))))
(define (value-collector->str coll)
(format #f "Val-coll<~a>"
- (map gnc:strify (coll 'total gnc:make-gnc-monetary))))
- (define (procedure->str proc)
- (format #f "Proc<~a>"
- (or (procedure-name proc) "unk")))
+ (gnc:strify (coll 'total gnc:make-gnc-monetary))))
(define (monetary->string mon)
(format #f "Mon<~a>"
(gnc:monetary->string mon)))
(define (try proc)
;; Try proc with d as a parameter, catching 'wrong-type-arg
;; exceptions to return #f to the (or) evaluator below.
- (catch 'wrong-type-arg
+ (catch #t
(lambda () (proc d))
(const #f)))
(or (and (boolean? d) (if d "#t" "#f"))
@@ -1119,7 +1116,6 @@ flawed. see report-utilities.scm. please update reports.")
(if (eq? (car d) 'absolute)
(qof-print-date (cdr d))
(gnc:strify (cdr d)))))
- (try procedure->str)
(try gnc-commodity-get-mnemonic)
(try account->str)
(try split->str)
diff --git a/gnucash/report/report-system/test/test-report-utilities.scm b/gnucash/report/report-system/test/test-report-utilities.scm
index f58878fb1..d1f3cdf46 100644
--- a/gnucash/report/report-system/test/test-report-utilities.scm
+++ b/gnucash/report/report-system/test/test-report-utilities.scm
@@ -129,9 +129,20 @@
(test-equal "gnc:strify (a . 2)"
"('a . 2)"
(gnc:strify (cons 'a 2)))
- (test-equal "gnc:strify cons"
- "Proc<cons>"
- (gnc:strify cons)))
+ (let ((m (gnc:make-value-collector)))
+ (m 'add 20)
+ (test-equal "value-collector"
+ "Val-coll<20>"
+ (gnc:strify m)))
+ (let* ((m (gnc:make-commodity-collector))
+ (book (gnc-get-current-book))
+ (comm-table (gnc-commodity-table-get-table book))
+ (USD (gnc-commodity-table-lookup comm-table "CURRENCY" "USD")))
+ (m 'add USD 10)
+ (test-equal "commodity-collector"
+ "Mon-coll<(Mon<$10.00>)>"
+ (gnc:strify m)))
+ (test-end "debugging tools"))
(define (test-commodity-collector)
(test-group-with-cleanup "test-commodity-collector"
commit 4ee0c3ef46b5379aff3bb34efea3f477cf0f11b1
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Mar 12 15:32:20 2019 +0800
i18n: fix embedded translated strings
diff --git a/gnucash/report/business-reports/customer-summary.scm b/gnucash/report/business-reports/customer-summary.scm
index 139ef6dd5..4ab7f785d 100644
--- a/gnucash/report/business-reports/customer-summary.scm
+++ b/gnucash/report/business-reports/customer-summary.scm
@@ -1009,9 +1009,16 @@
(gnc:html-document-add-object!
document
(gnc:make-html-text
- (format #f
- (_ "No valid ~a selected. Click on the Options button to select a company.")
- (_ type-str))))) ;; FIXME because of translations: Please change this string into full sentences instead of format, because in non-english languages the "no valid" has different forms depending on the grammatical gender of the "%s".
+ (string-append
+ (cond
+ ((eqv? type GNC-OWNER-CUSTOMER)
+ (_ "No valid customer selected."))
+ ((eqv? type GNC-OWNER-VENDOR)
+ (_ "No valid vendor selected."))
+ ((eqv? type GNC-OWNER-EMPLOYEE)
+ (_ "No valid employee selected.")))
+ " "
+ (_ "Click on the \"Options\" button to select a company.")))))
(qof-query-destroy owner-query)
(qof-query-destroy toplevel-income-query)
diff --git a/gnucash/report/business-reports/job-report.scm b/gnucash/report/business-reports/job-report.scm
index 82b4fd101..f6b015cf0 100644
--- a/gnucash/report/business-reports/job-report.scm
+++ b/gnucash/report/business-reports/job-report.scm
@@ -619,11 +619,18 @@
;; else....
(gnc:html-document-add-object!
- document
- (gnc:make-html-text
- (format #f
- (_ "No valid ~a selected. Click on the Options button to select a company.")
- (_ type-str))))) ;; FIXME because of translations: Please change this string into full sentences instead of format, because in non-english languages the "no valid" has different forms depending on the grammatical gender of the "%s".
+ document
+ (gnc:make-html-text
+ (string-append
+ (cond
+ ((eqv? type GNC-OWNER-CUSTOMER)
+ (_ "No valid customer selected."))
+ ((eqv? type GNC-OWNER-VENDOR)
+ (_ "No valid vendor selected."))
+ ((eqv? type GNC-OWNER-EMPLOYEE)
+ (_ "No valid employee selected.")))
+ " "
+ (_ "Click on the \"Options\" button to select a company.")))))
(qof-query-destroy query)
document))
Summary of changes:
gnucash/report/business-reports/customer-summary.scm | 13 ++++++++++---
gnucash/report/business-reports/job-report.scm | 17 ++++++++++++-----
gnucash/report/report-system/report-utilities.scm | 8 ++------
.../report/report-system/test/test-report-utilities.scm | 17 ++++++++++++++---
4 files changed, 38 insertions(+), 17 deletions(-)
More information about the gnucash-changes
mailing list