summaryrefslogtreecommitdiff
path: root/httemplate/search/elements
diff options
context:
space:
mode:
authorivan <ivan>2006-04-12 12:36:39 +0000
committerivan <ivan>2006-04-12 12:36:39 +0000
commitd453a487d95258e1f11f134fc5864f7e6458a6ef (patch)
tree57b0c5dc7523d5e88312000211ef4c6d8ab24a0a /httemplate/search/elements
parent7bdf17a005cf4c0fe8b6b6ad1ce97abaa52a4510 (diff)
zip code report
Diffstat (limited to 'httemplate/search/elements')
-rw-r--r--httemplate/search/elements/search.html14
1 files changed, 13 insertions, 1 deletions
diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html
index b14bded10..7f7243588 100644
--- a/httemplate/search/elements/search.html
+++ b/httemplate/search/elements/search.html
@@ -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>