diff options
Diffstat (limited to 'httemplate/edit/process/prepay_credit.cgi')
-rw-r--r-- | httemplate/edit/process/prepay_credit.cgi | 78 |
1 files changed, 42 insertions, 36 deletions
diff --git a/httemplate/edit/process/prepay_credit.cgi b/httemplate/edit/process/prepay_credit.cgi index ca7472432..fb15fd8e4 100644 --- a/httemplate/edit/process/prepay_credit.cgi +++ b/httemplate/edit/process/prepay_credit.cgi @@ -1,51 +1,57 @@ +% +%my $hashref = {}; +% +%my $agent = ''; +%if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { +% $agent = qsearchs('agent', { 'agentnum' => $hashref->{agentnum}=$1 } ); +%} +% +%my $error = ''; +% +%my $num = 0; +%if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) { +% $num = $1; +%} else { +% $error = 'Illegal number of prepaid cards: '. $cgi->param('num'); +%} +% +%$hashref->{amount} = $cgi->param('amount'); +%$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier'); +% +%$error ||= FS::prepay_credit::generate( $num, +% scalar($cgi->param('type')), +% $hashref +% ); +% +%unless ( ref($error) ) { +% $cgi->param('error', $error ); +% <% -my $hashref = {}; - -my $agent = ''; -if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { - $agent = qsearchs('agent', { 'agentnum' => $hashref->{agentnum}=$1 } ); -} - -my $error = ''; - -my $num = 0; -if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) { - $num = $1; -} else { - $error = 'Illegal number of prepaid cards: '. $cgi->param('num'); -} - -$hashref->{amount} = $cgi->param('amount'); -$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier'); - -$error ||= FS::prepay_credit::generate( $num, - scalar($cgi->param('type')), - $hashref - ); - -unless ( ref($error) ) { - $cgi->param('error', $error ); -%><%= $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string ) -%><% } else { %> +%> +% } else { + -<%= include("/elements/header.html", "$num prepaid cards generated". +<% include("/elements/header.html", "$num prepaid cards generated". ( $agent ? ' for '.$agent->agent : '' ), menubar( 'Main menu' => popurl(3) ) ) %> <FONT SIZE="+1"> -<% foreach my $card ( @$error ) { %> - <code><%= $card %></code> +% foreach my $card ( @$error ) { + + <code><% $card %></code> - - <%= $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %> - <%= $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %> - <%= $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %> + <% $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %> + <% $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %> + <% $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %> <br> -<% } %> +% } + </FONT> </BODY></HTML> -<% } %> +% } + |