gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Wed Jun 19 10:10:41 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/58be8f6b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/039b8487 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/72974d7a (commit)
	from  https://github.com/Gnucash/gnucash/commit/8ed15089 (commit)



commit 58be8f6baf3001b3a985aa13ea9882b4c6c9b129
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Jun 3 23:21:21 2019 +0800

    Bug 797262 - Change "Today date format"
    
    Mark strftime format string translatable

diff --git a/gnucash/report/business-reports/receipt.scm b/gnucash/report/business-reports/receipt.scm
index 3c0f1db6e..f51b583ec 100644
--- a/gnucash/report/business-reports/receipt.scm
+++ b/gnucash/report/business-reports/receipt.scm
@@ -155,7 +155,11 @@
                 displaypage optname-logo-width-footer "h" (N_ "Width of the footer logo in CSS format, e.g. 10% or 32px.  Leave blank to display the logo at its natural width.  The height of the logo will be scaled accordingly.") "72mm"))
 
   (add-option (gnc:make-string-option
-                displaypage  optname-date-format "i" (N_ "The format for the date->string conversion for today's date.") "%A, %b %e, %Y at %l:%M %P"))
+               displaypage  optname-date-format "i"
+               (N_ "The format for the date->string conversion for today's date.")
+               ;; Translators: Boost::date_time format string
+               ;; "%l:%M %P, %e %B %Y" means " 9:56 pm, 19 June 2019"
+               (_ "%l:%M %P, %e %B %Y")))
 
   ;; Heading options
   (add-option (gnc:make-string-option

commit 039b84871efae99a6296986f5783fc8293c6cce6
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Mon Jun 3 21:17:55 2019 +0800

    [utilities] warn against using guile's strftime
    
    strftime has been banished from code; warning for custom-reports
    
    https://www.mail-archive.com/bug-guile@gnu.org/msg09778.html

diff --git a/libgnucash/scm/utilities.scm b/libgnucash/scm/utilities.scm
index 99e561c8a..509bb5376 100644
--- a/libgnucash/scm/utilities.scm
+++ b/libgnucash/scm/utilities.scm
@@ -155,3 +155,13 @@
   (string-replace-substring
    s1 s2 s3 0 (string-length s1) (max 0 (1- start))
    (and (positive? end-after) (+ (max 0 (1- start)) (1- end-after)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; avoid using strftime, still broken in guile-2.2. see explanation at
+;; https://www.mail-archive.com/bug-guile@gnu.org/msg09778.html
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(let ((strftime-old strftime))
+  (set! strftime
+    (lambda args
+      (gnc:warn "strftime may be buggy. use gnc-print-time64 instead.")
+      (apply strftime-old args))))

commit 72974d7a13349ebdc31b64adb2a35e1624bb41e1
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Jun 19 21:09:37 2019 +0800

    [html-utilities] fix logic error in gnc:assign-colors
    
    Unfortunately 3b187a128 was written with logic error and should have
    been tested better.

diff --git a/gnucash/report/report-system/html-utilities.scm b/gnucash/report/report-system/html-utilities.scm
index 5aa6663a8..3e94d5aa3 100644
--- a/gnucash/report/report-system/html-utilities.scm
+++ b/gnucash/report/report-system/html-utilities.scm
@@ -124,8 +124,8 @@
                             "#16a085" "#d35400"))
   (let lp ((i 0) (result '()) (colors base-colors))
     (cond
-     ((>= num-colors i) (reverse result))
-     ((null? colors)    (lp (1+ i) (cons (car colors) result) base-colors))
+     ((<= num-colors i) (reverse result))
+     ((null? colors)    (lp (1+ i) (cons (car base-colors) result) (cdr base-colors)))
      (else              (lp (1+ i) (cons (car colors) result) (cdr colors))))))
 
 ;; Appends a horizontal ruler to a html-table with the specified
diff --git a/gnucash/report/report-system/test/test-html-utilities-srfi64.scm b/gnucash/report/report-system/test/test-html-utilities-srfi64.scm
index cdc0849c9..b973a44e9 100644
--- a/gnucash/report/report-system/test/test-html-utilities-srfi64.scm
+++ b/gnucash/report/report-system/test/test-html-utilities-srfi64.scm
@@ -13,6 +13,7 @@
   (test-runner-factory gnc:test-runner)
   (test-begin "test-html-utilities-srfi64.scm")
   (test-gnc:html-string-sanitize)
+  (test-gnc:assign-colors)
   (test-end "test-html-utilities-srfi64.scm"))
 
 (define (test-gnc:html-string-sanitize)
@@ -48,3 +49,11 @@
               (gnc:html-string-sanitize "\\"))
 
   (test-end "gnc:html-string-sanitize"))
+
+(define (test-gnc:assign-colors)
+  (test-begin "test-gnc:assign-colors")
+  (test-equal "assign-colors can request many colors"
+    99
+    (length (gnc:assign-colors 99)))
+  (test-end "test-gnc:assign-colors"))
+



Summary of changes:
 gnucash/report/business-reports/receipt.scm                    |  6 +++++-
 gnucash/report/report-system/html-utilities.scm                |  4 ++--
 .../report/report-system/test/test-html-utilities-srfi64.scm   |  9 +++++++++
 libgnucash/scm/utilities.scm                                   | 10 ++++++++++
 4 files changed, 26 insertions(+), 3 deletions(-)



More information about the gnucash-changes mailing list