Skip to content

Commit

Permalink
New functions to check for custom templates
Browse files Browse the repository at this point in the history
- whether a report template is a custom one
- whether a report is based on a custom report

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23079 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
gjanssens committed Jul 2, 2013
1 parent d494e37 commit 3daa53b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/report/report-system/report-system.scm
Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions src/report/report-system/report.scm
Expand Up @@ -463,6 +463,17 @@
(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

Expand Down

0 comments on commit 3daa53b

Please sign in to comment.