[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#195753: cbb graphs fail to display when using US format start/end dates

Package: cbb
Version: 1:0.8.1-4

Expected action: Start cbb with valid account file. Select
Functions-Graphs. Enter a Starting Date and Ending date in "US Format":
mm/dd/yyyy. Select "Expenses Pie Chart" graph. Select "Generate Graph".
cbb should display a window with available categories of transactions to
display. Click OK. Admire pie chart.

Actual action: When you select "Generate Graph", the window is very
small and displays NO available categories. When you click OK, the pie
chart window is blank.

The Expenses Pie Chart is generated by $cbb_home/graphs/cat-pie.pl,
where $cbb_home is /usr/X11R6/lib/X11/cbb. Line 66 is commented out, and
displays the fromdate and todate the cat-pie.pl script receives. When
you run cat-pie.pl from the command line with

        ./cat-pie.pl -from 5/25/2003 -to 6/1/2003 <account>

line 66 displays '20030005' '20030006' '<account>', and fails as
described above. However, using the "International format" for the dates, as

	./cat-pie.pl -from 25.5.2003 -to 1.6.2003 <account>

line 66 displays '20030525' '20030601' '<account>', and the graph
displays correctly. In addition, using the "International format" inside
the cbb GUI correctly displays the graph, as well. Therefore,

WORKAROUND: Use the International Format (dd.mm.yyyy) for start/end
dates on reports and graphs.

But, we haven't found the bug.

cat-pie.pl requires common.pl, reports.pl, engine.pl, and memorized.pl.
One of these must parse the date. And in fact, reports.pl, line 43ff.
parses the command line and the start/end dates for the reports and
graphs. It requires an argument on the command line, '-date 1', in order
to parse "US format" dates correctly. So, running

./cat-pie.pl -date 1 -from 5/25/2003 -to 6/1/2003 <account>

line 66 displays '20030525' '20030601' '<account>', and the graph
displays correctly! Where is this date format coming from? Since this
value may differ for different users, it should be in the ~/.cbbrc.tcl
file. And in fact, there it is, line 25 'set cbb(date_fmt) 1'. The main
cbb file sources $cbb_home/init.tcl, which also has line 202, 'set
cbb(date_fmt) 1', and then overrides it if necessary with the
~/.cbbrc.tcl file on line 251.

So, the date format is correctly set in ~/.cbbrc.tcl and in
$cbb_home/init.rcl, and should be included in cbb by the sourcing of
init.tcl. The problem must be in the code that is generating the command
lines. Maybe that could be reports.tcl?

AND HERE IS THE BUG! reports.tcl correctly issues the date format on the
command line for generating reports (lines 249 and 253), but does not
for graphs (lines 275 and 278). Adding the text '-date $cbb(date_fmt)'
to the command lines on 275ff. and 278ff. fixes the problem, and graphs
are generated correctly.


--- reports.tcl Fri Jul 13 17:15:14 2001
+++ reports.tcl.patched Sun Jun  1 19:32:45 2003
@@ -272,11 +272,11 @@
     } else {
        if { $cbb(debug) } {
-           puts "open |$lib_path/graphs/$report(name) $nice_start \
-                   $nice_end $file_list r+"
+ puts "open |$lib_path/graphs/$report(name) -date $cbb(date_fmt) \
+           $nice_start $nice_end $file_list r+"
- set report(handle) [open "|$lib_path/graphs/$report(name) $nice_start \
-               $nice_end $file_list" r+]
+        set report(handle) [open "|$lib_path/graphs/$report(name) \
+       -date $cbb(date_fmt) $nice_start $nice_end $file_list" r+]

Conclusion: Sorry to be so long-winded, but I thought you might want to
follow my process, not reinvent it, before patching the file. reports.tcl.patched replaces reports.tcl, of course.

Steven Spencer-Priebe

Reply to: