Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / search / elements / search.html
index 81ec4d0..9bc66b6 100644 (file)
@@ -170,7 +170,6 @@ Example:
 %
 <% include('search-csv.html',  header=>$header, rows=>$rows, opt=>\%opt ) %>
 %
-% #} elsif ( $type eq 'excel' ) {
 % } elsif ( $type =~ /\.xls$/ ) {
 %
 <% include('search-xls.html',  header=>$header, rows=>$rows, opt=>\%opt ) %>
@@ -179,7 +178,7 @@ Example:
 %
 <% include('search-xml.html',  rows=>$rows, opt=>\%opt ) %>
 %
-% } else { # regular HTML
+% } else {
 %
 <% include('search-html.html',
              type           => $type,
@@ -205,6 +204,11 @@ my $curuser = $FS::CurrentUser::CurrentUser;
 my $type = $cgi->param('_type') =~ /^(csv|\w*\.xls|xml|select|html(-print)?)$/
            ? $1 : 'html' ;
 
+if ( !$curuser->access_right('Download report data') ) {
+  $opt{'disable_download'} = 1;
+  $type = 'html';
+}
+
 my %align = (
   'l' => 'left',
   'r' => 'right',
@@ -363,6 +367,8 @@ unless ( $type =~ /^(csv|\w*.xls)$/) {
       $maxrecords ||= $confmax;
     }
 
+    $opt{'disable_maxselect'} ||= $conf->exists('disable_maxselect');
+
     $limit = $maxrecords ? "LIMIT $maxrecords" : '';
 
     $offset = $cgi->param('offset') =~ /^(\d+)$/ ? $1 : 0;