[freeside-commits] freeside/httemplate/search/elements search.html, 1.20, 1.21

Ivan,,, ivan at wavetail.420.am
Wed Apr 12 05:36:41 PDT 2006


Update of /home/cvs/cvsroot/freeside/httemplate/search/elements
In directory wavetail:/tmp/cvs-serv2564/httemplate/search/elements

Modified Files:
	search.html 
Log Message:
zip code report

Index: search.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/elements/search.html,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- search.html	8 Mar 2006 10:05:01 -0000	1.20
+++ search.html	12 Apr 2006 12:36:39 -0000	1.21
@@ -68,6 +68,8 @@
   # # or a coderef that returns the same
   # 'redirect' =>
 
+  my $DEBUG = 0;
+
   my(%opt) = @_;
   #warn join(' / ', map { "$_ => $opt{$_}" } keys %opt ). "\n";
 
@@ -118,6 +120,7 @@
   my $header = $opt{'header'};
   my $rows;
   if ( ref($opt{'query'}) ) {
+
     #eval "use FS::$opt{'query'};";
     $rows = [ qsearch(
       $opt{'query'}->{'table'}, 
@@ -127,7 +130,9 @@
       '',
       (exists($opt{'query'}->{'addl_from'}) ? $opt{'query'}->{'addl_from'} : '')
     ) ];
+
   } else {
+
     my $sth = dbh->prepare("$opt{'query'} $limit")
       or die "Error preparing $opt{'query'}: ". dbh->errstr;
     $sth->execute
@@ -137,8 +142,15 @@
     $rows = $sth->fetchall_arrayref;
 
     $header ||= $sth->{NAME};
+
   }
 
+  warn scalar(@$rows). ' rows returned from '.
+       ( ref($opt{'query'}) ? 'qsearch query' : 'literal SQL query' )
+    if $DEBUG || $opt{'debug'};
+
+  # display the results - csv, xls or html
+
   if ( $type eq 'csv' ) {
 
     #http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes
@@ -437,7 +449,7 @@
                      <% } %>
                    <% } else { %>
                      <% foreach ( @$row ) { %>
-                          <TD CLASS="grid" BGCOLOR="$bgcolor"><%= $_ %></TD>
+                          <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>"><%= $_ %></TD>
                      <% } %>
                    <% } %>
                    </TR>



More information about the freeside-commits mailing list