5 %if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
6 % $agent = qsearchs('agent', { 'agentnum' => $hashref->{agentnum}=$1 } );
12 %if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) {
15 % $error = 'Illegal number of prepaid cards: '. $cgi->param('num');
18 %$hashref->{amount} = $cgi->param('amount');
19 %$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier');
20 %$hashref->{upbytes} = $cgi->param('upbytes') * $cgi->param('upmultiplier');
21 %$hashref->{downbytes} = $cgi->param('downbytes') * $cgi->param('downmultiplier');
22 %$hashref->{totalbytes} = $cgi->param('totalbytes') * $cgi->param('totalmultiplier');
24 %$error ||= FS::prepay_credit::generate( $num,
25 % scalar($cgi->param('type')),
29 %unless ( ref($error) ) {
30 % $cgi->param('error', $error );
33 $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string )
38 <% include("/elements/header.html", "$num prepaid cards generated".
39 ( $agent ? ' for '.$agent->agent : '' ),
40 menubar( 'Main menu' => popurl(3) )
45 % foreach my $card ( @$error ) {
47 <code><% $card %></code>
49 <% $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %>
50 <% $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %>
51 <% $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %>
52 <% $hashref->{upbytes} ? FS::UI::Web::bytecount_unexact($hashref->{upbytes}) : '' %>
53 <% $hashref->{downbytes} ? FS::UI::Web::bytecount_unexact($hashref->{downbytes}) : '' %>
54 <% $hashref->{totalbytes} ? FS::UI::Web::bytecount_unexact($hashref->{totalbytes}) : '' %>