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');
21 %$error ||= FS::prepay_credit::generate( $num,
22 % scalar($cgi->param('type')),
26 %unless ( ref($error) ) {
27 % $cgi->param('error', $error );
30 $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string )
35 <% include("/elements/header.html", "$num prepaid cards generated".
36 ( $agent ? ' for '.$agent->agent : '' ),
37 menubar( 'Main menu' => popurl(3) )
42 % foreach my $card ( @$error ) {
44 <code><% $card %></code>
46 <% $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %>
47 <% $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %>
48 <% $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %>