[freeside-commits] branch master updated. 57b5e61bbf33519f0f42dd92913a78b4de764052
Ivan
ivan at 420.am
Sun May 6 20:51:03 PDT 2012
The branch, master has been updated
via 57b5e61bbf33519f0f42dd92913a78b4de764052 (commit)
from f281f59e4b3f8fed53e64b57d9cb4eaedd73e8e0 (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 57b5e61bbf33519f0f42dd92913a78b4de764052
Author: Ivan Kohler <ivan at freeside.biz>
Date: Sun May 6 20:51:02 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