mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[trep-engine] bugfix sorting/show-account-description was not working
also fix display code - omit " " if code is empty.
This commit is contained in:
@@ -141,6 +141,10 @@
|
||||
(set-option! options "Display" "Amount" 'single)
|
||||
options))
|
||||
|
||||
;; to test Sorting/Show Account Description
|
||||
(xaccAccountSetDescription income "Salaries etc")
|
||||
(xaccAccountSetCode expense "EXP-001")
|
||||
|
||||
;; This will make all accounts use default currency (I think depends on locale)
|
||||
(for-each
|
||||
(lambda(pair)
|
||||
@@ -788,7 +792,8 @@
|
||||
(set-option! options "Sorting" "Secondary Key" 'date)
|
||||
(set-option! options "Sorting" "Secondary Subtotal for Date Key" 'quarterly)
|
||||
(set-option! options "Sorting" "Show Informal Debit/Credit Headers" #t)
|
||||
(set-option! options "Sorting" "Show Account Description" #t)
|
||||
(set-option! options "Sorting" "Show Account Description" #f)
|
||||
(set-option! options "Sorting" "Show Account Code" #f)
|
||||
(let* ((sxml (options->sxml options "sorting=date, friendly headers")))
|
||||
(test-equal "expense acc friendly headers"
|
||||
'("Expenses" "Expense" "Rebate")
|
||||
@@ -797,6 +802,16 @@
|
||||
'("Income" "Charge" "Income")
|
||||
(get-row-col sxml 91 #f)))
|
||||
|
||||
(set-option! options "Sorting" "Show Account Description" #t)
|
||||
(set-option! options "Sorting" "Show Account Code" #t)
|
||||
(let* ((sxml (options->sxml options "sorting=date, friendly headers with acct desc/code")))
|
||||
(test-equal "expense acc friendly headers"
|
||||
'("EXP-001 Expenses" "Expense" "Rebate")
|
||||
(get-row-col sxml 69 #f))
|
||||
(test-equal "income acc friendly headers"
|
||||
'("Income: Salaries etc" "Charge" "Income")
|
||||
(get-row-col sxml 91 #f)))
|
||||
|
||||
(set-option! options "Accounts" "Accounts" (list bank))
|
||||
(set-option! options "Display" "Grand Total" #f)
|
||||
(set-option! options "Sorting" "Show subtotals only (hide transactional data)" #t)
|
||||
|
||||
@@ -1749,8 +1749,10 @@ be excluded from periodic reporting.")
|
||||
(with-output-to-string
|
||||
(lambda ()
|
||||
(when show-account-code?
|
||||
(display (xaccAccountGetCode account))
|
||||
(display " "))
|
||||
(let ((code (xaccAccountGetCode account)))
|
||||
(unless (string-null? code)
|
||||
(display code)
|
||||
(display " "))))
|
||||
(when show-account-name?
|
||||
(display
|
||||
(if show-account-full-name?
|
||||
@@ -1768,17 +1770,10 @@ be excluded from periodic reporting.")
|
||||
(name (account-namestring account
|
||||
(report-uses? 'sort-account-code)
|
||||
#t
|
||||
(report-uses? 'sort-account-full-name)))
|
||||
(description (if (and (report-uses? 'sort-account-description)
|
||||
(not (string-null?
|
||||
(xaccAccountGetDescription account))))
|
||||
(string-append ": " (xaccAccountGetDescription account))
|
||||
"")))
|
||||
(if (and anchor? (report-uses? 'links)
|
||||
(pair? account)) ;html anchor for 2-split transactions only
|
||||
(gnc:make-html-text
|
||||
(gnc:html-markup-anchor (gnc:account-anchor-text account) name)
|
||||
description)
|
||||
(report-uses? 'sort-account-full-name))))
|
||||
(if (and (report-uses? 'sort-account-description)
|
||||
(not (string-null? (xaccAccountGetDescription account))))
|
||||
(string-append name ": " (xaccAccountGetDescription account))
|
||||
name)))
|
||||
|
||||
;; generic renderer. retrieve renderer-fn which should return a str
|
||||
|
||||
Reference in New Issue
Block a user