[freeside-commits] branch FREESIDE_2_3_BRANCH updated. df42da2496a364dc9d0e6866de280448066413a9
Ivan
ivan at 420.am
Sun May 6 20:51:04 PDT 2012
The branch, FREESIDE_2_3_BRANCH has been updated
via df42da2496a364dc9d0e6866de280448066413a9 (commit)
from e8cd70f5e97bcb8d88841e3f642f9af000011813 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit df42da2496a364dc9d0e6866de280448066413a9
Author: Ivan Kohler <ivan at freeside.biz>
Date: Sun May 6 20:51:03 2012 -0700
add last_invoice_date/last_invoice_date_pretty to customer_info selfservice API calls, RT#17617
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 605d1ad..ac02fd6 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -383,6 +383,8 @@ sub customer_info {
my $cust_main = qsearchs('cust_main', $search )
or return { 'error' => "unknown custnum $custnum" };
+ $return{display_custnum} = $cust_main->display_custnum;
+
if ( $session->{'pkgnum'} ) {
$return{balance} = $cust_main->balance_pkgnum( $session->{'pkgnum'} );
#next_bill_date from cust_pkg?
@@ -422,6 +424,13 @@ sub customer_info {
};
} $cust_main->open_cust_bill;
$return{open_invoices} = \@open;
+
+ my $sql = 'SELECT MAX(_date) FROM cust_bill WHERE custnum = ?';
+ my $sth = dbh->prepare($sql) or die dbh->errstr;
+ $sth->execute($custnum) or die $sth->errstr;
+ $return{'last_invoice_date'} = $sth->fetchrow_arrayref->[0];
+ $return{'last_invoice_date_pretty'} =
+ time2str('%m/%d/%Y', $return{'last_invoice_date'} );
}
$return{countrydefault} = scalar($conf->config('countrydefault'));
@@ -497,8 +506,8 @@ sub customer_info {
}
- return { 'error' => '',
- 'custnum' => $custnum,
+ return { 'error' => '',
+ 'custnum' => $custnum,
%return,
};
@@ -521,6 +530,8 @@ sub customer_info_short {
my $cust_main = qsearchs('cust_main', $search )
or return { 'error' => "unknown custnum $custnum" };
+ $return{display_custnum} = $cust_main->display_custnum;
+
$return{countrydefault} = scalar($conf->config('countrydefault'));
$return{small_custview} =
-----------------------------------------------------------------------
Summary of changes:
FS/FS/ClientAPI/MyAccount.pm | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
More information about the freeside-commits
mailing list