X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Frecharge_svc.html;h=a1732fca5059c5927d36b69fb32da0b6f4fab50a;hp=61f738455bdb2e5ba7d121cfd33d6723057fbce5;hb=2eea268a59cf357853e31ff8d5db6033e4bdc8ea;hpb=dbb388836b7951a3db49deda05a1ff9ba5125c17 diff --git a/httemplate/misc/recharge_svc.html b/httemplate/misc/recharge_svc.html index 61f738455..a1732fca5 100755 --- a/httemplate/misc/recharge_svc.html +++ b/httemplate/misc/recharge_svc.html @@ -1,9 +1,6 @@ <% include('/elements/header-popup.html', 'Recharge Service' ) %> -% if ( $cgi->param('error') ) { - Error: <% $cgi->param('error') %> -

-% } +<% include('/elements/error.html') %>
@@ -12,9 +9,29 @@ <% "Recharge $svcnum: $label - $value" %> <% ntable("#cccccc", 2) %> + +% if ($recharge_label) { + + > + Prepaid Card + > + <% $recharge_label %> + +% } else { +% $payby = 'PREP'; + +% } Enter prepaid card: - + > @@ -23,26 +40,69 @@
- - +<% include('/elements/footer.html') %> + +<%once> + +my $conf = new FS::Conf; +my $money_char = $conf->config('money_char') || '$'; + + <%init> -my($svcnum, $cust_svc, $label, $value, $prepaid); + +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'; -$cust_svc = qsearchs('cust_svc', {'svcnum' => $svcnum}); +my $cust_svc = qsearchs('cust_svc', {'svcnum' => $svcnum}); die "No such service: $svcnum" unless $cust_svc; -($label, $value) = $cust_svc->label; +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 ");