X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Felements%2Fsearch.html;h=cbf0887a6a910fecc4b914d769d5ac11c4aef125;hb=3ce7691203a7737406bf2d4442f7fd84b81f847e;hp=fbedcaa26a5711d2a3860144b7116ec2bdd975d8;hpb=eb9668a6f3181ee02cb335272c5ee4616e61fd09;p=freeside.git
diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html
index fbedcaa26..cbf0887a6 100644
--- a/httemplate/search/elements/search.html
+++ b/httemplate/search/elements/search.html
@@ -1,59 +1,535 @@
-<%
-
- my %opt = @_;
- unless (exists($opt{'count_query'}) && length($opt{'count_query'})) {
- ( $opt{'count_query'} = $opt{'query'} ) =~
- s/^\s*SELECT\s*(.*)\s+FROM\s/SELECT COUNT(*) FROM /i;
- }
-
- my $conf = new FS::Conf;
- my $maxrecords = $conf->config('maxsearchrecordsperpage');
-
- my $limit = $maxrecords ? "LIMIT $maxrecords" : '';
-
- my $offset = $cgi->param('offset') || 0;
- $limit .= " OFFSET $offset" if $offset;
-
- my $count_sth = dbh->prepare($opt{'count_query'})
- or die "Error preparing $opt{'count_query'}: ". dbh->errstr;
- $count_sth->execute
- or die "Error executing $opt{'count_query'}: ". $count_sth->errstr;
- my $total = $count_sth->fetchrow_arrayref->[0];
-
- my $sth = dbh->prepare("$opt{'query'} $limit")
- or die "Error preparing $opt{'query'}: ". dbh->errstr;
- $sth->execute
- or die "Error executing $opt{'query'}: ". $sth->errstr;
-
- #can get # of rows without fetching them all?
- my $rows = $sth->fetchall_arrayref;
-
-%>
-
-<% my $pager = include ( '/elements/pager.html',
- 'offset' => $offset,
- 'num_rows' => scalar(@$rows),
- 'total' => $total,
- 'maxrecords' => $maxrecords,
- );
-%>
-
-<%= $total %> total <%= $opt{'name'} %>
<%= $pager %>
-<%= include( '/elements/table.html' ) %>
-