AUDIT: r16875 - gnucash/trunk/src/report/standard-reports - Display the Notes if Memo is empty in Transaction Report (#454834)

Derek Atkins warlord at cvs.gnucash.org
Sun Jan 20 13:03:58 EST 2008


Author: warlord
Date: 2008-01-20 13:03:58 -0500 (Sun, 20 Jan 2008)
New Revision: 16875
Trac: http://svn.gnucash.org/trac/changeset/16875

Modified:
   gnucash/trunk/src/report/standard-reports/transaction.scm
Log:
Display the Notes if Memo is empty in Transaction Report (#454834)
Patch by Charles Day
BP

Modified: gnucash/trunk/src/report/standard-reports/transaction.scm
===================================================================
--- gnucash/trunk/src/report/standard-reports/transaction.scm	2008-01-20 17:52:55 UTC (rev 16874)
+++ gnucash/trunk/src/report/standard-reports/transaction.scm	2008-01-20 18:03:58 UTC (rev 16875)
@@ -345,8 +345,10 @@
   (vector-ref columns-used 17))
 (define (used-sort-account-full-name columns-used)
   (vector-ref columns-used 18))
+(define (used-notes columns-used)
+  (vector-ref columns-used 19))
 
-(define columns-used-size 19)
+(define columns-used-size 20)
 
 (define (num-columns-required columns-used)  
   (do ((i 0 (+ i 1)) 
@@ -397,6 +399,8 @@
         (vector-set! column-list 17 #t))
     (if (opt-val (N_ "Sorting") (N_ "Show Full Account Name?"))
         (vector-set! column-list 18 #t))
+    (if (opt-val (N_ "Display") (N_ "Notes"))
+        (vector-set! column-list 19 #t))
     column-list))
 
 (define (make-heading-list column-vector)
@@ -410,7 +414,9 @@
     (if (used-description column-vector)
         (addto! heading-list (_ "Description")))
     (if (used-memo column-vector)
-        (addto! heading-list (_ "Memo")))
+        (if (used-notes column-vector)
+            (addto! heading-list (string-append (_ "Memo") "/" (_ "Notes")))
+            (addto! heading-list (_ "Memo"))))
     (if (or (used-account-name column-vector) (used-account-code column-vector))
         (addto! heading-list (_ "Account")))
     (if (or (used-other-account-name column-vector) (used-other-account-code column-vector))
@@ -487,8 +493,10 @@
                     " ")))
     
     (if (used-memo column-vector)
-        (addto! row-contents
-                (xaccSplitGetMemo split)))
+        (let ((memo (xaccSplitGetMemo split)))
+          (if (and (equal? memo "") (used-notes column-vector))
+              (addto! row-contents (xaccTransGetNotes parent))
+              (addto! row-contents memo))))
     
     (if (or (used-account-name column-vector) (used-account-code column-vector))
        (addto! row-contents (account-namestring account
@@ -831,7 +839,7 @@
     (list (N_ "Reconciled Date")              "a2" (N_ "Display the reconciled date?") #f)
     (list (N_ "Num")                          "b"  (N_ "Display the check number?") #t)
     (list (N_ "Description")                  "c"  (N_ "Display the description?") #t)
-    (list (N_ "Memo")                         "d"  (N_ "Display the memo?") #t)
+    (list (N_ "Notes")                        "d2" (N_ "Display the notes if the memo is unavailable?") #t)
     (list (N_ "Account Name")                 "e"  (N_ "Display the account name?") #f)
     (list (N_ "Use Full Account Name?")       "f"  (N_ "Display the full account name") #t)
     (list (N_ "Account Code")                 "g"  (N_ "Display the account code") #f)
@@ -845,7 +853,20 @@
     (list (N_ "Running Balance")              "n"  (N_ "Display a running balance") #f)
     (list (N_ "Totals")                       "o"  (N_ "Display the totals?") #t)))
 
+  ;; Add an option to display the memo, and disable the notes option
+  ;; when memos are not included.
   (gnc:register-trep-option
+   (gnc:make-complex-boolean-option
+    gnc:pagename-display (N_ "Memo")
+    "d"  (N_ "Display the memo?") #t
+    #f
+    (lambda (x) (gnc-option-db-set-option-selectable-by-name
+		 gnc:*transaction-report-options*
+		 gnc:pagename-display
+		 (N_ "Notes")
+		 x))))
+
+  (gnc:register-trep-option
    (gnc:make-multichoice-option
     gnc:pagename-display (N_ "Amount")
     "m" (N_ "Display the amount?")  



More information about the gnucash-changes mailing list