search/cust_pkg.cgi patch
Adam Rose
adamr at eaze.net
Fri Jun 8 10:06:42 PDT 2001
Here is a patch of my additions or showing only active,cancel, susp
accounts. Also a small change to only show unconfigured accounts and not
cancels. I hope this helps someone out there.
@@ -67,6 +67,9 @@
foreach $cust_pkg (qsearch('cust_pkg',{})) {
my($flag)=0;
my($pkg_svc);
+ my($cancel) = $cust_pkg->getfield('cancel');
+ next if $cancel;
+
PKG_SVC:
foreach $pkg_svc (qsearch('pkg_svc',{ 'pkgpart' => $cust_pkg->pkgpart
})) {
if ( $pkg_svc->quantity
@@ -82,6 +85,39 @@
}
push @cust_pkg, $cust_pkg if $flag;
}
+} elsif ( $query eq 'active' ) {
+ $sortby = \*pkgnum_sort;
+ @cust_pkg = qsearch('cust_pkg',{'susp'=>'','cancel'=>''});
+} elsif ( $query eq 'susp' ) {
+ $sortby = \*pkgnum_sort;
+ my $cust_pkg;
+ foreach $cust_pkg (qsearch('cust_pkg',{})){
+ my $susp;
+ my $cancel;
+ ($susp,$cancel)=(
+ $cust_pkg->getfield('susp'),
+ $cust_pkg->getfield('cancel'),
+ );
+ if (($susp =~/\d+/) && !($cancel)){
+ push @cust_pkg, $cust_pkg;
+ }
+ }
+} elsif ( $query eq 'cancel' ) {
+ $sortby = \*pkgnum_sort;
+ my $cust_pkg;
+ foreach $cust_pkg (qsearch('cust_pkg',{})){
+ my $susp;
+ my $cancel;
+ ($susp,$cancel)=(
+ $cust_pkg->getfield('susp'),
+ $cust_pkg->getfield('cancel'),
+ );
+ if ($cancel =~/\d+/){
+ push @cust_pkg, $cust_pkg;
+ }
+ }
+
+
} else {
die "Empty QUERY_STRING!";
}
@@ -148,4 +184,3 @@
sub pkgnum_sort {
$a->getfield('pkgnum') <=> $b->getfield('pkgnum');
}
-- Adam
More information about the freeside-users
mailing list