From 7ee15a3d70ecde64139ddd72335fa65d9c6220ef Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Fri, 25 Aug 2017 11:42:47 +0200 Subject: [PATCH] Fully enable the new Account Substring option on the transaction report This is done by reverting the following two commits which disabled and hid the option on maint: - Hide Account Substring option (commit 197faeab3f5e24fbebfb78290b6599a549bccd35) - Reduce to compatibility shim (commit 19fe7d8a560467d2c6fe2b53277fa453f0677c16) --- gnucash/report/standard-reports/transaction.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gnucash/report/standard-reports/transaction.scm b/gnucash/report/standard-reports/transaction.scm index 33704f6560..80fd782e05 100644 --- a/gnucash/report/standard-reports/transaction.scm +++ b/gnucash/report/standard-reports/transaction.scm @@ -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)) @@ -651,8 +652,11 @@ #f #t)) (gnc:register-trep-option - (gnc:make-internal-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. This filter is case-sensitive.") "")) (gnc:register-trep-option @@ -1442,6 +1446,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 @@ -1464,6 +1469,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))