mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Enhance account filter to a regex
This commit will enhance the account fullname filter to full regex matching capabilities. Will allow complex account fullname queries e.g. "Car|Flights|Travel"
This commit is contained in:
parent
b74c0bedfd
commit
d077400ba8
@ -37,6 +37,7 @@
|
||||
(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing.
|
||||
(use-modules (srfi srfi-1))
|
||||
(use-modules (srfi srfi-13))
|
||||
(use-modules (ice-9 regex))
|
||||
(use-modules (gnucash gnc-module))
|
||||
(use-modules (gnucash gettext))
|
||||
(use-modules (gnucash printf))
|
||||
@ -695,10 +696,10 @@ accounts must be of type ASSET for taxes paid on expenses, and type LIABILITY fo
|
||||
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-string-option
|
||||
gnc:pagename-accounts (N_ "Account Substring")
|
||||
"b15" (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. This filter is case-sensitive.")
|
||||
gnc:pagename-accounts (N_ "Account Matcher")
|
||||
"b15" (N_ "Match only above accounts whose fullname matches regex e.g. ':Travel' will \
|
||||
match Expenses:Travel:Holiday and Expenses:Business:Travel. 'Car|Flights' will match both \
|
||||
Expenses:Car and Expenses:Flights. It can be left blank, which will disable the matcher.")
|
||||
""))
|
||||
|
||||
(gnc:register-trep-option
|
||||
@ -1587,10 +1588,10 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
|
||||
|
||||
(let* ((document (gnc:make-html-document))
|
||||
(c_account_0 (opt-val gnc:pagename-accounts "Accounts"))
|
||||
(c_account_substring (opt-val gnc:pagename-accounts "Account Substring"))
|
||||
(c_account_matcher (opt-val gnc:pagename-accounts "Account Matcher"))
|
||||
(c_account_1 (filter
|
||||
(lambda (acc)
|
||||
(string-contains (gnc-account-get-full-name acc) c_account_substring))
|
||||
(string-match c_account_matcher (gnc-account-get-full-name acc)))
|
||||
c_account_0))
|
||||
(c_account_2 (opt-val gnc:pagename-accounts "Filter By..."))
|
||||
(tax-accounts (opt-val gnc:pagename-accounts "Tax Accounts"))
|
||||
|
Loading…
Reference in New Issue
Block a user