X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Felements%2Fsearch.html;h=1312cac417bcea775df8fb836dda656bdad12dcf;hb=35cff72e48d004b309409cac03e667463a558022;hp=4bfe8b091ee8b988de31ab89bfdd5e35a44c21a9;hpb=65f0f73df04de553919ee50145376955da20b315;p=freeside.git diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index 4bfe8b091..1312cac41 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -194,6 +194,9 @@ my(%opt) = @_; my $curuser = $FS::CurrentUser::CurrentUser; +my $type = $cgi->param('_type') =~ /^(csv|\w*\.xls|select|html(-print)?)$/ + ? $1 : 'html' ; + my %align = ( 'l' => 'left', 'r' => 'right', @@ -204,6 +207,22 @@ my %align = ( $opt{align} = [ map $align{$_}, split(//, $opt{align}) ], unless !$opt{align} || ref($opt{align}); +if($type =~ /csv|xls/) { + my $h = $opt{'header'}; + my @del; + my $i = 0; + do { + if( ref($h->[$i]) and exists($h->[$i]->{'nodownload'}) ) { + splice(@{$opt{$_}}, $i, 1) foreach + qw(header footer fields links link_onclicks + align color size style cell_style xls_format); + } + else { + $i++; + } + } while ( exists($h->[$i]) ); +} + $opt{disable_download} = 0 if $opt{disable_download} && $curuser->access_right('Configuration download'); @@ -291,25 +310,22 @@ if ( $opt{'disableable'} ) { if ( $cgi->param('showdisabled') ) { $cgi->param('showdisabled', 0); $opt{'html_posttotal'} .= - '( hide disabled $items )!; + '( hide disabled $items )!; #" $cgi->param('showdisabled', 1); } else { $cgi->param('showdisabled', 1); $opt{'html_posttotal'} .= - '( show disabled $items )!; + '( show disabled $items )!; #" $cgi->param('showdisabled', 0); } } -my $type = $cgi->param('_type') =~ /^(csv|\w*\.xls|select|html(-print)?)$/ - ? $1 : 'html'; - my $limit = ''; my($confmax, $maxrecords, $offset ); -unless ( $type =~ /^(csv|\w*\.xls)$/ ) { - +if ( !$type =~ /^(csv|\w*.xls)$/) { +# html mode 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; #silly vim:/