diff options
author | ivan <ivan> | 2007-01-02 21:06:27 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-01-02 21:06:27 +0000 |
commit | c7727be6391c2b48fe520edbc8df88a7762ac30c (patch) | |
tree | 86df988a63a35bfcfb242408226cb94da5c791ae /FS/FS | |
parent | 932fec53db68a930566e01b55cef887a4700d019 (diff) |
fix num_pkgs to accept empty $sql param, no trailing AND
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/cust_main.pm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 32da745fe..9038d95a8 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1641,8 +1641,9 @@ sub num_ncancelled_pkgs { 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]; |