gnucash maint: [account-summary] tag col headers properly to fix formatting

Christopher Lam clam at code.gnucash.org
Sat Sep 21 08:48:29 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/1a6314e1 (commit)
	from  https://github.com/Gnucash/gnucash/commit/3a244681 (commit)



commit 1a6314e10867f9c42b617cee2ef3ed87e05a404b
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Sep 21 20:39:16 2019 +0800

    [account-summary] tag col headers properly to fix formatting
    
    With this commit the col headers are now properly formatted. Change
    tests because the tag is now th instead of td therefore sxml (looking
    for td) can't find them anymore.

diff --git a/gnucash/report/standard-reports/account-summary.scm b/gnucash/report/standard-reports/account-summary.scm
index dbc701bed..83a08a50f 100644
--- a/gnucash/report/standard-reports/account-summary.scm
+++ b/gnucash/report/standard-reports/account-summary.scm
@@ -278,8 +278,7 @@
 
   (gnc:report-starting reportname)
 
-  (let* (
-         (report-title (get-option gnc:pagename-general optname-report-title))
+  (let* ((report-title (get-option gnc:pagename-general optname-report-title))
          (company-name (get-option gnc:pagename-general optname-party-name))
          (from-date (and sx?
                          (gnc:time64-start-day-time
@@ -393,16 +392,20 @@
                 (rowloop (1+ row))))
             (set! cur-col (1+ cur-col)))
 
+          (define (make-header str)
+            (gnc:make-html-table-cell/markup "number-header" str))
+
           (gnc:html-table-add-account-balances hold-table chart-table params)
 
           ;; place the column headers
           (gnc:html-table-append-row!
            build-table
-           (append
-            (if show-code? (list (_ "Code")) '())
-            (if show-type? (list (_ "Type")) '())
-            (if show-desc? (list (_ "Description")) '())
-            (list (_ "Account title"))))
+           (map make-header
+                (append
+                 (if show-code? (list (_ "Code")) '())
+                 (if show-type? (list (_ "Type")) '())
+                 (if show-desc? (list (_ "Description")) '())
+                 (list (_ "Account title")))))
           ;; add any fields to be displayed before the account name
           (if show-code? (add-col 'account-code))
           (if show-type? (add-col 'account-type-string))
@@ -429,7 +432,7 @@
           (set! cur-col (+ cur-col hold-table-width))
           (when show-notes?
             (gnc:html-table-set-cell/tag!
-             build-table 0 cur-col "text-cell" (_ "Notes"))
+             build-table 0 cur-col "number-header" (_ "Notes"))
             (add-col 'account-notes))
 
           (gnc:html-document-add-object! doc build-table)
diff --git a/gnucash/report/standard-reports/test/test-account-summary.scm b/gnucash/report/standard-reports/test/test-account-summary.scm
index 0144ef9e9..3d6b87ca1 100644
--- a/gnucash/report/standard-reports/test/test-account-summary.scm
+++ b/gnucash/report/standard-reports/test/test-account-summary.scm
@@ -53,10 +53,10 @@
     (let* ((options (default-testing-options accsum-uuid))
            (sxml (options->sxml accsum-uuid options "accsum")))
       (test-equal "accsum col 1"
-        '("Code" "#608.00" "-#612.00" "#608.00" "-#612.00" "#608.00" "-#612.00")
+        '("#608.00" "-#612.00" "#608.00" "-#612.00" "#608.00" "-#612.00")
         (sxml->table-row-col sxml 1 #f 1))
       (test-equal "accsum col 2"
-        '("Account title" "Root" "Asset" "Bank" "GBP Bank" "Wallet"
+        '("Root" "Asset" "Bank" "GBP Bank" "Wallet"
           "Liabilities" "Income" "Income-GBP" "Expenses" "Equity")
         (sxml->table-row-col sxml 1 #f 2))
       (test-equal "accsum col 3"
@@ -69,10 +69,10 @@
     (let* ((options (default-testing-options fsts-uuid))
            (sxml (options->sxml fsts-uuid options "fsts")))
       (test-equal "fsts col 1"
-        '("Code")
+        '()
         (sxml->table-row-col sxml 1 #f 1))
       (test-equal "fsts col 2"
-        '("Account title" "Root" "Asset" "Bank" "GBP Bank" "Wallet"
+        '("Root" "Asset" "Bank" "GBP Bank" "Wallet"
           "Liabilities" "Income" "Income-GBP" "Expenses" "Equity")
         (sxml->table-row-col sxml 1 #f 2))
       (test-equal "fsts col 3"



Summary of changes:
 gnucash/report/standard-reports/account-summary.scm   | 19 +++++++++++--------
 .../standard-reports/test/test-account-summary.scm    |  8 ++++----
 2 files changed, 15 insertions(+), 12 deletions(-)



More information about the gnucash-changes mailing list