1 <% include("/elements/header.html",'Generate prepaid cards'. ($agent ? ' for '. $agent->agent : '') ) %>
3 <% include('/elements/error.html') %>
5 <FORM ACTION="<%popurl(1)%>process/prepay_credit.cgi" METHOD="POST" NAME="OneTrueForm" onSubmit="document.OneTrueForm.submit.disabled=true">
8 <INPUT TYPE="text" NAME="num" VALUE="<% $cgi->param('num') || '(quantity)' |h %>" SIZE=10 MAXLENGTH=10 onFocus="if ( this.value == '(quantity)' ) { this.value = ''; }">
12 <INPUT TYPE="text" NAME="length" SIZE=3 MAXLENGTH=2 VALUE=8>
14 % foreach (qw(alpha alphanumeric numeric)) {
15 <OPTION<% $cgi->param('type') eq $_ ? ' SELECTED' : '' %>><% $_ %>
21 <BR>for <SELECT NAME="agentnum"><OPTION>(any agent)
22 % foreach my $opt_agent ( qsearch('agent', { 'disabled' => '' } ) ) {
24 <OPTION VALUE="<% $opt_agent->agentnum %>"<% $opt_agent->agentnum == $agentnum ? ' SELECTED' : '' %>><% $opt_agent->agent %>
31 $<INPUT TYPE="text" NAME="amount" SIZE=8 MAXLENGTH=7 VALUE="<% $cgi->param('amount') |h %>">
34 <INPUT TYPE="text" NAME="seconds" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('seconds') |h %>">
35 <SELECT NAME="multiplier">
36 % foreach my $multiplier ( keys %multiplier ) {
38 <OPTION VALUE="<% $multiplier %>"<% $cgi->param('multiplier') eq $multiplier ? ' SELECTED' : '' %>><% $multiplier{$multiplier} %>
45 <INPUT TYPE="text" NAME="upbytes" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('upbytes') |h %>">
46 <SELECT NAME="upmultiplier">
47 % foreach my $multiplier ( keys %bytemultiplier ) {
49 <OPTION VALUE="<% $multiplier %>"<% $cgi->param('upmultiplier') eq $multiplier ? ' SELECTED' : '' %>><% $bytemultiplier{$multiplier} %>
56 <INPUT TYPE="text" NAME="downbytes" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('downbytes') |h %>">
57 <SELECT NAME="downmultiplier">
58 % foreach my $multiplier ( keys %bytemultiplier ) {
60 <OPTION VALUE="<% $multiplier %>"<% $cgi->param('downmultiplier') eq $multiplier ? ' SELECTED' : '' %>><% $bytemultiplier{$multiplier} %>
67 <INPUT TYPE="text" NAME="totalbytes" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('totalbytes') |h %>">
68 <SELECT NAME="totalmultiplier">
69 % foreach my $multiplier ( keys %bytemultiplier ) {
71 <OPTION VALUE="<% $multiplier %>"<% $cgi->param('totalmultiplier') eq $multiplier ? ' SELECTED' : '' %>><% $bytemultiplier{$multiplier} %>
74 </SELECT> total transfer
78 <INPUT TYPE="submit" NAME="submit" VALUE="Generate" onSubmit="this.disabled = true">
82 <% include('/elements/footer.html') %>
87 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
91 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
92 $agent = qsearchs('agent', { 'agentnum' => $agentnum=$1 } );
95 tie my %multiplier, 'Tie::IxHash',
101 tie my %bytemultiplier, 'Tie::IxHash',
105 1073741824 => 'Gbytes',
108 $cgi->param('multiplier', '60') unless $cgi->param('multiplier');
109 $cgi->param('upmultiplier', '1048576') unless $cgi->param('upmultiplier');
110 $cgi->param('downmultiplier', '1048576') unless $cgi->param('downmultiplier');
111 $cgi->param('totalmultiplier','1048576') unless $cgi->param('totalmultiplier');