[freeside-commits] freeside/FS/FS Conf.pm, 1.322, 1.323 cust_main.pm, 1.459, 1.460

Ivan,,, ivan at wavetail.420.am
Sun Oct 4 19:35:52 PDT 2009


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

Modified Files:
	Conf.pm cust_main.pm 
Log Message:
add manual_process-skip_first option, RT#5889

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.322
retrieving revision 1.323
diff -u -d -r1.322 -r1.323
--- Conf.pm	5 Oct 2009 02:16:46 -0000	1.322
+++ Conf.pm	5 Oct 2009 02:35:49 -0000	1.323
@@ -1873,6 +1873,12 @@
                      ],
   },
 
+  {
+    'key'         => 'manual_process-skip_first',
+    'section'     => 'billing',
+    'description' => "When using manual_process-pkgpart, omit the fee if it is the customer's first payment.",
+    'type'        => 'checkbox',
+  },
 
   {
     'key'         => 'allow_negative_charges',

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.459
retrieving revision 1.460
diff -u -d -r1.459 -r1.460
--- cust_main.pm	5 Oct 2009 01:07:45 -0000	1.459
+++ cust_main.pm	5 Oct 2009 02:35:50 -0000	1.460
@@ -7377,10 +7377,26 @@
 
 sub cust_pay {
   my $self = shift;
+  return $self->num_cust_pay unless wantarray;
   sort { $a->_date <=> $b->_date }
     qsearch( 'cust_pay', { 'custnum' => $self->custnum } )
 }
 
+=item num_cust_pay
+
+Returns the number of payments (see L<FS::cust_pay>) for this customer.  Also
+called automatically when the cust_pay method is used in a scalar context.
+
+=cut
+
+sub num_cust_pay {
+  my $self = shift;
+  my $sql = "SELECT COUNT(*) FROM cust_pay WHERE custnum = ?";
+  my $sth = dbh->prepare($sql) or die dbh->errstr;
+  $sth->execute($self->custnum) or die $sth->errstr;
+  $sth->fetchrow_arrayref->[0];
+}
+
 =item cust_pay_pkgnum
 
 Returns all the payments (see L<FS::cust_pay>) for this customer's specific



More information about the freeside-commits mailing list