X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Fprepay_credit.html;h=36403511b19b25b53f4680c74d5593c0a49c498a;hp=dff8a3d9a8d3050105c038c91a685c33b20c0d9a;hb=c3da5cf1caa244937d280e0f406927103beef148;hpb=c8cccb4a92adceb943c635fe62dad0d034462ce0 diff --git a/httemplate/search/prepay_credit.html b/httemplate/search/prepay_credit.html index dff8a3d9a..36403511b 100644 --- a/httemplate/search/prepay_credit.html +++ b/httemplate/search/prepay_credit.html @@ -1,20 +1,7 @@ -% -%my $agent = ''; -%my $hashref = {}; -%if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { -% $hashref->{agentnum} = $1; -% $agent = qsearchs('agent', { 'agentnum' => $1 } ); -%} -% -%my $count_query = 'SELECT COUNT(*) FROM prepay_credit'; -%$count_query .= ' WHERE agentnum = '. $agent->agentnum if $agent; -% -% <% include( 'elements/search.html', 'title' => 'Unused Prepaid Cards'. ($agent ? ' for '. $agent->agent : ''), 'menubar' => [ - 'Main menu' => $p, 'Generate cards' => $p.'edit/prepay_credit.cgi', ], 'name' => 'prepaid cards', @@ -23,11 +10,28 @@ }, 'count_query' => $count_query, #'redirect' => $link, - 'header' => [ '#', qw(Amount Time Agent) ], + 'header' => [ '#', qw(Amount Time Upload Download Total Agent) ], 'fields' => [ 'identifier', sub { sprintf('$%.2f', shift->amount ) }, - sub { my $c = shift; $c ? duration_exact($c->seconds) : '' }, + sub { my $c = shift; + $c->seconds ? duration_exact($c->seconds) : '' + }, + sub { my $c = shift; + $c->upbytes + ? FS::UI::bytecount::bytecount_unexact($c->upbytes) + : '' + }, + sub { my $c = shift; + $c->downbytes + ? FS::UI::bytecount::bytecount_unexact($c->downbytes) + : '' + }, + sub { my $c = shift; + $c->totalbytes + ? FS::UI::bytecount::bytecount_unexact($c->totalbytes) + : '' + }, sub { my $agent = shift->agent; $agent ? $agent->agent : ''; }, @@ -36,9 +40,28 @@ '', '', '', + '', + '', + '', sub { my $agent = shift->agent; - $agent ? [ "${p}view/agent.cgi?", 'agentnum' ] : ''; + $agent ? [ "${p}edit/agent.cgi?", 'agentnum' ] : ''; }, ], ) %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $agent = ''; +my $hashref = {}; +if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { +$hashref->{agentnum} = $1; +$agent = qsearchs('agent', { 'agentnum' => $1 } ); +} + +my $count_query = 'SELECT COUNT(*) FROM prepay_credit'; +$count_query .= ' WHERE agentnum = '. $agent->agentnum if $agent; + +