gnucash stable: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Sun Jun 1 08:49:01 EDT 2025


Updated	 via  https://github.com/Gnucash/gnucash/commit/7b5d13b3 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/79cf62d3 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8eaa3e12 (commit)
	from  https://github.com/Gnucash/gnucash/commit/491aaae5 (commit)



commit 7b5d13b3f78fbea7ea8eebed6090671c242cdefd
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Jun 1 20:31:42 2025 +0800

    [report-core.scm] don't export <report>
    
    It's not needed anymore.

diff --git a/gnucash/report/report-core.scm b/gnucash/report/report-core.scm
index 97381fc1d8..b9735d8f91 100644
--- a/gnucash/report/report-core.scm
+++ b/gnucash/report/report-core.scm
@@ -44,7 +44,6 @@
                    (sw_engine)
                    (gnucash options))
 
-(export <report>)
 (export gnc:all-report-template-guids)
 (export gnc:custom-report-template-guids)
 (export gnc:custom-report-invoice-template-guids)

commit 79cf62d304ff123cdbae8b23e0d07255b77c9998
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Jun 1 20:30:07 2025 +0800

    [report-core.scm] refactor gnc:make-report
    
    don't call hash-ref twice unnecessarily. also tidy function.

diff --git a/gnucash/report/report-core.scm b/gnucash/report/report-core.scm
index 167491d95e..97381fc1d8 100644
--- a/gnucash/report/report-core.scm
+++ b/gnucash/report/report-core.scm
@@ -363,27 +363,25 @@ not found.")))
 ;; gnc:make-report instantiates a report from a report-template.
 ;; The actual report is stored away in a hash-table -- only the id is returned.
 (define (gnc:make-report template-id . rest)
-  (let* ((template-parent (gnc:report-template-parent-type
-                           (hash-ref *gnc:_report-templates_* template-id)))
+  (let* ((template (hash-ref *gnc:_report-templates_* template-id))
+         (template-parent (gnc:report-template-parent-type template))
          (report-type (or template-parent template-id))
          (custom-template (if template-parent template-id ""))
          (r (make-report
              report-type     ;; type
              #f              ;; id
-             #f              ;; options
+             (if (null? rest)
+                 (gnc:report-template-new-options template)
+                 (car rest)) ;; options
              #t              ;; dirty
              #f              ;; needs-save
              #f              ;; editor-widget
              #f              ;; ctext
              custom-template ;; custom-template
              ))
-         (template (hash-ref *gnc:_report-templates_* template-id)))
-    (let ((options (if (null? rest)
-                       (gnc:report-template-new-options template)
-                       (car rest))))
-      (gnc:report-set-options! r options))
-    (gnc:report-set-id! r (gnc-report-add r))
-    (gnc:report-id r)))
+         (id (gnc-report-add r)))       ;returns an integer
+    (gnc:report-set-id! r id)
+    id))
 
 (define (gnc:restore-report-by-guid-with-custom-template
          id template-id template-name custom-template-id options)

commit 8eaa3e1281bf9cb0d9712edbf4003e497290d898
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Jun 1 20:28:40 2025 +0800

    [test/reports] use gnc:make-report instead of <report> record type
    
    Instead of calling <report> constructor, use the "official" wrapper
    gnc:make-report which returns the integer report id. The report object
    can be retrieved with gnc_report_find.

diff --git a/gnucash/report/reports/standard/test/test-transaction.scm b/gnucash/report/reports/standard/test/test-transaction.scm
index 2a0cdf5e47..5ce5418f03 100644
--- a/gnucash/report/reports/standard/test/test-transaction.scm
+++ b/gnucash/report/reports/standard/test/test-transaction.scm
@@ -1020,8 +1020,8 @@
       (set-option! options "Sorting" "Secondary Subtotal for Date Key" 'monthly)
 
       (let* ((template (gnc:find-report-template trep-uuid))
-             (constructor (record-constructor <report>))
-             (report (constructor trep-uuid "bar" options #t #t #f #f ""))
+             (report-id (gnc:make-report trep-uuid options))
+             (report (gnc-report-find report-id))
              (renderer (gnc:report-template-renderer template))
              (document (renderer report #:export-type 'csv)))
         (test-assert "csv output has no export error"
diff --git a/gnucash/report/test/test-report-extras.scm b/gnucash/report/test/test-report-extras.scm
index 688e851e3b..f4a56cdcee 100644
--- a/gnucash/report/test/test-report-extras.scm
+++ b/gnucash/report/test/test-report-extras.scm
@@ -41,8 +41,8 @@
 
   (let* ((template (or (gnc:find-report-template uuid)
                        (error "report not found:" uuid)))
-         (constructor (record-constructor <report>))
-         (report (constructor uuid "bar" options #t #t #f #f ""))
+         (report-id (gnc:make-report uuid options))
+         (report (gnc-report-find report-id))
          (renderer (gnc:report-template-renderer template))
          (document (renderer report))
          (sanitize-char (lambda (c)
diff --git a/gnucash/report/test/test-report.scm b/gnucash/report/test/test-report.scm
index 42c616ba23..82ec40bb11 100644
--- a/gnucash/report/test/test-report.scm
+++ b/gnucash/report/test/test-report.scm
@@ -177,9 +177,9 @@
                (let ((options (gnc:report-options obj)))
                  "return-string")))
   (let* ((template (gnc:find-report-template test-uuid))
-         (constructor (record-constructor <report>))
          (options (gnc:make-report-options test-uuid))
-         (report (constructor test-uuid "bar" options #t #t #f #f "")))
+         (report-id (gnc:make-report test-uuid options))
+         (report (gnc-report-find report-id)))
     (test-equal "render works"
       "return-string"
       ((gnc:report-template-renderer template) report))



Summary of changes:
 gnucash/report/report-core.scm                        | 19 ++++++++-----------
 .../report/reports/standard/test/test-transaction.scm |  4 ++--
 gnucash/report/test/test-report-extras.scm            |  4 ++--
 gnucash/report/test/test-report.scm                   |  4 ++--
 4 files changed, 14 insertions(+), 17 deletions(-)



More information about the gnucash-changes mailing list