mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Account fullname filter for transaction.scm
This small change will introduce an account full-name filter. Only accounts whose fullname containing substring will be selected e.g. ":Travel" will match Expenses:Travel:Holiday and Expenses:Business:Travel. This can be left blank, which will mimic previous behavior. This will ease accounts selection tremendously.
This commit is contained in:
parent
1559d26465
commit
6eee9cefca
@ -33,6 +33,7 @@
|
||||
|
||||
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
|
||||
(use-modules (srfi srfi-1))
|
||||
(use-modules (srfi srfi-13))
|
||||
(use-modules (gnucash gnc-module))
|
||||
(use-modules (gnucash gettext))
|
||||
|
||||
@ -660,6 +661,14 @@
|
||||
'())
|
||||
#f #t))
|
||||
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-string-option
|
||||
gnc:pagename-accounts (N_ "Account Substring")
|
||||
"a5" (N_ "Match only above accounts whose fullname contains substring e.g. ':Travel:' will \
|
||||
match Expenses:Travel:Holiday and Expenses:Business:Travel. Can be left blank, which will \
|
||||
disable the substring filter.")
|
||||
""))
|
||||
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-account-list-option
|
||||
gnc:pagename-accounts (N_ "Filter By...")
|
||||
@ -1422,6 +1431,7 @@ Credit Card, and Income accounts.")))))
|
||||
(gnc:report-starting reportname)
|
||||
(let ((document (gnc:make-html-document))
|
||||
(c_account_1 (opt-val gnc:pagename-accounts "Accounts"))
|
||||
(c_account_substring (opt-val gnc:pagename-accounts "Account Substring"))
|
||||
(c_account_2 (opt-val gnc:pagename-accounts "Filter By..."))
|
||||
(filter-mode (opt-val gnc:pagename-accounts "Filter Type"))
|
||||
(begindate (gnc:timepair-start-day-time
|
||||
@ -1444,6 +1454,11 @@ Credit Card, and Income accounts.")))))
|
||||
;;(gnc:warn "accts in trep-renderer:" c_account_1)
|
||||
;;(gnc:warn "Report Account names:" (get-other-account-names c_account_1))
|
||||
|
||||
(set! c_account_1
|
||||
(filter (lambda (acc)
|
||||
(string-contains (gnc-account-get-full-name acc) c_account_substring))
|
||||
c_account_1))
|
||||
|
||||
(if (not (or (null? c_account_1) (and-map not c_account_1)))
|
||||
(begin
|
||||
(qof-query-set-book query (gnc-get-current-book))
|
||||
|
Loading…
Reference in New Issue
Block a user