From 9cdbb7eb2cb2d5d01bb9edbbd48a67ba06bf456f Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 9 Apr 2007 23:38:27 +0000 Subject: trigger recharge from the backend as in self-service --- httemplate/misc/recharge_svc.html | 41 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'httemplate/misc/recharge_svc.html') diff --git a/httemplate/misc/recharge_svc.html b/httemplate/misc/recharge_svc.html index 61f738455..9373b825c 100755 --- a/httemplate/misc/recharge_svc.html +++ b/httemplate/misc/recharge_svc.html @@ -12,9 +12,26 @@ <% "Recharge $svcnum: $label - $value" %> <% ntable("#cccccc", 2) %> + + + <% $recharge_label ? '' : 'disabled' %>> + Prepaid Card +% if ($recharge_label) { + > + <% $recharge_label %> +% } + Enter prepaid card: - + > @@ -26,11 +43,16 @@ +<%once> +my $conf = new FS::Conf; +my $money_char = $conf->config('money_char') || '$'; + <%init> -my($svcnum, $cust_svc, $label, $value, $prepaid); +my($svcnum, $cust_svc, $part_pkg, $label, $value, $prepaid, $amount, $payby); if ( $cgi->param('error') ) { $svcnum = $cgi->param('svcnum'); $prepaid = $cgi->param('prepaid'); + $payby = $cgi->param('payby'); } elsif ( $cgi->param('svcnum') =~ /^(\d+)$/ ) { $svcnum = $1; } else { @@ -44,5 +66,20 @@ die "No such service: $svcnum" unless $cust_svc; ($label, $value) = $cust_svc->label; +$payby = $cust_svc->cust_pkg->cust_main->payby unless $payby; +$part_pkg = $cust_svc->cust_pkg->part_pkg; +$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 .= $part_pkg->option('recharge_upbytes', 1) . ' up ' + if $part_pkg->option('recharge_upbytes', 1); +$recharge_label .= $part_pkg->option('recharge_downbytes', 1) . ' down ' + if $part_pkg->option('recharge_downbytes', 1); +$recharge_label .= $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 "); + -- cgit v1.2.1