gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Thu Nov 18 10:40:36 EST 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/74d594d1 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/62fa9d9f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f497c913 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9bbbeab2 (commit)
	from  https://github.com/Gnucash/gnucash/commit/bd4e7d60 (commit)



commit 74d594d1819b49cf7cc3b6a316f7ffade25af6c2
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu Nov 18 23:38:50 2021 +0800

    [dialog-search] QofQuery must be destroyed

diff --git a/gnucash/gnome-search/dialog-search.c b/gnucash/gnome-search/dialog-search.c
index 0fe357c69..82501bcfc 100644
--- a/gnucash/gnome-search/dialog-search.c
+++ b/gnucash/gnome-search/dialog-search.c
@@ -479,6 +479,7 @@ search_update_query (GNCSearchWindow *sw)
         {
             q2 = create_query_fragment(sw->search_for, GNC_SEARCH_PARAM (data->param), pdata);
             q = qof_query_merge (q, q2, op);
+            qof_query_destroy (q2);
         }
     }
 

commit 62fa9d9f44ca4817c540cd4f7a2a4798fce7ab66
Merge: bd4e7d601 f497c9139
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Thu Nov 18 23:08:33 2021 +0800

    Merge branch 'maint-797772' into maint #1186


commit f497c9139d11512f0e53d8c519beed95b805c446
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Nov 5 23:47:59 2021 +0800

    Bug 797772 - Allow reconciliation report to double filter by both posting and reconciliation date

diff --git a/gnucash/report/reports/standard/reconcile-report.scm b/gnucash/report/reports/standard/reconcile-report.scm
index 6a2d29e74..d45acbc41 100644
--- a/gnucash/report/reports/standard/reconcile-report.scm
+++ b/gnucash/report/reports/standard/reconcile-report.scm
@@ -45,6 +45,9 @@
     (gnc:option-set-value
      (gnc:lookup-option options gnc:pagename-general "End Date")
      (cons 'relative 'today))
+    (gnc:option-set-value
+     (gnc:lookup-option options gnc:pagename-general "Date Filter")
+     'reconciled)
     (gnc:option-set-value
      (gnc:lookup-option options gnc:pagename-display "Reconciled Date") #t)
     (gnc:option-set-value
@@ -63,10 +66,6 @@ to the Reconciliation Date.")
    (gnc:html-markup-br)
    (gnc:html-markup-br)))
 
-(define (split->reconcile-date split)
-  (and (char=? (xaccSplitGetReconcile split) #\y)
-       (xaccSplitGetDateReconciled split)))
-
 (define (reconcile-report-calculated-cells options)
   (letrec
       ((split-amount (lambda (s)
@@ -94,8 +93,6 @@ to the Reconciliation Date.")
   (gnc:trep-renderer
    rpt
    #:custom-calculated-cells reconcile-report-calculated-cells
-   #:split->date split->reconcile-date
-   #:split->date-include-false? #t
    #:empty-report-message reconcile-report-instructions))
 
 (gnc:define-report

commit 9bbbeab271bf65f280a7013ac7d44159c599becf
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Fri Nov 5 23:26:22 2021 +0800

    [trep-engine] new option "Date Filter" to specify dates to filter by

diff --git a/gnucash/report/trep-engine.scm b/gnucash/report/trep-engine.scm
index 93fbe6352..9ae656727 100644
--- a/gnucash/report/trep-engine.scm
+++ b/gnucash/report/trep-engine.scm
@@ -94,6 +94,7 @@
 ;;General
 (define optname-startdate (N_ "Start Date"))
 (define optname-enddate (N_ "End Date"))
+(define optname-date-source (N_ "Date Filter"))
 (define optname-table-export (N_ "Table for Exporting"))
 (define optname-infobox-display (N_ "Add options summary"))
 
@@ -511,6 +512,15 @@ in the Options panel."))
   (gnc:options-add-date-interval!
    options gnc:pagename-general optname-startdate optname-enddate "a")
 
+  (gnc:register-trep-option
+   (gnc:make-multichoice-option
+    gnc:pagename-general optname-date-source
+    "a5" (G_ "Specify date to filter by...")
+    'posted
+    (list (vector 'posted (G_ "Date Posted"))
+          (vector 'reconciled (G_ "Reconciled Date"))
+          (vector 'entered (G_ "Date Entered")))))
+
   (gnc:register-trep-option
    (gnc:make-complex-boolean-option
     pagename-currency optname-common-currency
@@ -1933,7 +1943,8 @@ be excluded from periodic reporting.")
   ;; #:empty-report-message - a str or html-object displayed at the initial run
   ;; #:custom-split-filter - a split->bool function to add to the split filter
   ;; #:split->date - a split->time64 which overrides the default posted date filter
-  ;;     (see reconcile report)
+  ;;     if a derived report specifies this, the Date Filter option
+  ;;     becomes unused and should be hidden via gnc:option-make-internal!
   ;; #:split->date-include-false? - addendum to above, specifies filter behaviour if
   ;;     split->date returns #f. useful to include unreconciled splits in reconcile
   ;;     report. it can be useful for alternative date filtering, e.g. filter by
@@ -1990,6 +2001,9 @@ warning will be removed in GnuCash 5.0"))
          (enddate (gnc:time64-end-day-time
                    (gnc:date-option-absolute-time
                     (opt-val gnc:pagename-general optname-enddate))))
+         (date-source (if split->date
+                          'custom
+                          (opt-val gnc:pagename-general optname-date-source)))
          (transaction-matcher (opt-val pagename-filter optname-transaction-matcher))
          (transaction-filter-case-insensitive?
           (opt-val pagename-filter optname-transaction-matcher-caseinsensitive))
@@ -2132,7 +2146,7 @@ warning will be removed in GnuCash 5.0"))
       (qof-query-set-book query (gnc-get-current-book))
       (xaccQueryAddAccountMatch query c_account_1 QOF-GUID-MATCH-ANY QOF-QUERY-AND)
       (xaccQueryAddClearedMatch query cleared-filter QOF-QUERY-AND)
-      (unless split->date
+      (when (eq? date-source 'posted)
         (xaccQueryAddDateMatchTT query #t begindate #t enddate QOF-QUERY-AND))
       (when (boolean? closing-match)
         (xaccQueryAddClosingTransMatch query closing-match QOF-QUERY-AND))
@@ -2161,11 +2175,19 @@ warning will be removed in GnuCash 5.0"))
         (filter
          (lambda (split)
            (let* ((trans (xaccSplitGetParent split)))
-             (and (or (not split->date)
-                      (let ((date (split->date split)))
+             (and (case date-source
+                    ((posted) #t)
+                    ((reconciled)
+                     (if (char=? (xaccSplitGetReconcile split) #\y)
+                         (<= begindate (xaccSplitGetDateReconciled split) enddate)
+                         #t))
+                    ((entered) (<= begindate (xaccTransRetDateEntered trans) enddate))
+                    ((custom)
+                     (let ((date (split->date split)))
                         (if date
                             (<= begindate date enddate)
                             split->date-include-false?)))
+                    (else (gnc:warn "invalid date-source" date-source) #t))
                   (case filter-mode
                     ((none) #t)
                     ((include) (is-filter-member split c_account_2))



Summary of changes:
 gnucash/gnome-search/dialog-search.c               |  1 +
 .../report/reports/standard/reconcile-report.scm   |  9 +++----
 gnucash/report/trep-engine.scm                     | 30 +++++++++++++++++++---
 3 files changed, 30 insertions(+), 10 deletions(-)



More information about the gnucash-changes mailing list