1 %unless ( ref($error) ) {
2 % $cgi->param('error', $error );
3 <% $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string ) %>
6 <% include('/elements/header.html', "$num prepaid cards generated".
7 ( $agent ? ' for '.$agent->agent : '' )
12 % foreach my $card ( @$error ) {
14 <code><% $card %></code>
16 <% $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %>
17 <% $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %>
18 <% $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %>
19 <% $hashref->{upbytes} ? FS::UI::bytecount::bytecount_unexact($hashref->{upbytes}) : '' %>
20 <% $hashref->{downbytes} ? FS::UI::bytecount::bytecount_unexact($hashref->{downbytes}) : '' %>
21 <% $hashref->{totalbytes} ? FS::UI::bytecount::bytecount_unexact($hashref->{totalbytes}) : '' %>
27 <% include('/elements/footer.html') %>
33 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
38 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
39 $agent = qsearchs('agent', { 'agentnum' => $hashref->{agentnum}=$1 } );
45 if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) {
48 $error = 'Illegal number of prepaid cards: '. $cgi->param('num');
51 $hashref->{amount} = $cgi->param('amount');
52 $hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier');
53 $hashref->{upbytes} = $cgi->param('upbytes') * $cgi->param('upmultiplier');
54 $hashref->{downbytes} = $cgi->param('downbytes') * $cgi->param('downmultiplier');
55 $hashref->{totalbytes} = $cgi->param('totalbytes') * $cgi->param('totalmultiplier');
57 $error ||= FS::prepay_credit::generate( $num,
58 scalar($cgi->param('type')),
59 $cgi->param('length'),