summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2010-08-03 02:11:30 +0000
committerivan <ivan>2010-08-03 02:11:30 +0000
commit27625d6ad7411e16c118e328514391cef0b6c110 (patch)
treec88f64b11438c55692d792e5625bb9589622f9ae /FS
parentaa4d239c957f56aaf8f663ed9e3036477ae91b22 (diff)
fix active customers sometimes showing in search results for new "ordered" status, RT#9381
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_main.pm33
1 files changed, 22 insertions, 11 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 002b0c1d1..47eccd7f8 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -7488,7 +7488,8 @@ recurring packages not yet setup).
=cut
sub ordered_sql {
- " 0 < ( $select_count_pkgs AND ". FS::cust_pkg->ordered_sql. " ) ";
+ FS::cust_main->none_active_sql.
+ " AND 0 < ( $select_count_pkgs AND ". FS::cust_pkg->ordered_sql. " ) ";
}
=item active_sql
@@ -7502,6 +7503,18 @@ sub active_sql {
" 0 < ( $select_count_pkgs AND ". FS::cust_pkg->active_sql. " ) ";
}
+=item none_active_sql
+
+Returns an SQL expression identifying cust_main records with no active
+recurring packages. This includes customers of status prospect, ordered,
+inactive, and suspended.
+
+=cut
+
+sub none_active_sql {
+ " 0 = ( $select_count_pkgs AND ". FS::cust_pkg->active_sql. " ) ";
+}
+
=item inactive_sql
Returns an SQL expression identifying inactive cust_main records (customers with
@@ -7509,11 +7522,10 @@ no active recurring packages, but otherwise unsuspended/uncancelled).
=cut
-sub inactive_sql { "
- 0 = ( $select_count_pkgs AND ". FS::cust_pkg->active_sql. " )
- AND
- 0 < ( $select_count_pkgs AND ". FS::cust_pkg->inactive_sql. " )
-"; }
+sub inactive_sql {
+ FS::cust_main->none_active_sql.
+ " AND 0 < ( $select_count_pkgs AND ". FS::cust_pkg->inactive_sql. " ) ";
+}
=item susp_sql
=item suspended_sql
@@ -7524,11 +7536,10 @@ Returns an SQL expression identifying suspended cust_main records.
sub suspended_sql { susp_sql(@_); }
-sub susp_sql { "
- 0 < ( $select_count_pkgs AND ". FS::cust_pkg->suspended_sql. " )
- AND
- 0 = ( $select_count_pkgs AND ". FS::cust_pkg->active_sql. " )
-"; }
+sub susp_sql {
+ FS::cust_main->none_active_sql.
+ " AND 0 < ( $select_count_pkgs AND ". FS::cust_pkg->suspended_sql. " ) ";
+}
=item cancel_sql
=item cancelled_sql