[freeside-commits] freeside/FS/FS/ClientAPI MyAccount.pm, 1.133.2.22, 1.133.2.23
Ivan,,,
ivan at wavetail.420.am
Thu Oct 27 18:32:24 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory wavetail.420.am:/tmp/cvs-serv16917/FS/FS/ClientAPI
Modified Files:
Tag: FREESIDE_2_3_BRANCH
MyAccount.pm
Log Message:
legacy invoices via self-service, RT#13656
Index: MyAccount.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/MyAccount.pm,v
retrieving revision 1.133.2.22
retrieving revision 1.133.2.23
diff -u -w -d -r1.133.2.22 -r1.133.2.23
--- MyAccount.pm 7 Oct 2011 23:30:39 -0000 1.133.2.22
+++ MyAccount.pm 28 Oct 2011 01:32:21 -0000 1.133.2.23
@@ -30,6 +30,7 @@
use FS::part_svc;
use FS::cust_main;
use FS::cust_bill;
+use FS::legacy_cust_bill;
use FS::cust_main_county;
use FS::cust_pkg;
use FS::payby;
@@ -1143,6 +1144,52 @@
}
+sub legacy_invoice {
+ my $p = shift;
+ my $session = _cache->get($p->{'session_id'})
+ or return { 'error' => "Can't resume session" }; #better error message
+
+ my $custnum = $session->{'custnum'};
+
+ my $legacyinvnum = $p->{'legacyinvnum'};
+
+ my $legacy_cust_bill = qsearchs('legacy_cust_bill', {
+ 'legacyinvnum' => $legacyinvnum,
+ 'custnum' => $custnum,
+ }) or return { 'error' => "Can't find legacyinvnum" };
+
+ #my %return;
+
+ return { 'error' => '',
+ 'legacyinvnum' => $legacyinvnum,
+ 'invoice_html' => $legacy_cust_bill->content_html,
+ };
+
+}
+
+sub legacy_invoice_pdf {
+ my $p = shift;
+ my $session = _cache->get($p->{'session_id'})
+ or return { 'error' => "Can't resume session" }; #better error message
+
+ my $custnum = $session->{'custnum'};
+
+ my $legacyinvnum = $p->{'legacyinvnum'};
+
+ my $legacy_cust_bill = qsearchs('legacy_cust_bill', {
+ 'legacyinvnum' => $legacyinvnum,
+ 'custnum' => $custnum,
+ }) or return { 'error' => "Can't find legacyinvnum" };
+
+ #my %return;
+
+ return { 'error' => '',
+ 'legacyinvnum' => $legacyinvnum,
+ 'invoice_pdf' => $legacy_cust_bill->content_pdf,
+ };
+
+}
+
sub invoice_logo {
my $p = shift;
@@ -1187,6 +1234,7 @@
or return { 'error' => "unknown custnum $custnum" };
my @cust_bill = $cust_main->cust_bill;
+ my @legacy_cust_bill = $cust_main->legacy_cust_bill;
my $balance = 0;
@@ -1207,7 +1255,21 @@
}
}
@cust_bill
- ]
+ ],
+ 'legacy_invoices' => [
+ map {
+ +{ 'legacyinvnum' => $_->legacyinvnum,
+ 'legacyid' => $_->legacyid,
+ '_date' => $_->_date,
+ 'date' => time2str("%b %o, %Y", $_->_date),
+ 'date_short' => time2str("%m-%d-%Y", $_->_date),
+ 'charged' => sprintf('%.2f', $_->charged),
+ 'has_content' => ( length($_->content_pdf)
+ || length($_->content_html) ),
+ }
+ }
+ @legacy_cust_bill
+ ],
};
}
More information about the freeside-commits
mailing list