projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6400a0e
)
RT#24684: Payments for Online Bill Pay [Credit Balance Display]
author
Jonathan Prykop
<jonathan@freeside.biz>
Tue, 7 Jul 2015 02:16:33 +0000
(21:16 -0500)
committer
Jonathan Prykop
<jonathan@freeside.biz>
Tue, 7 Jul 2015 02:16:33 +0000
(21:16 -0500)
FS/FS/ClientAPI/MyAccount.pm
patch
|
blob
|
history
FS/FS/Misc.pm
patch
|
blob
|
history
FS/FS/cust_main.pm
patch
|
blob
|
history
fs_selfservice/FS-SelfService/cgi/small_custview.html
patch
|
blob
|
history
diff --git
a/FS/FS/ClientAPI/MyAccount.pm
b/FS/FS/ClientAPI/MyAccount.pm
index
85f85de
..
420ed06
100644
(file)
--- a/
FS/FS/ClientAPI/MyAccount.pm
+++ b/
FS/FS/ClientAPI/MyAccount.pm
@@
-23,7
+23,7
@@
use FS::Conf;
#use FS::UID qw(dbh);
use FS::Record qw(qsearch qsearchs dbh);
use FS::Msgcat qw(gettext);
#use FS::UID qw(dbh);
use FS::Record qw(qsearch qsearchs dbh);
use FS::Msgcat qw(gettext);
-use FS::Misc qw(card_types);
+use FS::Misc qw(card_types
money_pretty
);
use FS::Misc::DateTime qw(parse_datetime);
use FS::TicketSystem;
use FS::ClientAPI_SessionCache;
use FS::Misc::DateTime qw(parse_datetime);
use FS::TicketSystem;
use FS::ClientAPI_SessionCache;
@@
-609,6
+609,7
@@
sub customer_info_short {
$return{next_bill_date} ? time2str('%m/%d/%Y', $return{next_bill_date} )
: '(none)';
}
$return{next_bill_date} ? time2str('%m/%d/%Y', $return{next_bill_date} )
: '(none)';
}
+ $return{balance_pretty} = money_pretty($return{balance});
$return{countrydefault} = scalar($conf->config('countrydefault'));
$return{countrydefault} = scalar($conf->config('countrydefault'));
@@
-692,6
+693,7
@@
sub billing_history {
}
$return{balance} = $cust_main->balance;
}
$return{balance} = $cust_main->balance;
+ $return{balance_pretty} = money_pretty($return{balance});
$return{next_bill_date} = $cust_main->next_bill_date;
$return{next_bill_date_pretty} =
$return{next_bill_date} ? time2str('%m/%d/%Y', $return{next_bill_date} )
$return{next_bill_date} = $cust_main->next_bill_date;
$return{next_bill_date_pretty} =
$return{next_bill_date} ? time2str('%m/%d/%Y', $return{next_bill_date} )
diff --git
a/FS/FS/Misc.pm
b/FS/FS/Misc.pm
index
9aeff93
..
e1f654c
100644
(file)
--- a/
FS/FS/Misc.pm
+++ b/
FS/FS/Misc.pm
@@
-23,6
+23,7
@@
use Encode;
csv_from_fixed
ocr_image
bytes_substr
csv_from_fixed
ocr_image
bytes_substr
+ money_pretty
);
$DEBUG = 0;
);
$DEBUG = 0;
@@
-828,7
+829,7
@@
sub _pslatex {
}
return if -e "$file.dvi" && -s "$file.dvi";
}
return if -e "$file.dvi" && -s "$file.dvi";
- die "pslatex $file.tex failed
;
see $file.log for details?\n";
+ die "pslatex $file.tex failed
,
see $file.log for details?\n";
}
}
@@
-982,6
+983,22
@@
sub bytes_substr {
return Encode::decode('utf8', $bytes, $chk);
}
return Encode::decode('utf8', $bytes, $chk);
}
+=item money_pretty
+
+Accepts a postive or negative numerical value.
+Returns amount formatted for display,
+including money character.
+
+=cut
+
+sub money_pretty {
+ my $amount = shift;
+ my $money_char = $conf->{'money_char'} || '$';
+ $amount = sprintf("%0.2f",$amount);
+ $amount =~ s/^(-?)/$1$money_char/;
+ return $amount;
+}
+
=back
=head1 BUGS
=back
=head1 BUGS
diff --git
a/FS/FS/cust_main.pm
b/FS/FS/cust_main.pm
index
46df3ff
..
c6602c1
100644
(file)
--- a/
FS/FS/cust_main.pm
+++ b/
FS/FS/cust_main.pm
@@
-32,7
+32,7
@@
use Locale::Country;
use FS::UID qw( dbh driver_name );
use FS::Record qw( qsearchs qsearch dbdef regexp_sql );
use FS::Cursor;
use FS::UID qw( dbh driver_name );
use FS::Record qw( qsearchs qsearch dbdef regexp_sql );
use FS::Cursor;
-use FS::Misc qw( generate_email send_email generate_ps do_print );
+use FS::Misc qw( generate_email send_email generate_ps do_print
money_pretty
);
use FS::Msgcat qw(gettext);
use FS::CurrentUser;
use FS::TicketSystem;
use FS::Msgcat qw(gettext);
use FS::CurrentUser;
use FS::TicketSystem;
@@
-4241,8
+4241,7
@@
sub payment_history {
}
$$item{'balance'} = sprintf("%.2f",$balance);
foreach my $key ( qw(amount balance) ) {
}
$$item{'balance'} = sprintf("%.2f",$balance);
foreach my $key ( qw(amount balance) ) {
- $$item{$key.'_pretty'} = $$item{$key};
- $$item{$key.'_pretty'} =~ s/^(-?)/$1$money_char/;
+ $$item{$key.'_pretty'} = money_pretty($$item{$key});
}
push(@out,$item);
}
}
push(@out,$item);
}
diff --git
a/fs_selfservice/FS-SelfService/cgi/small_custview.html
b/fs_selfservice/FS-SelfService/cgi/small_custview.html
index
919df56
..
bcbdbda
100644
(file)
--- 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>
</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>
%>
</DIV>