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 );
29 $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string )
32 <%= header( "$num prepaid cards generated".
33 ( $agent ? ' for '.$agent->agent : '' ),
34 menubar( 'Main menu' => popurl(3) )
39 <% foreach my $card ( @$error ) { %>
40 <code><%= $card %></code>
42 <%= $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %>
43 <%= $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %>
44 <%= $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %>