[report] *delete-trailing-whitespace/reindent/untabify*

This commit is contained in:
Christopher Lam 2019-01-10 17:52:27 +08:00
parent 8f8f5b8461
commit f021658382

View File

@ -23,8 +23,7 @@
(use-modules (gnucash utilities)) (use-modules (gnucash utilities))
(use-modules (gnucash app-utils)) (use-modules (gnucash app-utils))
(use-modules (gnucash gettext)) (use-modules (gnucash gettext))
(eval-when (eval-when (compile load eval expand)
(compile load eval expand)
(load-extension "libgncmod-report-system" "scm_init_sw_report_system_module")) (load-extension "libgncmod-report-system" "scm_init_sw_report_system_module"))
(use-modules (sw_report_system)) (use-modules (sw_report_system))
@ -405,7 +404,8 @@
#f)) #f))
) )
(define (gnc:restore-report-by-guid-with-custom-template id template-id template-name custom-template-id options) (define (gnc:restore-report-by-guid-with-custom-template
id template-id template-name custom-template-id options)
(if options (if options
(let* ( (let* (
(r ((record-constructor <report>) (r ((record-constructor <report>)
@ -565,7 +565,9 @@
(format #f ";; options for report ~S\n" (gnc:report-name report)) (format #f ";; options for report ~S\n" (gnc:report-name report))
(format (format
#f "(let ((options (gnc:report-template-new-options/report-guid ~S ~S)))\n" #f "(let ((options (gnc:report-template-new-options/report-guid ~S ~S)))\n"
(gnc:report-type report) (gnc:report-template-name (hash-ref *gnc:_report-templates_* (gnc:report-type report)))) (gnc:report-type report)
(gnc:report-template-name
(hash-ref *gnc:_report-templates_* (gnc:report-type report))))
(gnc:generate-restore-forms (gnc:report-options report) "options") (gnc:generate-restore-forms (gnc:report-options report) "options")
;; 2.6->2.4 compatibility code prefix ;; 2.6->2.4 compatibility code prefix
;; Temporary check to make the new report saving code more or less backwards ;; Temporary check to make the new report saving code more or less backwards
@ -575,16 +577,17 @@
(format (format
#f " (gnc:restore-report-by-guid-with-custom-template ~S ~S ~S ~S options)\n" #f " (gnc:restore-report-by-guid-with-custom-template ~S ~S ~S ~S options)\n"
(gnc:report-id report) (gnc:report-type report) (gnc:report-id report) (gnc:report-type report)
(gnc:report-template-name (hash-ref *gnc:_report-templates_* (gnc:report-type report))) (gnc:report-template-name
(hash-ref *gnc:_report-templates_* (gnc:report-type report)))
(gnc:report-custom-template report)) (gnc:report-custom-template report))
;; 2.6->2.4 compatibility code suffix ;; 2.6->2.4 compatibility code suffix
(format (format
#f " (gnc:restore-report-by-guid ~S ~S ~S options))\n" #f " (gnc:restore-report-by-guid ~S ~S ~S options))\n"
(gnc:report-id report) (gnc:report-type report) (gnc:report-id report) (gnc:report-type report)
(gnc:report-template-name (hash-ref *gnc:_report-templates_* (gnc:report-type report)))) (gnc:report-template-name
(hash-ref *gnc:_report-templates_* (gnc:report-type report))))
;; end of 2.6->2.4 compatibility code suffix. ;; end of 2.6->2.4 compatibility code suffix.
")" ")"))
))
;; Generate guile code required to recreate embedded report instances ;; Generate guile code required to recreate embedded report instances
(define (gnc:report-serialize-embedded embedded-reports) (define (gnc:report-serialize-embedded embedded-reports)
@ -650,7 +653,7 @@
) )
result-string result-string
) )
) )
(define (gnc:report-template-serialize-internal name type templ-name options guid) (define (gnc:report-template-serialize-internal name type templ-name options guid)
(let* ((embedded-serialized (gnc:report-serialize-embedded (gnc:report-embedded-list options))) (let* ((embedded-serialized (gnc:report-serialize-embedded (gnc:report-embedded-list options)))
@ -693,19 +696,22 @@
;; save them ;; save them
(let* ((name (gnc:report-template-make-unique-name (gnc:report-name report))) (let* ((name (gnc:report-template-make-unique-name (gnc:report-name report)))
(type (gnc:report-type report)) (type (gnc:report-type report))
(templ-name (gnc:report-template-name (hash-ref *gnc:_report-templates_* (gnc:report-type report)))) (templ-name (gnc:report-template-name
(hash-ref *gnc:_report-templates_* (gnc:report-type report))))
(options (gnc:report-options report))) (options (gnc:report-options report)))
(gnc:report-template-serialize-internal name type templ-name options #f))) (gnc:report-template-serialize-internal name type templ-name options #f)))
;; Generate guile code required to recreate a report template ;; Generate guile code required to recreate a report template
;; Note: multi column report templates encapsulate instantiated reports, not other report templates ;; Note: multi column report templates encapsulate instantiated
;; this means that the template recreation code must also contain the code to instantiate ;; reports, not other report templates this means that the template
;; these embedded report instances. This results in a mix of template and instatiated reports ;; recreation code must also contain the code to instantiate these
;; in the saved reports file... ;; embedded report instances. This results in a mix of template and
;; instatiated reports in the saved reports file...
(define (gnc:report-template-serialize report-template) (define (gnc:report-template-serialize report-template)
(let* ((name (gnc:report-template-name report-template)) (let* ((name (gnc:report-template-name report-template))
(type (gnc:report-template-parent-type report-template)) (type (gnc:report-template-parent-type report-template))
(templ-name (gnc:report-template-name (hash-ref *gnc:_report-templates_* type))) (templ-name (gnc:report-template-name
(hash-ref *gnc:_report-templates_* type)))
(options (gnc:report-template-new-options report-template)) (options (gnc:report-template-new-options report-template))
(guid (gnc:report-template-report-guid report-template))) (guid (gnc:report-template-report-guid report-template)))
(gnc:report-template-serialize-internal name type templ-name options guid))) (gnc:report-template-serialize-internal name type templ-name options guid)))
@ -719,7 +725,9 @@
;; 2. an overwrite is requestes by setting overwrite? to #t ;; 2. an overwrite is requestes by setting overwrite? to #t
(define (gnc:report-to-template report overwrite?) (define (gnc:report-to-template report overwrite?)
(let* ((custom-template-id (gnc:report-custom-template report)) (let* ((custom-template-id (gnc:report-custom-template report))
(overwrite-ok? (and (gnc:report-template-is-custom/template-guid? custom-template-id) overwrite?)) (overwrite-ok? (and (gnc:report-template-is-custom/template-guid?
custom-template-id)
overwrite?))
;; Generate a serialized report-template with a random guid ;; Generate a serialized report-template with a random guid
(saved-form (gnc:report-template-serialize-from-report report)) (saved-form (gnc:report-template-serialize-from-report report))
;; Immediately evaluate the serialized report template to ;; Immediately evaluate the serialized report template to