X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_pay_batch.cgi;h=f3826441058397e5a6ef2efcafdf747d48e39f9b;hb=8585b98f48712b459ac15619b452c682cfcceac1;hp=7376e9dcbccfa88fb76b996542121995b1966c06;hpb=40a7b3dc653e099f7bd0bd762b649b04c4432db2;p=freeside.git diff --git a/httemplate/search/cust_pay_batch.cgi b/httemplate/search/cust_pay_batch.cgi index 7376e9dcb..f38264410 100755 --- a/httemplate/search/cust_pay_batch.cgi +++ b/httemplate/search/cust_pay_batch.cgi @@ -4,6 +4,7 @@ 'query' => $sql_query, 'count_query' => $count_query, 'html_init' => $pay_batch ? $html_init : '', + 'disable_download' => 1, 'header' => [ '#', 'Inv #', 'Customer', @@ -59,14 +60,16 @@ my $conf = new FS::Conf; +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Financial reports') - || $FS::CurrentUser::CurrentUser->access_right('Process batches') + unless $curuser->access_right('Financial reports') + || $curuser->access_right('Process batches') + || $curuser->access_right('Process global batches') || ( $cgi->param('custnum') && ( $conf->exists('batch-enable') || $conf->config('batch-enable_payby') ) - #&& $FS::CurrentUser::CurrentUser->access_right('View customer batched payments') ); my( $count_query, $sql_query ); @@ -108,7 +111,8 @@ unless ($pay_batch){ $orderby = "pay_batch.download,paybatchnum"; } -push @search, $FS::CurrentUser::CurrentUser->agentnums_sql; +push @search, $curuser->agentnums_sql({ table=>'cust_main' }); + my $search = ' WHERE ' . join(' AND ', @search); $count_query = 'SELECT COUNT(*) FROM cust_pay_batch AS cpb ' . @@ -126,75 +130,7 @@ $sql_query = "SELECT paybatchnum,invnum,custnum,cpb.last,cpb.first," . my $html_init = ''; if ( $pay_batch ) { - my $fixed = $conf->config('batch-fixed_format-'. $pay_batch->payby); - if ( - $pay_batch->status eq 'O' - || ( $pay_batch->status eq 'I' - && $FS::CurrentUser::CurrentUser->access_right('Reprocess batches') - ) - || ( $pay_batch->status eq 'R' - && $FS::CurrentUser::CurrentUser->access_right('Redownload resolved batches') - ) - ) { - $html_init .= qq!