X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fprepay_credit.cgi;h=a55522b86a95b7054768df13e3db594e8772d604;hb=20f03d52cc6c930f610c0b4466eeeeda54fdbb40;hp=24ce25608cd5087f53928f816f3d648c57e77f08;hpb=0930d22ffc440f80c1b222b2e750cadbabd9e8f6;p=freeside.git diff --git a/httemplate/edit/process/prepay_credit.cgi b/httemplate/edit/process/prepay_credit.cgi index 24ce25608..a55522b86 100644 --- a/httemplate/edit/process/prepay_credit.cgi +++ b/httemplate/edit/process/prepay_credit.cgi @@ -1,41 +1,9 @@ -% -%my $hashref = {}; -% -%my $agent = ''; -%if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { -% $agent = qsearchs('agent', { 'agentnum' => $hashref->{agentnum}=$1 } ); -%} -% -%my $error = ''; -% -%my $num = 0; -%if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) { -% $num = $1; -%} else { -% $error = 'Illegal number of prepaid cards: '. $cgi->param('num'); -%} -% -%$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')), -% $hashref -% ); -% %unless ( ref($error) ) { % $cgi->param('error', $error ); -% -<% - $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string ) -%> +<% $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string ) %> % } else { - -<% include("/elements/header.html", "$num prepaid cards generated". +<% include('/elements/header.html', "$num prepaid cards generated". ( $agent ? ' for '.$agent->agent : '' ) ) %> @@ -54,14 +22,42 @@
% } - - +<% include('/elements/footer.html') %> + % } <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $hashref = {}; + +my $agent = ''; +if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { + $agent = qsearchs('agent', { 'agentnum' => $hashref->{agentnum}=$1 } ); +} + +my $error = ''; + +my $num = 0; +if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) { + $num = $1; +} else { + $error = 'Illegal number of prepaid cards: '. $cgi->param('num'); +} + +$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 + ); +