[freeside-commits] freeside/FS/FS Conf.pm, 1.504, 1.505 cust_statement.pm, 1.2, 1.3

Mark Wells mark at wavetail.420.am
Tue Jan 31 21:30:18 PST 2012


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv18371/FS/FS

Modified Files:
	Conf.pm cust_statement.pm 
Log Message:
print customer statements on the fly, #15864

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.504
retrieving revision 1.505
diff -u -w -d -r1.504 -r1.505
--- Conf.pm	26 Jan 2012 21:18:20 -0000	1.504
+++ Conf.pm	1 Feb 2012 05:30:15 -0000	1.505
@@ -4674,6 +4674,13 @@
   },
 
   { 
+    'key'         => 'cust_main-print_statement_link',
+    'section'     => 'UI',
+    'description' => 'Show a link to download a current statement for the customer.',
+    'type'        => 'checkbox',
+  },
+
+  { 
     'key'         => 'username-pound',
     'section'     => 'username',
     'description' => 'Allow the pound character (#) in usernames.',

Index: cust_statement.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_statement.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- cust_statement.pm	20 Aug 2009 09:47:05 -0000	1.2
+++ cust_statement.pm	1 Feb 2012 05:30:16 -0000	1.3
@@ -60,6 +60,10 @@
 Note that this stores the hash reference, not a distinct copy of the hash it
 points to.  You can ask the object for a copy with the I<hash> method.
 
+Pass "statementnum => 'ALL'" to create a temporary statement that includes 
+all of the customer's invoices.  This statement can't be inserted and won't
+set the statementnum field on any invoices.
+
 =cut
 
 sub new { FS::Record::new(@_); }
@@ -165,7 +169,16 @@
 
 sub cust_bill {
   my $self = shift;
-  qsearch('cust_bill', { 'statementnum' => $self->statementnum } );
+  # we use it about a thousand times, let's cache it
+  $self->{Hash}->{cust_bill} ||= [
+    qsearch('cust_bill', { 
+        $self->statementnum eq 'ALL' ?
+          ('custnum' => $self->custnum) :
+          ('statementnum' => $self->statementnum)
+    } )
+  ];
+
+  @{ $self->{Hash}->{cust_bill} }
 }
 
 sub _aggregate {



More information about the freeside-commits mailing list