diff options
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/elements/menu.html | 7 | ||||
-rwxr-xr-x | httemplate/search/bill_batch.cgi | 23 |
2 files changed, 22 insertions, 8 deletions
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 1064836fb..cd9fe06a1 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -395,8 +395,11 @@ $tools_menu{'Quick payment entry'} = [ $fsurl.'misc/batch-cust_pay.html', 'Ente $tools_menu{'Process payment batches'} = [ $fsurl.'search/pay_batch.cgi?magic=_date;open=1;intransit=1', 'Process credit card and electronic check batches' ] if ( $conf->exists('batch-enable') || $conf->config('batch-enable_payby') ) && $curuser->access_right('Process batches'); -$tools_menu{'Download invoice batches'} = [ $fsurl.'search/bill_batch.cgi' ] - if $conf->exists('invoice_print_pdf'); +$tools_menu{'Download invoice batches'} = [ $fsurl.'search/bill_batch.cgi' ] + if $curuser->access_right('Process invoice batches') + || $curuser->access_right('Process global invoice batches') + || $curuser->access_right('Configuration'); #XXX remove in 2.5 + #now there's a standalone event#if $conf->exists('invoice_print_pdf'); $tools_menu{'Bulk DID Orders'} = [ $fsurl.'browse/did_order.html', 'View/manage bulk DID orders' ] if $curuser->access_right('Import'); $tools_menu{'Job Queue'} = [ $fsurl.'search/queue.html', 'View pending job queue' ] diff --git a/httemplate/search/bill_batch.cgi b/httemplate/search/bill_batch.cgi index 72e5d3a8b..6d7e18fee 100755 --- a/httemplate/search/bill_batch.cgi +++ b/httemplate/search/bill_batch.cgi @@ -3,10 +3,10 @@ 'name_singular' => 'batch', 'query' => { 'table' => 'bill_batch', 'hashref' => $hashref, - 'extra_sql' => $extra_sql. - 'ORDER BY batchnum DESC', + #'extra_sql' => $extra_sql. + 'order_by' => 'ORDER BY batchnum DESC', }, - 'count_query' => "$count_query $extra_sql", + 'count_query' => $count_query, 'header' => [ 'Batch', 'Item Count', 'Status', @@ -42,19 +42,30 @@ sub { shift->status eq 'O' ? "b" : '' }, ], 'really_disable_download' => 1, + 'agent_virt' => 1, + 'agent_null_right' => [ 'Process global invoice batches', 'Configuration' ], + 'agent_pos' => 1, + ) %> <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); + unless $curuser->access_right('Process invoice batches') + || $curuser->access_right('Process global invoice batches') + || $curuser->access_right('Configuration'); #remove in 2.5 my %statusmap = ('O'=>'Open', 'R'=>'Closed'); my $hashref = {}; -my $count_query = 'SELECT COUNT(*) FROM bill_batch'; +my $count_query = "SELECT COUNT(*) FROM bill_batch WHERE". # $extra_sql AND " + $curuser->agentnums_sql( + 'null_right' => ['Process global invoice batches', 'Configuration' ], + ); -my $extra_sql = ''; # may add something here later +#my $extra_sql = ''; # may add something here later my $link = [ "${p}view/bill_batch.cgi?batchnum=", 'batchnum' ]; my $dlink = sub { [ "${p}view/bill_batch.cgi?start_download=1;". |