gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Tue Feb 26 05:24:26 EST 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/d980bb50 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0ce6999f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5cdc5158 (commit)
	from  https://github.com/Gnucash/gnucash/commit/316a22a2 (commit)



commit d980bb50f7353a16cc4d144be89b140e55eab1d6
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Feb 26 14:00:15 2019 +0800

    [report] display gnc-error-dialog only when UI is running
    
    This is preparation work for creating report.scm tests.

diff --git a/gnucash/report/report-system/report.scm b/gnucash/report/report-system/report.scm
index 017dcd347..bace494d6 100644
--- a/gnucash/report/report-system/report.scm
+++ b/gnucash/report/report-system/report.scm
@@ -398,8 +398,10 @@
         )
         report-id
       )
-      (begin
-	(gnc-error-dialog '() (string-append "Report Failed! One of your previously opened reports has failed to open. The template on which it was based: " template-name ", was not found."))
+      (let ((errmsg (string-append "Report Failed! One of your previously opened reports has failed to open. The template on which it was based: " template-name ", was not found.")))
+	(if (gnucash-ui-is-running)
+            (gnc-error-dialog '() errmsg)
+            (gnc:warn errmsg))
 	#f))
   )
 
@@ -415,8 +417,10 @@
         )
         report-id
       )
-      (begin
-        (gnc-error-dialog '() (string-append "Report Failed! One of your previously opened reports has failed to open. The template on which it was based: " template-name ", was not found."))
+      (let ((errmsg (string-append "Report Failed! One of your previously opened reports has failed to open. The template on which it was based: " template-name ", was not found.")))
+        (if (gnucash-ui-is-running)
+            (gnc-error-dialog '() errmsg)
+            (gnc:warn errmsg))
         #f))
   )
 
@@ -934,6 +938,8 @@
                  (set! gnc:old-style-restore-warned #t)
                  (gnc-warning-dialog '() (string-append (_ "Some reports stored in a legacy format were found. This format is not supported anymore so these reports may not have been restored properly.")))))
            (gnc-report-add r))
-      (begin
-        (gnc-error-dialog '() (string-append "Report Failed! One of your previously opened reports has failed to open. The template on which it was based: " template-name ", was not found."))
+      (let ((errmsg (string-append "Report Failed! One of your previously opened reports has failed to open. The template on which it was based: " template-name ", was not found.")))
+        (if (gnucash-ui-is-running)
+            (gnc-error-dialog '() errmsg)
+            (gnc:warn errmsg))
         #f)))

commit 0ce6999ff6267ec3d6800e8ecdbab27405fff408
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Feb 8 14:25:02 2019 +0800

    [html-utilities] compact (gnc:html-make-exchangerates)
    
    and also right-align the commodities, as originally planned.

diff --git a/gnucash/report/report-system/html-utilities.scm b/gnucash/report/report-system/html-utilities.scm
index 62318e7e2..202651211 100644
--- a/gnucash/report/report-system/html-utilities.scm
+++ b/gnucash/report/report-system/html-utilities.scm
@@ -740,54 +740,23 @@
 ;; 'common-commodity', the exchange rates are given through the
 ;; function 'exchange-fn' and the 'accounts' determine which
 ;; commodities to show. Returns a html-object, a <html-table>.
-(define (gnc:html-make-exchangerates
-	 common-commodity exchange-fn accounts) 
-  (let ((comm-list 
-	 (gnc:accounts-get-commodities accounts common-commodity))
-	(table (gnc:make-html-table)))
-
-    (if (not (null? comm-list))
-	;; Do something with each exchange rate.
-	(begin
-	  (for-each 
-	   (lambda (commodity)
-	     (let 
-		 ;; slight hack: exchange a value greater than one,
-		 ;; to get enough digits, and round later.
-		 ((exchanged 
-		   (exchange-fn 
-		    (gnc:make-gnc-monetary commodity 
-					   (gnc-numeric-create 1000 1))
-		    common-commodity)))
-	       (gnc:html-table-append-row! 
-		table
-		(list 
-		 (gnc:make-gnc-monetary commodity 
-					(gnc-numeric-create 1 1))
-		 (gnc:make-gnc-monetary
-		  common-commodity
-		  (gnc-numeric-div
-		   (gnc:gnc-monetary-amount exchanged)
-		   (gnc-numeric-create 1000 1)
-		   GNC-DENOM-AUTO 
-		   (logior (GNC-DENOM-SIGFIGS 6) 
-			   GNC-RND-ROUND)))))))
-	   comm-list)
-	  
-	  ;; Set some style
-	  (gnc:html-table-set-style! 
-	   table "td" 
-	   'attribute '("align" "right")
-	   'attribute '("valign" "top"))
-	  
-	  ;; set some column headers 
-	  (gnc:html-table-set-col-headers!
-	   table 
-	   (list (gnc:make-html-table-header-cell/size 
-		  1 2 (if (= 1 (length comm-list))
-			  (_ "Exchange rate")
-			  (_ "Exchange rates")))))))
-    
+(define (gnc:html-make-exchangerates common-commodity exchange-fn accounts)
+  (let ((comm-list (gnc:accounts-get-commodities accounts common-commodity))
+        (markup (lambda (c) (gnc:make-html-table-cell/markup "number-cell" c)))
+        (table (gnc:make-html-table)))
+    (unless (null? comm-list)
+      (for-each
+       (lambda (commodity)
+         (let* ((orig-amt (gnc:make-gnc-monetary commodity 1))
+                (exchanged (exchange-fn orig-amt common-commodity)))
+           (gnc:html-table-append-row!
+            table (map markup (list orig-amt exchanged)))))
+       comm-list)
+      (gnc:html-table-set-col-headers!
+       table (list (gnc:make-html-table-header-cell/size
+                    1 2 (if (null? (cdr comm-list))
+                            (_ "Exchange rate")
+                            (_ "Exchange rates"))))))
     table))
 
 

commit 5cdc5158858a6d835b83c0952f4b5acdd85086a9
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Feb 23 22:58:54 2019 +0800

    [transaction] html anchor should target split
    
    Previous would create html anchor to target the transaction containing
    the report split.
    
    This would mean the anchor would link the correct transaction, but
    would always link to the first account in the transaction. This change
    will ensure that the account containing the exact report split is
    opened.

diff --git a/gnucash/report/standard-reports/transaction.scm b/gnucash/report/standard-reports/transaction.scm
index 04918ece8..930bc999e 100644
--- a/gnucash/report/standard-reports/transaction.scm
+++ b/gnucash/report/standard-reports/transaction.scm
@@ -1568,9 +1568,7 @@ be excluded from periodic reporting.")
                           (gnc:make-html-table-cell/markup
                            "number-cell"
                            (if opt-use-links?
-                               (gnc:html-transaction-anchor
-                                (xaccSplitGetParent split)
-                                cell-content)
+                               (gnc:html-split-anchor split cell-content)
                                cell-content)))))
                  cells))))
 



Summary of changes:
 gnucash/report/report-system/html-utilities.scm | 65 +++++++------------------
 gnucash/report/report-system/report.scm         | 18 ++++---
 gnucash/report/standard-reports/transaction.scm |  4 +-
 3 files changed, 30 insertions(+), 57 deletions(-)



More information about the gnucash-changes mailing list