AUDIT: r17430 - gnucash/trunk/src/report/standard-reports - Bug #464771: Investment Portfolio report: If there is no price for a particular holding, show a zero price instead of crashing the report.

Charles Day cedayiv at cvs.gnucash.org
Sun Jul 27 19:28:42 EDT 2008


Author: cedayiv
Date: 2008-07-27 19:28:41 -0400 (Sun, 27 Jul 2008)
New Revision: 17430
Trac: http://svn.gnucash.org/trac/changeset/17430

Modified:
   gnucash/trunk/src/report/standard-reports/portfolio.scm
Log:
Bug #464771: Investment Portfolio report: If there is no price for a particular holding, show a zero price instead of crashing the report.
BP


Modified: gnucash/trunk/src/report/standard-reports/portfolio.scm
===================================================================
--- gnucash/trunk/src/report/standard-reports/portfolio.scm	2008-07-27 19:51:19 UTC (rev 17429)
+++ gnucash/trunk/src/report/standard-reports/portfolio.scm	2008-07-27 23:28:41 UTC (rev 17430)
@@ -127,8 +127,16 @@
                  (units (cadr (unit-collector 'getpair commodity #f)))
 
                  (price-info (price-fn commodity to-date))
-                 
-		 (value (exchange-fn (gnc:make-gnc-monetary commodity units) currency)))
+                 (price (car price-info))
+                 (price-monetary (if price
+                                     (gnc:make-gnc-monetary
+                                      (gnc-price-get-currency price)
+                                      (gnc-price-get-value price))
+                                     (gnc:make-gnc-monetary
+                                      currency
+                                      (cdr price-info))))
+                 (value (exchange-fn (gnc:make-gnc-monetary commodity units)
+                                     currency)))
 
 	    (set! work-done (+ 1 work-done))
 	    (gnc:report-percent-done (* 100 (/ work-done work-to-do)))
@@ -145,10 +153,7 @@
 			       (xaccPrintAmount units share-print-info))
 			      (gnc:make-html-table-header-cell/markup
 			       "number-cell"
-			       (gnc:html-price-anchor
-				(car price-info)
-				(gnc:make-gnc-monetary (gnc-price-get-currency (car price-info))
-						       (gnc-price-get-value (car price-info)))))
+                               (gnc:html-price-anchor price price-monetary))
 			      (gnc:make-html-table-header-cell/markup
 			       "number-cell" value)))
 		       ;;(display (sprintf #f "Shares: %6.6d  " (gnc-numeric-to-double units)))



More information about the gnucash-changes mailing list