From 1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 30 Jan 2002 14:18:09 +0000 Subject: remove use Module; and $cgi = new CGI; &cgisuidsetup(); from all templates. should work better under Mason. --- httemplate/search/cust_bill.cgi | 19 ++---------- httemplate/search/cust_main.cgi | 65 +++++++++++++++++---------------------- httemplate/search/cust_pay.cgi | 22 +++---------- httemplate/search/cust_pkg.cgi | 32 +++++-------------- httemplate/search/svc_acct.cgi | 34 ++++++-------------- httemplate/search/svc_acct_sm.cgi | 28 +++++------------ httemplate/search/svc_domain.cgi | 32 +++++-------------- 7 files changed, 68 insertions(+), 164 deletions(-) (limited to 'httemplate/search') diff --git a/httemplate/search/cust_bill.cgi b/httemplate/search/cust_bill.cgi index 41a4a546e..755745fde 100755 --- a/httemplate/search/cust_bill.cgi +++ b/httemplate/search/cust_bill.cgi @@ -1,20 +1,7 @@ + <% -# - -use strict; -use vars qw ( $cgi $invnum $query $sortby @cust_bill ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use Date::Format; -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl header menubar eidiot table ); -use FS::Record qw(qsearch qsearchs); -use FS::cust_bill; -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); +my(@cust_bill, $sortby); if ( $cgi->keywords ) { my($query) = $cgi->keywords; if ( $query eq 'invnum' ) { @@ -55,7 +42,7 @@ if ( $cgi->keywords ) { } } else { $cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/; - $invnum = $2; + my $invnum = $2; @cust_bill = qsearchs('cust_bill', { 'invnum' => $invnum } ); $sortby = \*invnum_sort; } diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 65db0a815..f21dd7ed1 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,27 +1,7 @@ <% -# - -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 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; -use FS::cust_svc; - -$cgi = new CGI; -cgisuidsetup($cgi); - -$conf = new FS::Conf; -$maxrecords = $conf->config('maxsearchrecordsperpage'); + +my $conf = new FS::Conf; +my $maxrecords = $conf->config('maxsearchrecordsperpage'); #my $cache; @@ -59,16 +39,15 @@ $maxrecords = $conf->config('maxsearchrecordsperpage'); #) using (custnum) #END -$orderby = ''; #removeme - -$limit = ''; +my $limit = ''; $limit .= "LIMIT $maxrecords" if $maxrecords; -$offset = $cgi->param('offset') || 0; +my $offset = $cgi->param('offset') || 0; $limit .= " OFFSET $offset" if $offset; my $total; +my(@cust_main, $sortby, $orderby); if ( $cgi->param('browse') ) { my $query = $cgi->param('browse'); if ( $query eq 'custnum' ) { @@ -135,10 +114,21 @@ if ( $cgi->param('browse') ) { } else { @cust_main=(); - &cardsearch if $cgi->param('card_on') && $cgi->param('card'); - &lastsearch if $cgi->param('last_on') && $cgi->param('last_text'); - &companysearch if $cgi->param('company_on') && $cgi->param('company_text'); - &referralsearch if $cgi->param('referral_custnum'); + $sortby = \*last_sort; + + push @cust_main, @{&cardsearch} + if $cgi->param('card_on') && $cgi->param('card'); + push @cust_main, @{&lastsearch} + if $cgi->param('last_on') && $cgi->param('last_text'); + push @cust_main, @{&companysearch} + if $cgi->param('company_on') && $cgi->param('company_text'); + push @cust_main, @{&referralsearch} + if $cgi->param('referral_custnum'); + + if ( $cgi->param('company_on') && $cgi->param('company_text') ) { + $sortby = \*company_sort; + push @cust_main, @{&companysearch}; + } @cust_main = grep { $_->ncancelled_pkgs || ! $_->all_pkgs } @cust_main if $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me @@ -146,6 +136,7 @@ if ( $cgi->param('browse') ) { && ! $cgi->param('showcancelledcustomers') ); } +my %all_pkgs; if ( $conf->exists('hidecancelledpackages' ) ) { %all_pkgs = map { $_->custnum => [ $_->ncancelled_pkgs ] } @cust_main; } else { @@ -368,8 +359,7 @@ sub cardsearch { $card =~ /^(\d{13,16})$/ or eidiot "Illegal card number\n"; my($payinfo)=$1; - push @cust_main, qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}); - $sortby=\*last_sort; + [ qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}) ]; } sub referralsearch { @@ -385,12 +375,12 @@ sub referralsearch { } else { $depth = 1; } - push @cust_main, $cust_main->referral_cust_main($depth); - $sortby=\*last_sort; + [ $cust_main->referral_cust_main($depth) ]; } sub lastsearch { my(%last_type); + my @cust_main; foreach ( $cgi->param('last_type') ) { $last_type{$_}++; } @@ -432,12 +422,13 @@ sub lastsearch { } } - $sortby=\*last_sort; + \@cust_main; } sub companysearch { my(%company_type); + my @cust_main; foreach ( $cgi->param('company_type') ) { $company_type{$_}++ }; @@ -479,7 +470,7 @@ sub companysearch { } } - $sortby=\*company_sort; + \@cust_main; } %> diff --git a/httemplate/search/cust_pay.cgi b/httemplate/search/cust_pay.cgi index 68a17e7dc..715e63e24 100755 --- a/httemplate/search/cust_pay.cgi +++ b/httemplate/search/cust_pay.cgi @@ -1,27 +1,13 @@ + <% -# - -use strict; -use vars qw( $cgi $sortby @cust_pay ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use Date::Format; -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl header menubar idiot table ); -use FS::Record qw(qsearch ); -use FS::cust_pay; -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); $cgi->param('payinfo') =~ /^\s*(\d+)\s*$/ or die "illegal payinfo"; my $payinfo = $1; $cgi->param('payby') =~ /^(\w+)$/ or die "illegal payby"; my $payby = $1; -@cust_pay = qsearch('cust_pay', { 'payinfo' => $payinfo, - 'payby' => $payby } ); -$sortby = \*date_sort; +my @cust_pay = qsearch('cust_pay', { 'payinfo' => $payinfo, + 'payby' => $payby } ); +my $sortby = \*date_sort; if (0) { #if ( scalar(@cust_pay) == 1 ) { diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index dabcf46fb..9705bd658 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,38 +1,22 @@ + <% -# -use strict; -use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg - $conf $maxrecords $limit $offset ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(dbh cgisuidsetup); -use FS::Conf; -use FS::Record qw(qsearch qsearchs dbdef); -use FS::CGI qw(header eidiot popurl table); -use FS::cust_pkg; -use FS::pkg_svc; -use FS::cust_svc; -use FS::cust_main; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$maxrecords = $conf->config('maxsearchrecordsperpage'); +my $conf = new FS::Conf; +my $maxrecords = $conf->config('maxsearchrecordsperpage'); my %part_pkg = map { $_->pkgpart => $_ } qsearch('part_pkg', {}); -$limit = ''; +my $limit = ''; $limit .= "LIMIT $maxrecords" if $maxrecords; -$offset = $cgi->param('offset') || 0; +my $offset = $cgi->param('offset') || 0; $limit .= " OFFSET $offset" if $offset; my $total; my $unconf = ''; -($query) = $cgi->keywords; +my($query) = $cgi->keywords; +my $sortby; if ( $query eq 'pkgnum' ) { $sortby=\*pkgnum_sort; @@ -86,7 +70,7 @@ $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; $total = $sth->fetchrow_arrayref->[0]; -@cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); +my @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); if ( scalar(@cust_pkg) == 1 ) { diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index c9d1eb6ca..8d5329618 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -1,36 +1,22 @@ + <% -# -use strict; -use vars qw( $cgi @svc_acct $sortby $query $mydomain - $conf $maxrecords $limit $offset ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs dbdef); -use FS::CGI qw(header idiot popurl table); -use FS::svc_acct; -use FS::cust_main; +my $mydomain = ''; -$mydomain = ''; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$maxrecords = $conf->config('maxsearchrecordsperpage'); +my $conf = new FS::Conf; +my $maxrecords = $conf->config('maxsearchrecordsperpage'); my $orderby = ''; #removeme -$limit = ''; +my $limit = ''; $limit .= "LIMIT $maxrecords" if $maxrecords; -$offset = $cgi->param('offset') || 0; +my $offset = $cgi->param('offset') || 0; $limit .= " OFFSET $offset" if $offset; my $total; -($query)=$cgi->keywords; +my($query)=$cgi->keywords; $query ||= ''; #to avoid use of unitialized value errors my $unlinked = ''; @@ -45,6 +31,7 @@ if ( $query =~ /^UN_(.*)$/ ) { '; } +my(@svc_acct, $sortby); if ( $query eq 'svcnum' ) { $sortby=\*svcnum_sort; $orderby = 'ORDER BY svcnum'; @@ -56,7 +43,7 @@ if ( $query eq 'svcnum' ) { $orderby = ( $unlinked ? 'AND' : 'WHERE' ). ' uid IS NOT NULL ORDER BY uid'; } else { $sortby=\*uid_sort; - &usernamesearch; + @svc_acct = @{&usernamesearch}; } if ( $query eq 'svcnum' || $query eq 'username' || $query eq 'uid' ) { @@ -245,9 +232,8 @@ sub usernamesearch { $cgi->param('username') =~ /^([\w\d\-]+)$/; #untaint username_text my($username)=$1; - @svc_acct=qsearch('svc_acct',{'username'=>$username}); + [ qsearch('svc_acct',{'username'=>$username}) ]; } - %> diff --git a/httemplate/search/svc_acct_sm.cgi b/httemplate/search/svc_acct_sm.cgi index 5250b5ca1..1f1f770be 100755 --- a/httemplate/search/svc_acct_sm.cgi +++ b/httemplate/search/svc_acct_sm.cgi @@ -1,32 +1,18 @@ + <% -# -use strict; -use vars qw( $conf $cgi $mydomain $domuser $svc_domain $domsvc @svc_acct_sm ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::CGI qw(popurl idiot header table); -use FS::Record qw(qsearch qsearchs); -use FS::Conf; -use FS::svc_domain; -use FS::svc_acct_sm; -use FS::svc_acct; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$mydomain = $conf->config('domain'); +my $conf = new FS::Conf; +my $mydomain = $conf->config('domain'); $cgi->param('domuser') =~ /^([a-z0-9_\-]{0,32})$/; -$domuser = $1; +my $domuser = $1; $cgi->param('domain') =~ /^([\w\-\.]+)$/ or die "Illegal domain"; -$svc_domain = qsearchs('svc_domain',{'domain'=>$1}) +my $svc_domain = qsearchs('svc_domain',{'domain'=>$1}) or die "Unknown domain"; -$domsvc = $svc_domain->svcnum; +my $domsvc = $svc_domain->svcnum; +my @svc_acct_sm; if ($domuser) { @svc_acct_sm=qsearch('svc_acct_sm',{ 'domuser' => $domuser, diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi index b09c65a0b..4ec5eb053 100755 --- a/httemplate/search/svc_domain.cgi +++ b/httemplate/search/svc_domain.cgi @@ -1,26 +1,12 @@ + <% -# - -use strict; -use vars qw ( $cgi @svc_domain $sortby $query $conf $mydomain ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header eidiot popurl); -use FS::svc_domain; -use FS::cust_svc; -use FS::svc_acct; -use FS::svc_forward; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; -$mydomain = $conf->config('domain'); - -($query)=$cgi->keywords; + +my $conf = new FS::Conf; +my $mydomain = $conf->config('domain'); + +my($query)=$cgi->keywords; $query ||= ''; #to avoid use of unitialized value errors +my(@svc_domain,$sortby); if ( $query eq 'svcnum' ) { $sortby=\*svcnum_sort; @svc_domain=qsearch('svc_domain',{}); @@ -69,9 +55,7 @@ END # my(%saw); # if we've multiple domains with the same # svcnum, then we've a corrupt database - my($svc_domain); - my $p = popurl(2); - foreach $svc_domain ( + foreach my $svc_domain ( # sort $sortby grep(!$saw{$_->svcnum}++, @svc_domain) sort $sortby (@svc_domain) ) { -- cgit v1.2.1