X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fbill_batch.cgi;h=6d7e18fee8cf0f0001722be85267f772ddb34658;hb=c4b71bc4459cb7d403cbebede470aeb2c6292a6e;hp=e5abc8955c4f99843ccf42af30253d7908ef6e45;hpb=b5c4237a34aef94976bc343c8d9e138664fc3984;p=freeside.git diff --git a/httemplate/search/bill_batch.cgi b/httemplate/search/bill_batch.cgi index e5abc8955..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,22 +42,33 @@ 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?magic=print;". + [ "${p}view/bill_batch.cgi?start_download=1;". (shift->status eq 'O' ? 'close=1;' : ''). 'batchnum=', 'batchnum']