X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fprepay_credit.cgi;h=a55522b86a95b7054768df13e3db594e8772d604;hp=25ecbe079f145f436ad18ccf14d5e308e8b54e9d;hb=74e058c8a010ef6feb539248a550d0bb169c1e94;hpb=b5fbaadb1cb2893660e460a1d4a3cabe02774de7 diff --git a/httemplate/edit/process/prepay_credit.cgi b/httemplate/edit/process/prepay_credit.cgi index 25ecbe079..a55522b86 100644 --- a/httemplate/edit/process/prepay_credit.cgi +++ b/httemplate/edit/process/prepay_credit.cgi @@ -1,4 +1,37 @@ -<% +%unless ( ref($error) ) { +% $cgi->param('error', $error ); +<% $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string ) %> +% } else { + +<% include('/elements/header.html', "$num prepaid cards generated". + ( $agent ? ' for '.$agent->agent : '' ) + ) +%> + + +% foreach my $card ( @$error ) { + + <% $card %> + - + <% $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %> + <% $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %> + <% $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %> + <% $hashref->{upbytes} ? FS::UI::bytecount::bytecount_unexact($hashref->{upbytes}) : '' %> + <% $hashref->{downbytes} ? FS::UI::bytecount::bytecount_unexact($hashref->{downbytes}) : '' %> + <% $hashref->{totalbytes} ? FS::UI::bytecount::bytecount_unexact($hashref->{totalbytes}) : '' %> +
+% } + +
+ +<% include('/elements/footer.html') %> + +% } +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + my $hashref = {}; my $agent = ''; @@ -15,37 +48,16 @@ if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) { $error = 'Illegal number of prepaid cards: '. $cgi->param('num'); } -$hashref->{amount} = $cgi->param('amount'); -$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier'); +$hashref->{amount} = $cgi->param('amount'); +$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier'); +$hashref->{upbytes} = $cgi->param('upbytes') * $cgi->param('upmultiplier'); +$hashref->{downbytes} = $cgi->param('downbytes') * $cgi->param('downmultiplier'); +$hashref->{totalbytes} = $cgi->param('totalbytes') * $cgi->param('totalmultiplier'); $error ||= FS::prepay_credit::generate( $num, scalar($cgi->param('type')), + $cgi->param('length'), $hashref ); -unless ( ref($error) ) { - $cgi->param('error', $error ); -%><%= - $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string ) -%><% } else { %> - -<%= header( "$num prepaid cards generated". - ( $agent ? ' for '.$agent->agent : '' ), - menubar( 'Main menu' => popurl(3) ) - ) -%> - - -<% foreach my $card ( @$error ) { %> - <%= $card %> - - - <%= $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %> - <%= $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %> - <%= $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %> -
-<% } %> - -
- - -<% } %> +