[freeside-commits] freeside/FS/FS Conf.pm, 1.468.2.34, 1.468.2.35 cust_statement.pm, 1.2, 1.2.8.1

Mark Wells mark at wavetail.420.am
Tue Jan 31 21:35:29 PST 2012


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

Modified Files:
      Tag: FREESIDE_2_3_BRANCH
	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.468.2.34
retrieving revision 1.468.2.35
diff -u -w -d -r1.468.2.34 -r1.468.2.35
--- Conf.pm	15 Jan 2012 02:18:29 -0000	1.468.2.34
+++ Conf.pm	1 Feb 2012 05:35:26 -0000	1.468.2.35
@@ -4686,6 +4686,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.2.8.1
diff -u -w -d -r1.2 -r1.2.8.1
--- cust_statement.pm	20 Aug 2009 09:47:05 -0000	1.2
+++ cust_statement.pm	1 Feb 2012 05:35:26 -0000	1.2.8.1
@@ -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