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' : '' %>><% $_ %>
23 <& /elements/select-agent.html,
24 'empty_label' => '(any agent)',
25 'curr_value' => $agentnum,
30 $<INPUT TYPE="text" NAME="amount" SIZE=8 MAXLENGTH=7 VALUE="<% $cgi->param('amount') |h %>">
33 <INPUT TYPE="text" NAME="seconds" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('seconds') |h %>">
34 <SELECT NAME="multiplier">
35 % foreach my $multiplier ( keys %multiplier ) {
37 <OPTION VALUE="<% $multiplier %>"<% $cgi->param('multiplier') eq $multiplier ? ' SELECTED' : '' %>><% $multiplier{$multiplier} %>
44 <INPUT TYPE="text" NAME="upbytes" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('upbytes') |h %>">
45 <SELECT NAME="upmultiplier">
46 % foreach my $multiplier ( keys %bytemultiplier ) {
48 <OPTION VALUE="<% $multiplier %>"<% $cgi->param('upmultiplier') eq $multiplier ? ' SELECTED' : '' %>><% $bytemultiplier{$multiplier} %>
55 <INPUT TYPE="text" NAME="downbytes" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('downbytes') |h %>">
56 <SELECT NAME="downmultiplier">
57 % foreach my $multiplier ( keys %bytemultiplier ) {
59 <OPTION VALUE="<% $multiplier %>"<% $cgi->param('downmultiplier') eq $multiplier ? ' SELECTED' : '' %>><% $bytemultiplier{$multiplier} %>
66 <INPUT TYPE="text" NAME="totalbytes" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('totalbytes') |h %>">
67 <SELECT NAME="totalmultiplier">
68 % foreach my $multiplier ( keys %bytemultiplier ) {
70 <OPTION VALUE="<% $multiplier %>"<% $cgi->param('totalmultiplier') eq $multiplier ? ' SELECTED' : '' %>><% $bytemultiplier{$multiplier} %>
73 </SELECT> total transfer
77 <INPUT TYPE="submit" NAME="submit" VALUE="Generate" onSubmit="this.disabled = true">
81 <% include('/elements/footer.html') %>
86 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
90 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
91 $agent = qsearchs('agent', { 'agentnum' => $agentnum=$1 } );
94 tie my %multiplier, 'Tie::IxHash',
100 tie my %bytemultiplier, 'Tie::IxHash',
104 1073741824 => 'Gbytes',
107 $cgi->param('multiplier', '60') unless $cgi->param('multiplier');
108 $cgi->param('upmultiplier', '1048576') unless $cgi->param('upmultiplier');
109 $cgi->param('downmultiplier', '1048576') unless $cgi->param('downmultiplier');
110 $cgi->param('totalmultiplier','1048576') unless $cgi->param('totalmultiplier');