<%
-#<!-- $Id: cust_main.cgi,v 1.15 2001-12-03 08:41:43 ivan Exp $ -->
+#<!-- $Id: cust_main.cgi,v 1.19 2001-12-26 05:19:01 ivan Exp $ -->
use strict;
#use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby );
#use vars qw( $conf %all_pkgs $cgi @cust_main $sortby );
-use vars qw( $conf %all_pkgs $cgi @cust_main $sortby $orderby $maxrecords $limit $offset );
+use vars qw( $conf %all_pkgs $cgi @cust_main $sortby
+ $orderby $maxrecords $limit $offset );
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use IO::Handle;
use String::Approx qw(amatch);
use FS::UID qw(dbh cgisuidsetup);
+use FS::Conf;
use FS::Record qw(qsearch qsearchs dbdef jsearch);
use FS::CGI qw(header menubar eidiot popurl table);
use FS::cust_main;
$conf = new FS::Conf;
$maxrecords = $conf->config('maxsearchrecordsperpage');
-my $cache;
+#my $cache;
#my $monsterjoin = <<END;
#cust_main left outer join (
#) using (custnum)
#END
-my $monsterjoin = <<END;
-cust_main left outer join (
- ( cust_pkg left outer join part_pkg using(pkgpart)
- ) left outer join (
- (
- (
- ( cust_svc left outer join part_svc using (svcpart)
- ) left outer join (
- svc_acct left outer join (
- select svcnum, domain, catchall from svc_domain
- ) as svc_acct_domsvc (
- svc_acct_svcnum, svc_acct_domain, svc_acct_catchall
- ) on svc_acct.domsvc = svc_acct_domsvc.svc_acct_svcnum
- ) using (svcnum)
- ) left outer join svc_domain using(svcnum)
- ) left outer join svc_forward using(svcnum)
- ) using (pkgnum)
-) using (custnum)
-END
-
$orderby = ''; #removeme
$limit = '';
or die dbh->errstr. " doing $statement";
$sth->execute or die "Error executing \"$statement\": ". $sth->errstr;
- $total = @{$sth->fetchrow_arrayref}[0];
+ $total = $sth->fetchrow_arrayref->[0];
my @just_cust_main = qsearch('cust_main',{}, '',
"$ncancelled $orderby $limit"
#%all_pkgs = ();
if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) {
- print $cgi->redirect(popurl(2). "view/cust_main.cgi?". $cust_main[0]->custnum);
+ if ( $cgi->param('quickpay') eq 'yes' ) {
+ print $cgi->redirect(popurl(2). "edit/cust_pay.cgi?quickpay=yes;custnum=". $cust_main[0]->custnum);
+ } else {
+ print $cgi->redirect(popurl(2). "view/cust_main.cgi?". $cust_main[0]->custnum);
+ }
exit;
} elsif ( scalar(@cust_main) == 0 ) {
eidiot "No matching customers found!\n";
'Main Menu', popurl(2)
)), "$total matching customers found ";
+ #begin pager
my $pager = '';
if ( $total != scalar(@cust_main) && $maxrecords ) {
unless ( $offset == 0 ) {
'"><B><FONT SIZE="+1">Next</FONT></B></A> ';
}
}
+ #end pager
if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me
|| ( $conf->exists('hidecancelledcustomers')
}
#my($rowspan) = scalar(@{$all_pkgs{$custnum}});
- my $view = $p. 'view/cust_main.cgi?'. $custnum;
+ my $view;
+ if ( defined $cgi->param('quickpay') && $cgi->param('quickpay') eq 'yes' ) {
+ $view = $p. 'edit/cust_pay.cgi?quickpay=yes;custnum='. $custnum;
+ } else {
+ $view = $p. 'view/cust_main.cgi?'. $custnum;
+ }
print <<END;
<TR>
<TD ROWSPAN=$rowspan><A HREF="$view"><FONT SIZE=-1>$custnum</FONT></A></TD>
}
-undef $cache; #does this help?
+#undef $cache; #does this help?
#