1 <% include('/elements/header-popup.html', 'Recharge Service' ) %>
3 <% include('/elements/error.html') %>
5 <FORM NAME="recharge_popup" ACTION="<% popurl(1) %>process/recharge_svc.html" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
9 <% "Recharge $svcnum: $label - $value" %>
10 <% ntable("#cccccc", 2) %>
13 function toggle_prep(what) {
14 if (what.value == "PREP"){
15 what.form.prepaid.disabled = false;
17 what.form.prepaid.disabled = true;
21 % if ($recharge_label) {
23 <TD><INPUT TYPE="radio" NAME="payby" onchange="toggle_prep(this)" VALUE="PREP" <% $payby eq "PREP" ? 'checked' : '' %>></TD>
25 <TD><INPUT TYPE="radio" NAME="payby" onchange="toggle_prep(this)" VALUE="<% $cust_svc->cust_pkg->cust_main->payby %>" <% $payby eq "PREP" ? '' : 'checked' %>></TD>
26 <TD><% $recharge_label %></TD>
30 <INPUT TYPE="hidden" NAME="payby" VALUE="PREP">
33 <TD>Enter prepaid card: </TD>
34 <TD><INPUT TYPE="text" NAME="prepaid" VALUE="<% $prepaid |h %>" <% $payby eq "PREP" ? '' : 'disabled' %>></TD>
40 <INPUT TYPE="submit" NAME="submit" VALUE="Recharge">
44 <% include('/elements/footer.html') %>
48 my $conf = new FS::Conf;
49 my $money_char = $conf->config('money_char') || '$';
55 unless $FS::CurrentUser::CurrentUser->access_right('Recharge customer service');
57 my($svcnum, $prepaid, $payby);
58 if ( $cgi->param('error') ) {
59 $svcnum = $cgi->param('svcnum');
60 $prepaid = $cgi->param('prepaid');
61 $payby = $cgi->param('payby');
62 } elsif ( $cgi->param('svcnum') =~ /^(\d+)$/ ) {
66 die "illegal query ". $cgi->keywords;
69 my $title = 'Recharge Service';
71 my $cust_svc = qsearchs('cust_svc', {'svcnum' => $svcnum});
72 die "No such service: $svcnum" unless $cust_svc;
74 my($label, $value) = $cust_svc->label;
76 $payby = $cust_svc->cust_pkg->cust_main->payby unless $payby;
77 my $part_pkg = $cust_svc->cust_pkg->part_pkg;
78 my $amount = $part_pkg->option('recharge_amount', 1) || 0;
80 my $recharge_label = "Charge $money_char$amount for ";
82 $recharge_label .= $part_pkg->option('recharge_seconds', 1) . 's '
83 if $part_pkg->option('recharge_seconds', 1);
86 $recharge_label .= FS::UI::bytecount::display_bytecount(
87 $part_pkg->option('recharge_upbytes', 1) )
89 if $part_pkg->option('recharge_upbytes', 1);
92 $recharge_label .= FS::UI::bytecount::display_bytecount(
93 $part_pkg->option('recharge_downbytes', 1) )
95 if $part_pkg->option('recharge_downbytes', 1);
98 $recharge_label .= FS::UI::bytecount::display_bytecount(
99 $part_pkg->option('recharge_totalbytes', 1) )
101 if $part_pkg->option('recharge_totalbytes', 1);
105 unless ($recharge_label ne "Charge $money_char$amount for ");