r23079 - gnucash/trunk/src/report/report-system - New functions to check for custom templates

Geert Janssens gjanssens at code.gnucash.org
Tue Jul 2 07:17:22 EDT 2013


Author: gjanssens
Date: 2013-07-02 07:17:22 -0400 (Tue, 02 Jul 2013)
New Revision: 23079
Trac: http://svn.gnucash.org/trac/changeset/23079

Modified:
   gnucash/trunk/src/report/report-system/report-system.scm
   gnucash/trunk/src/report/report-system/report.scm
Log:
New functions to check for custom templates
- whether a report template is a custom one
- whether a report is based on a custom report

Modified: gnucash/trunk/src/report/report-system/report-system.scm
===================================================================
--- gnucash/trunk/src/report/report-system/report-system.scm	2013-07-02 11:17:10 UTC (rev 23078)
+++ gnucash/trunk/src/report/report-system/report-system.scm	2013-07-02 11:17:22 UTC (rev 23079)
@@ -169,6 +169,8 @@
 (export gnc:report-run)
 (export gnc:report-templates-for-each)
 (export gnc:report-embedded-list)
+(export gnc:report-template-is-custom/template-guid?)
+(export gnc:is-custom-report-type)
 ;; Legacy : the following 3 functions are only needed to
 ;; load a saved-reports file version 2.0
 (export gnc:report-template-new-options/name)

Modified: gnucash/trunk/src/report/report-system/report.scm
===================================================================
--- gnucash/trunk/src/report/report-system/report.scm	2013-07-02 11:17:10 UTC (rev 23078)
+++ gnucash/trunk/src/report/report-system/report.scm	2013-07-02 11:17:22 UTC (rev 23079)
@@ -463,7 +463,18 @@
 (define (gnc:find-report-template report-type) 
   (hash-ref *gnc:_report-templates_* report-type))
 
+(define (gnc:report-template-is-custom/template-guid? guid)
+  (let* ((custom-template (if (string-null? guid) #f (hash-ref *gnc:_report-templates_* guid)))
+         (parent-type (if custom-template (gnc:report-template-parent-type custom-template) #f)))
 
+        (if parent-type
+            #t
+            #f)))
+
+(define (gnc:is-custom-report-type report)
+  (gnc:report-template-is-custom/template-guid? (gnc:report-custom-template report)))
+
+
 ;; Load and save functions
 
 (define (gnc:report-generate-restore-forms report)



More information about the gnucash-changes mailing list