r17128 - gnucash/branches/2.2/src/report/report-system - [r16995] Bug #341608: Make txn report correctly match void or non-void txns.
Andreas Köhler
andi5 at cvs.gnucash.org
Sat Apr 26 12:48:48 EDT 2008
Author: andi5
Date: 2008-04-26 12:48:48 -0400 (Sat, 26 Apr 2008)
New Revision: 17128
Trac: http://svn.gnucash.org/trac/changeset/17128
Modified:
gnucash/branches/2.2/src/report/report-system/report-utilities.scm
Log:
[r16995] Bug #341608: Make txn report correctly match void or non-void txns.
gnc:query-set-match-{,non-}voids-only! assigned the result of a query
merge to a locally bound variable instead of returning it somehow. So
use qof-query-merge-in-place instead and add a few missing
qof-query-destroys as well.
Modified: gnucash/branches/2.2/src/report/report-system/report-utilities.scm
===================================================================
--- gnucash/branches/2.2/src/report/report-system/report-utilities.scm 2008-04-26 15:59:40 UTC (rev 17127)
+++ gnucash/branches/2.2/src/report/report-system/report-utilities.scm 2008-04-26 16:48:48 UTC (rev 17128)
@@ -597,30 +597,32 @@
;; utility function - ensure that a query matches only non-voids. Destructive.
(define (gnc:query-set-match-non-voids-only! query book)
(let ((temp-query (qof-query-create-for-splits)))
- (qof-query-set-book temp-query book)
-
- (xaccQueryAddClearedMatch
- temp-query
- CLEARED-VOIDED
- QOF-QUERY-AND)
+ (qof-query-set-book temp-query book)
- (set! temp-query (qof-query-invert temp-query))
+ (xaccQueryAddClearedMatch
+ temp-query
+ CLEARED-VOIDED
+ QOF-QUERY-AND)
- (set! query (qof-query-merge query temp-query QOF-QUERY-AND))))
+ (let ((inv-query (qof-query-invert temp-query)))
+ (qof-query-merge-in-place query inv-query QOF-QUERY-AND)
+ (qof-query-destroy inv-query)
+ (qof-query-destroy temp-query))))
;; utility function - ensure that a query matches only voids. Destructive
(define (gnc:query-set-match-voids-only! query book)
(let ((temp-query (qof-query-create-for-splits)))
- (qof-query-set-book temp-query book)
-
- (xaccQueryAddClearedMatch
- temp-query
- CLEARED-VOIDED
- QOF-QUERY-AND)
+ (qof-query-set-book temp-query book)
- (set! query (qof-query-merge query temp-query QOF-QUERY-AND))))
+ (xaccQueryAddClearedMatch
+ temp-query
+ CLEARED-VOIDED
+ QOF-QUERY-AND)
+ (qof-query-merge-in-place query temp-query QOF-QUERY-AND)
+ (qof-query-destroy temp-query)))
+
(define (gnc:split-voided? split)
(let ((trans (xaccSplitGetParent split)))
(xaccTransGetVoidStatus trans)))
@@ -726,14 +728,16 @@
(xaccQueryAddDescriptionMatch
str-query matchstr case-sens regexp QOF-QUERY-AND)
(set! total-query
- ;; this is a tad inefficient, but its a simple way to accomplish
- ;; description match inversion...
- (if pos?
- (qof-query-merge sign-query str-query QOF-QUERY-AND)
- (qof-query-merge
- sign-query (qof-query-invert str-query) QOF-QUERY-AND)
- ))
-
+ ;; this is a tad inefficient, but its a simple way to accomplish
+ ;; description match inversion...
+ (if pos?
+ (qof-query-merge-in-place sign-query str-query QOF-QUERY-AND)
+ (let ((inv-query (qof-query-invert str-query)))
+ (qof-query-merge-in-place
+ sign-query inv-query QOF-QUERY-AND)
+ qof-query-destroy inv-query)))
+ (qof-query-destroy str-query)
+
(set! splits (qof-query-run total-query))
(map (lambda (split)
(let* ((shares (xaccSplitGetAmount split))
More information about the gnucash-changes
mailing list