r16651 - gnucash/trunk -

Andrew Sackville-West andrewsw at cvs.gnucash.org
Sat Dec 15 15:24:23 EST 2007


Author: andrewsw
Date: 2007-12-15 15:24:23 -0500 (Sat, 15 Dec 2007)
New Revision: 16651
Trac: http://svn.gnucash.org/trac/changeset/16651

Modified:
   gnucash/trunk/
   gnucash/trunk/src/report/report-system/commodity-utilities.scm
Log:

provide some sane defaults for exchange functions. a very hackish fix to 487572




Property changes on: gnucash/trunk
___________________________________________________________________
Name: svk:merge
   - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:1037
57a11ea4-9604-0410-9ed3-97b8803252fd:/gnucash/branches/gobject-engine-dev-warlord:15827
95e783b2-15b2-415a-8f58-462a736813e0:/gnucash/advport:22
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord:14369
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord1:14446
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:14601
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:15116
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk3:15249
   + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:1037
57a11ea4-9604-0410-9ed3-97b8803252fd:/gnucash/branches/gobject-engine-dev-warlord:15827
95e783b2-15b2-415a-8f58-462a736813e0:/gnucash/advport:27
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord:14369
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord1:14446
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:14601
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:15116
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk3:15249

Modified: gnucash/trunk/src/report/report-system/commodity-utilities.scm
===================================================================
--- gnucash/trunk/src/report/report-system/commodity-utilities.scm	2007-12-15 20:06:56 UTC (rev 16650)
+++ gnucash/trunk/src/report/report-system/commodity-utilities.scm	2007-12-15 20:24:23 UTC (rev 16651)
@@ -828,8 +828,19 @@
     ((pricedb-nearest) (lambda (foreign domestic)
 			(gnc:exchange-by-pricedb-nearest
 			 foreign domestic to-date-tp)))
-    (else (gnc:warn "gnc:case-exchange-fn: bad price-source value: " 
-                    source-option))))
+    (else 
+     (begin
+       ;; FIX-ME 
+       ;; this is a hack to prevent report crashing if a report
+       ;; implements source-options that aren't fully implemented. We
+       ;; return a reasonably sane fallback function: nearest.
+       ;;
+       ;; known to be missing: pricedb-latest-before
+       (gnc:warn "gnc:case-exchange-fn: bad price-source value: " 
+                    source-option " using pricedb-nearest.")
+       (lambda (foreign domestic)
+	 (gnc:exchange-by-pricedb-nearest
+	  foreign domestic to-date-tp))))))
 
 ;; Return a ready-to-use function. Which one to use is determined by
 ;; the value of 'source-option', whose possible values are set in
@@ -858,8 +869,14 @@
     ((pricedb-latest) (lambda (foreign domestic date)
 		       (gnc:exchange-by-pricedb-latest foreign domestic)))
     ((pricedb-nearest) gnc:exchange-by-pricedb-nearest)
-    (else (gnc:warn "gnc:case-exchange-time-fn: bad price-source value: " 
-                    source-option))))
+    (else 
+     (begin
+       (gnc:warn "gnc:case-exchange-time-fn: bad price-source value: " 
+                    source-option " using pricedb-nearest.")
+       ;; FIX-ME another hack to prevent report crashing when an
+       ;; unimplemented source-option comes through
+       gnc:exchange-by-pricedb-nearest
+       ))))
 
 
 



More information about the gnucash-changes mailing list