1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
<% include('/elements/header-popup.html', 'Recharge Service' ) %>
<% include('/elements/error.html') %>
<FORM NAME="recharge_popup" ACTION="<% popurl(1) %>process/recharge_svc.html" METHOD=POST>
<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
<BR><BR>
<% "Recharge $svcnum: $label - $value" %>
<% ntable("#cccccc", 2) %>
<SCRIPT>
function toggle_prep(what) {
if (what.value == "PREP"){
what.form.prepaid.disabled = false;
}else{
what.form.prepaid.disabled = true;
}
}
</SCRIPT>
% if ($recharge_label) {
<TR>
<TD><INPUT TYPE="radio" NAME="payby" onchange="toggle_prep(this)" VALUE="PREP" <% $payby eq "PREP" ? 'checked' : '' %>></TD>
<TD>Prepaid Card</TD>
<TD><INPUT TYPE="radio" NAME="payby" onchange="toggle_prep(this)" VALUE="<% $cust_svc->cust_pkg->cust_main->payby %>" <% $payby eq "PREP" ? '' : 'checked' %>></TD>
<TD><% $recharge_label %></TD>
</TR>
% } else {
% $payby = 'PREP';
<INPUT TYPE="hidden" NAME="payby" VALUE="PREP">
% }
<TR>
<TD>Enter prepaid card: </TD>
<TD><INPUT TYPE="text" NAME="prepaid" VALUE="<% $prepaid |h %>" <% $payby eq "PREP" ? '' : 'disabled' %>></TD>
</TR>
</TABLE>
<BR>
<INPUT TYPE="submit" NAME="submit" VALUE="Recharge">
</FORM>
<% include('/elements/footer.html') %>
<%once>
my $conf = new FS::Conf;
my $money_char = $conf->config('money_char') || '$';
</%once>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Recharge customer service');
my($svcnum, $prepaid, $payby);
if ( $cgi->param('error') ) {
$svcnum = $cgi->param('svcnum');
$prepaid = $cgi->param('prepaid');
$payby = $cgi->param('payby');
} elsif ( $cgi->param('svcnum') =~ /^(\d+)$/ ) {
$svcnum = $1;
$prepaid = '';
} else {
die "illegal query ". $cgi->keywords;
}
my $title = 'Recharge Service';
my $cust_svc = qsearchs('cust_svc', {'svcnum' => $svcnum});
die "No such service: $svcnum" unless $cust_svc;
my($label, $value) = $cust_svc->label;
$payby = $cust_svc->cust_pkg->cust_main->payby unless $payby;
my $part_pkg = $cust_svc->cust_pkg->part_pkg;
my $amount = $part_pkg->option('recharge_amount', 1) || 0;
my $recharge_label = "Charge $money_char$amount for ";
$recharge_label .= $part_pkg->option('recharge_seconds', 1) . 's '
if $part_pkg->option('recharge_seconds', 1);
$recharge_label .= FS::UI::bytecount::display_bytecount(
$part_pkg->option('recharge_upbytes', 1) )
. ' up '
if $part_pkg->option('recharge_upbytes', 1);
$recharge_label .= FS::UI::bytecount::display_bytecount(
$part_pkg->option('recharge_downbytes', 1) )
. ' down '
if $part_pkg->option('recharge_downbytes', 1);
$recharge_label .= FS::UI::bytecount::display_bytecount(
$part_pkg->option('recharge_totalbytes', 1) )
. ' total '
if $part_pkg->option('recharge_totalbytes', 1);
$recharge_label = ''
unless ($recharge_label ne "Charge $money_char$amount for ");
</%init>
|