From 91a65629b7c2659035408bafa1f90f96b6596498 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 22 Nov 2011 21:25:33 +0000 Subject: [PATCH] fix batch browsing w/ the new agent-specific batches, RT#15310 --- FS/FS/AccessRight.pm | 3 ++- httemplate/search/cust_pay_batch.cgi | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm index 56193e443..7351c6d7f 100644 --- a/FS/FS/AccessRight.pm +++ b/FS/FS/AccessRight.pm @@ -274,7 +274,8 @@ tie my %rights, 'Tie::IxHash', 'Miscellaneous rights' => [ { rightname=>'Job queue', global=>1 }, { rightname=>'Time queue', global=>1 }, - { rightname=>'Process batches', global=>1 }, #Process payment batches + { rightname=>'Process batches', }, #Process payment batches + { rightname=>'Process global batches', global=>1 }, #Process global payment batches { rightname=>'Reprocess batches', global=>1 }, #Reprocess payment batches { rightname=>'Redownload resolved batches', global=>1 }, #Redownload resolved payment batches { rightname=>'Process invoice batches', }, diff --git a/httemplate/search/cust_pay_batch.cgi b/httemplate/search/cust_pay_batch.cgi index 73ead9196..f38264410 100755 --- a/httemplate/search/cust_pay_batch.cgi +++ b/httemplate/search/cust_pay_batch.cgi @@ -60,9 +60,12 @@ 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') @@ -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 ' . -- 2.11.0