[freeside-commits] freeside/FS/FS cust_main.pm,1.259,1.260

Ivan,,, ivan at wavetail.420.am
Tue Jan 2 13:06:29 PST 2007


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv2525

Modified Files:
	cust_main.pm 
Log Message:
fix num_pkgs to accept empty $sql param, no trailing AND

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.259
retrieving revision 1.260
diff -u -d -r1.259 -r1.260
--- cust_main.pm	29 Dec 2006 08:51:32 -0000	1.259
+++ cust_main.pm	2 Jan 2007 21:06:27 -0000	1.260
@@ -1641,8 +1641,9 @@
 
 sub num_pkgs {
   my( $self, $sql ) = @_;
+  $sql = "AND $sql" if $sql && $sql !~ /^\s*$/ && $sql !~ /^\s*AND/i
   my $sth = dbh->prepare(
-    "SELECT COUNT(*) FROM cust_pkg WHERE custnum = ? AND $sql"
+    "SELECT COUNT(*) FROM cust_pkg WHERE custnum = ? $sql"
   ) or die dbh->errstr;
   $sth->execute($self->custnum) or die $sth->errstr;
   $sth->fetchrow_arrayref->[0];



More information about the freeside-commits mailing list