Transaction and register reports don't work in swig version

Mike Alexander mta at umich.edu
Thu Oct 19 17:50:52 EDT 2006


I found a couple more errors in the swig versions of the transaction 
and register reports.  The patches below make them work better.  I'm 
not suggesting that this is the correct fix, but rather I'm sending 
this to document the problems.

Probably because of the order of the renames in the sed script (is that 
script available, by the way?) gnc:query-get-splits-unique-trans was 
renamed to qof-query-run-unique-trans and it seems to be called 
xaccQueryGetSplitsUniqueTrans now.  Also 
gnc:split-corr-account-fullname was renamed to SPLIT-CORR-ACCT-FULLNAME 
and it looks like it should be SPLIT-CORR-ACCT-NAME.

These are both trivial, but a more interesting problem is that 
xaccTransGetSplit returns '() instead of #f when the index is greater 
than the number of splits in the transaction.  This broke both 
transaction.scm and register.scm.  I presume the better fix is to 
change xaccTransGetSplit to return #f in this case, but I'm not sure 
how to do that so I patched the caller to work with either.

-- 
Mike Alexander           mta at umich.edu
Ann Arbor, MI            PGP key ID: BEA343A6


Index: register.scm
===================================================================
--- register.scm	(revision 15045)
+++ register.scm	(working copy)
@@ -374,7 +374,7 @@
   (define (add-other-split-rows split table used-columns row-style)
     (define (other-rows-driver split parent table used-columns i)
       (let ((current (xaccTransGetSplit parent i)))
-        (if current
+        (if (and current (not (equal? current '())))
             (begin
               (add-split-row table current used-columns row-style #f 
#t #f)
               (other-rows-driver split parent table
@@ -564,7 +564,7 @@
     (qof-query-set-book query (gnc-get-current-book))

     (set! splits (if journal?
-                     (qof-query-run-unique-trans query)
+                     (xaccQueryGetSplitsUniqueTrans query)
                      (qof-query-run query)))

     (set! table (make-split-table splits
mta at fitzrovia:702>svn diff transaction.scm
Index: transaction.scm
===================================================================
--- transaction.scm	(revision 15045)
+++ transaction.scm	(working copy)
@@ -923,7 +923,7 @@
                                 row-style account-types-to-reverse)
     (define (other-rows-driver split parent table used-columns i)
       (let ((current (xaccTransGetSplit parent i)))
-        (cond ((not current) #f)
+        (cond ((or (equal? current '()) (not current)) #f)
               ((equal? current split)
                (other-rows-driver split parent table used-columns (+ i 
1)))
               (else (begin
@@ -1142,7 +1142,7 @@
                                   #f #f #f))
             (cons 'corresponding-acc-name
                                  (vector
-                                  (list SPLIT-CORR-ACCT-FULLNAME)
+                                  (list SPLIT-CORR-ACCT-NAME)
                                   split-same-corr-account-full-name-p
 
render-corresponding-account-subheading
 
render-corresponding-account-subtotal))



More information about the gnucash-devel mailing list