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');
23 %$error ||= FS::prepay_credit::generate( $num,
24 % scalar($cgi->param('type')),
28 %unless ( ref($error) ) {
29 % $cgi->param('error', $error );
32 $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string )
37 <% include("/elements/header.html", "$num prepaid cards generated".
38 ( $agent ? ' for '.$agent->agent : '' ),
39 menubar( 'Main menu' => popurl(3) )
44 % foreach my $card ( @$error ) {
46 <code><% $card %></code>
48 <% $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %>
49 <% $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %>
50 <% $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %>
51 <% $hashref->{upbytes} ? FS::UI::Web::bytecount_unexact($hashref->{upbytes}) : '' %>
52 <% $hashref->{downbytes} ? FS::UI::Web::bytecount_unexact($hashref->{downbytes}) : '' %>