summaryrefslogtreecommitdiff
path: root/fs_selfservice/FS-SelfService/cgi
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-07-26 15:41:26 -0700
committerIvan Kohler <ivan@freeside.biz>2015-07-26 15:41:26 -0700
commit9aee669886202be7035e6c6049fc71bc99dd3013 (patch)
tree2fd5bf6de74f3d99270587ffb1833e4188a6373d /fs_selfservice/FS-SelfService/cgi
parentac20214d38d9af00430423f147b5a0e50751b050 (diff)
parent1add633372bdca3cc7163c2ce48363fed3984437 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'fs_selfservice/FS-SelfService/cgi')
-rw-r--r--fs_selfservice/FS-SelfService/cgi/history.html43
-rw-r--r--fs_selfservice/FS-SelfService/cgi/make_ach_payment.html10
-rw-r--r--fs_selfservice/FS-SelfService/cgi/make_payment.html9
-rwxr-xr-xfs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html11
-rw-r--r--fs_selfservice/FS-SelfService/cgi/myaccount_menu.html4
-rwxr-xr-xfs_selfservice/FS-SelfService/cgi/selfservice.cgi7
-rw-r--r--fs_selfservice/FS-SelfService/cgi/small_custview.html15
7 files changed, 53 insertions, 46 deletions
diff --git a/fs_selfservice/FS-SelfService/cgi/history.html b/fs_selfservice/FS-SelfService/cgi/history.html
index 00fdfa5ef..0b6f9ceda 100644
--- a/fs_selfservice/FS-SelfService/cgi/history.html
+++ b/fs_selfservice/FS-SelfService/cgi/history.html
@@ -1,39 +1,14 @@
-<%= include('header', 'Billing History') %>
+<%= include('header', 'Payment History') %>
<%=
-my $balance = 0;
-my $style = 'text-align: left; margin: 0; padding: 0 1em 0 0;';
-my $moneystyle = 'text-align: right; margin: 0; padding: 0 1em 0 0;';
-my $col1 = "#ffffff";
-my $col2 = "#dddddd";
-my $col = $col1;
-foreach my $item (@history) {
- $balance += $$item{'amount'};
- $$item{'amount'} =~ s/^(-?)/$1$money_char/;
- $out .= <<EOF;
- <TR>
- <TD style="$style background: $col;">$$item{'date_pretty'}</TD>
- <TD style="$style background: $col;">$$item{'description'}</TD>
- <TD style="$moneystyle background: $col;">$$item{'amount'}</TD>
- </TR>
-EOF
- $col = $col eq $col1 ? $col2 : $col1;
-}
-$balance = sprintf('%.2f',$balance);
-$balance =~ s/^(-?)/$1$money_char/;
-$out = <<EOF;
-<P>Balance: <B>$balance</B></P>
-<TABLE style="margin: 0;" CELLSPACING="0">
- <TR>
- <TH style="$style background: #ff9999;">Date</TH>
- <TH style="$style background: #ff9999;">Description</TH>
- <TH style="$moneystyle background: #ff9999;">Amount</TH>
- </TR>
-$out
-</TABLE>
-EOF
+my $out = mason_comp(
+ 'session_id' => $session_id,
+ 'comp' => '/elements/customer-statement.html',
+ 'args' => [
+ 'history' => \@history,
+ ]
+);
+$out->{'output'} || $out->{'error'};
%>
-</TABLE>
-
<%= include('footer') %>
diff --git a/fs_selfservice/FS-SelfService/cgi/make_ach_payment.html b/fs_selfservice/FS-SelfService/cgi/make_ach_payment.html
index e33ad574c..8c2dfe305 100644
--- a/fs_selfservice/FS-SelfService/cgi/make_ach_payment.html
+++ b/fs_selfservice/FS-SelfService/cgi/make_ach_payment.html
@@ -3,19 +3,25 @@
<FORM NAME="OneTrueForm" METHOD="POST" ACTION="<%=$selfurl%>" onSubmit="document.OneTrueForm.process.disabled=true">
<INPUT TYPE="hidden" NAME="action" VALUE="ach_payment_results">
<TABLE BGCOLOR="#cccccc">
+<%=
+if ($balance > 0) {
+ $OUT .= <<EOF;
<TR>
<TD ALIGN="right">Amount&nbsp;Due</TD>
<TD>
<TABLE><TR><TD BGCOLOR="#ffffff">
- $<%=sprintf("%.2f",$balance)%>
+ $money_char$balance
</TD></TR></TABLE>
</TD>
</TR>
+EOF
+}
+%>
<TR>
<TD ALIGN="right">Payment&nbsp;amount</TD>
<TD>
<TABLE><TR><TD BGCOLOR="#ffffff">
- $<INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<%=sprintf("%.2f",$balance)%>">
+ <%= $money_char %><INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<%= ($balance > 0) ? $balance : '' %>">
</TD></TR></TABLE>
</TD>
</TR>
diff --git a/fs_selfservice/FS-SelfService/cgi/make_payment.html b/fs_selfservice/FS-SelfService/cgi/make_payment.html
index 5f5bc1c8e..503901edd 100644
--- a/fs_selfservice/FS-SelfService/cgi/make_payment.html
+++ b/fs_selfservice/FS-SelfService/cgi/make_payment.html
@@ -3,14 +3,21 @@
<FORM NAME="OneTrueForm" METHOD="POST" ACTION="<%=$selfurl%>" onSubmit="document.OneTrueForm.process.disabled=true">
<INPUT TYPE="hidden" NAME="action" VALUE="payment_results">
<TABLE BGCOLOR="#cccccc">
+
+<%=
+if ($balance > 0) {
+ $OUT .= <<EOF;
<TR>
<TH ALIGN="right">Amount&nbsp;Due</TH>
<TD COLSPAN=7>
<TABLE><TR><TD BGCOLOR="#ffffff">
- <FONT COLOR="#000000">$<%=sprintf("%.2f",$balance)%></FONT>
+ $money_char$balance
</TD></TR></TABLE>
</TD>
</TR>
+EOF
+}
+%>
<%= $tr_amount_fee %>
diff --git a/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html b/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html
index 9a5678e8f..8c5b1a85a 100755
--- a/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html
+++ b/fs_selfservice/FS-SelfService/cgi/make_thirdparty_payment.html
@@ -8,16 +8,23 @@ onSubmit="document.OneTrueForm.process.disabled=true">
<INPUT TYPE="hidden" NAME="action" VALUE="post_thirdparty_payment">
<INPUT TYPE="hidden" NAME="payby_method" VALUE="<%= $payby_method %>">
<TABLE BGCOLOR="#cccccc">
+<%=
+if ($balance > 0) {
+ $OUT .= <<EOF;
<TR>
<TH ALIGN="right">Balance&nbsp;due</TH>
<TD COLSPAN=7>
- <SPAN STYLE="background-color: #ffffff;">$<%=sprintf("%.2f", $balance)%>
+ <SPAN STYLE="background-color: #ffffff;">$money_char$balance</SPAN>
</TD>
</TR>
+EOF
+}
+%>
+
<TR>
<TH ALIGN="right">Payment&nbsp;amount</TH>
<TD COLSPAN=7>
- $<INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<%=sprintf("%.2f", $balance)%>">
+ <%= $money_char %><INPUT TYPE="text" NAME="amount" SIZE=8 VALUE="<%= ($balance > 0) ? $balance : '' %>">
</TD>
</TR>
<TR><TH></TH>
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
index 6a28d804f..6af5e5ec0 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html
@@ -28,7 +28,7 @@ my %payby_mode;
# $payby_mode{FOO} is true if FOO is thirdparty, false if it's B::OP,
# nonexistent if it's not supported
-if ( ($balance || 0) > 0 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eventually per-pkg or something really fancy
+if ( $enable_payment_without_balance || (($balance || 0) > 0) ) { #eventually per-pkg or something really fancy
if ( exists( $payby_mode{CARD} ) ) {
push @menu, { title => 'Recharge my account with a credit card',
@@ -67,7 +67,7 @@ push @menu,
{ title=>' ' };
push @menu,
- { title=>'View Payment History', url=>'history', size=>'+1' },
+ { title=>'View payment history', url=>'history', size=>'+1' },
;
unless( $hide_usage ){
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
index 4c666cb14..b2ebaef69 100755
--- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
+++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi
@@ -583,10 +583,15 @@ sub make_payment {
my $payment_info = payment_info( 'session_id' => $session_id );
+ my $amount =
+ ($payment_info->{'balance'} && ($payment_info->{'balance'} > 0))
+ ? $payment_info->{'balance'}
+ : '';
+
my $tr_amount_fee = mason_comp(
'session_id' => $session_id,
'comp' => '/elements/tr-amount_fee.html',
- 'args' => [ 'amount' => $payment_info->{'balance'},
+ 'args' => [ 'amount' => $amount,
],
);
diff --git a/fs_selfservice/FS-SelfService/cgi/small_custview.html b/fs_selfservice/FS-SelfService/cgi/small_custview.html
index 919df5631..bcbdbdaa6 100644
--- a/fs_selfservice/FS-SelfService/cgi/small_custview.html
+++ b/fs_selfservice/FS-SelfService/cgi/small_custview.html
@@ -59,10 +59,17 @@ Customer #<B><%= $display_custnum %></B>
</TR></TABLE>
-<%= unless ( $access_pkgnum ) {
- $OUT .= '<BR>Balance: <B>$'. $balance. '</B><BR>';
- }
- '';
+<%=
+unless ( $access_pkgnum ) {
+ if ($balance >= 0) {
+ $OUT .= '<BR>Balance: <B>'. $balance_pretty . '</B><BR>';
+ } else {
+ my $credit_balance_pretty = $balance_pretty;
+ $credit_balance_pretty =~ s/-//;
+ $OUT .= '<BR>Credit Balance: <B>'. $credit_balance_pretty . '</B><BR>';
+ }
+}
+'';
%>
</DIV>