s/CGI::(Base|Request)/CGI.pm/;
authorivan <ivan>
Thu, 17 Dec 1998 09:41:12 +0000 (09:41 +0000)
committerivan <ivan>
Thu, 17 Dec 1998 09:41:12 +0000 (09:41 +0000)
htdocs/search/cust_bill.cgi
htdocs/search/cust_main.cgi
htdocs/search/cust_pkg.cgi
htdocs/search/svc_acct.cgi
htdocs/search/svc_acct_sm.cgi
htdocs/search/svc_domain.cgi

index 5be84b7..29ff781 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# cust_bill.cgi: Search for invoices (process form)
+# $Id: cust_bill.cgi,v 1.2 1998-12-17 09:41:07 ivan Exp $
 #
 # Usage: post form to:
 #        http://server.name/path/cust_bill.cgi
 #
 # Changes to allow page to work at a relative position in server
 #       bmccane@maxbaud.net     98-apr-3
+#
+# $Log: cust_bill.cgi,v $
+# Revision 1.2  1998-12-17 09:41:07  ivan
+# s/CGI::(Base|Request)/CGI.pm/;
+#
 
 use strict;
-use CGI::Request;
+use CGI;
+use CGI::Carp qw(fatalsToBrowser);
 use FS::UID qw(cgisuidsetup);
+use FS::CGI qw(popurl idiot);
 use FS::Record qw(qsearchs);
 
-my($req)=new CGI::Request;
-cgisuidsetup($req->cgi);
+my($cgi)=new CGI;
+cgisuidsetup($cgi);
 
-$req->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/;
+$cgi->param('invnum') =~ /^\s*(FS-)?(\d+)\s*$/;
 my($invnum)=$2;
 
 if ( qsearchs('cust_bill',{'invnum'=>$invnum}) ) {
-  $req->cgi->redirect("../view/cust_bill.cgi?$invnum");  #redirect
+  print $cgi->redirect(popurl(2). "view/cust_bill.cgi?$invnum");  #redirect
 } else { #error
-  CGI::Base::SendHeaders(); # one guess
-  print <<END;
-<HTML>
-  <HEAD>
-    <TITLE>Invoice Search Error</TITLE>
-  </HEAD>
-  <BODY>
-    <CENTER>
-    <H3>Invoice Search Error</H3>
-    <HR>
-    Invoice not found.
-    </CENTER>
-  </BODY>
-</HTML>
-END
-
+  idiot("Invoice not found.");
 }
 
index c228c9a..6241f33 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# process/cust_main.cgi: Search for customers (process form)
+# $Id: cust_main.cgi,v 1.3 1998-12-17 09:41:08 ivan Exp $
 #
 # Usage: post form to:
 #        http://server.name/path/cust_main.cgi
 # display total, use FS::CGI ivan@sisd.com 98-jul-17
 #
 # $Log: cust_main.cgi,v $
-# Revision 1.2  1998-11-12 08:10:22  ivan
+# Revision 1.3  1998-12-17 09:41:08  ivan
+# s/CGI::(Base|Request)/CGI.pm/;
+#
+# Revision 1.2  1998/11/12 08:10:22  ivan
 # CGI.pm instead of CGI-modules
 # relative URLs using popurl
 # got rid of lots of little tables
@@ -68,7 +71,7 @@ my(%all_pkgs) =
   map { $_->custnum => [ $_->all_pkgs ] } @cust_main;
 
 if ( scalar(@cust_main) == 1 ) {
-  print $cgi->redirect(popurl(2). "/view/cust_main.cgi?". $cust_main[0]->custnum);
+  print $cgi->redirect(popurl(2). "view/cust_main.cgi?". $cust_main[0]->custnum);
   exit;
 } elsif ( scalar(@cust_main) == 0 ) {
   idiot "No matching customers found!\n";
index 967068f..12d601a 100755 (executable)
@@ -1,22 +1,27 @@
 #!/usr/bin/perl -Tw
 #
-# cust_pkg.cgi: search/browse for packages
+# $Id: cust_pkg.cgi,v 1.2 1998-12-17 09:41:09 ivan Exp $
 #
 # based on search/svc_acct.cgi ivan@sisd.com 98-jul-17
+#
+# $Log: cust_pkg.cgi,v $
+# Revision 1.2  1998-12-17 09:41:09  ivan
+# s/CGI::(Base|Request)/CGI.pm/;
+#
 
 use strict;
-use CGI::Request;
+use CGI;
 use CGI::Carp qw(fatalsToBrowser);
 use FS::UID qw(cgisuidsetup);
 use FS::Record qw(qsearch qsearchs);
-use FS::CGI qw(header idiot);
+use FS::CGI qw(header idiot popurl);
 
-my($req)=new CGI::Request;
-&cgisuidsetup($req->cgi);
+my($cgi)=new CGI;
+&cgisuidsetup($cgi);
 
 my(@cust_pkg,$sortby);
 
-my($query)=$req->cgi->var('QUERY_STRING');
+my($query)=$cgi->query_string;
 #this tree is a little bit redundant
 if ( $query eq 'pkgnum' ) {
   $sortby=\*pkgnum_sort;
@@ -50,7 +55,7 @@ if ( $query eq 'pkgnum' ) {
 
 if ( scalar(@cust_pkg) == 1 ) {
   my($pkgnum)=$cust_pkg[0]->pkgnum;
-  $req->cgi->redirect("../view/cust_pkg.cgi?$pkgnum");
+  print $cgi->redirect(popurl(2). "view/cust_pkg.cgi?$pkgnum");
   exit;
 } elsif ( scalar(@cust_pkg) == 0 ) { #error
   &idiot("No packages found");
index 250a741..2b6c1ee 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# svc_acct.cgi: Search for customers (process form)
+# $Id: svc_acct.cgi,v 1.2 1998-12-17 09:41:10 ivan Exp $
 #
 # Usage: post form to:
 #        http://server.name/path/svc_acct.cgi
 # use FS::CGI, show total ivan@sisd.com 98-jul-17
 #
 # give service and customer info too ivan@sisd.com 98-aug-16
+#
+# $Log: svc_acct.cgi,v $
+# Revision 1.2  1998-12-17 09:41:10  ivan
+# s/CGI::(Base|Request)/CGI.pm/;
+#
 
 use strict;
-use CGI::Request; # form processing module
+use CGI;
 use CGI::Carp qw(fatalsToBrowser);
 use FS::UID qw(cgisuidsetup);
 use FS::Record qw(qsearch qsearchs);
-use FS::CGI qw(header idiot);
+use FS::CGI qw(header idiot popurl);
 
-my($req)=new CGI::Request; # create form object
-&cgisuidsetup($req->cgi);
+my($cgi)=new CGI;
+&cgisuidsetup($cgi);
 
 my(@svc_acct,$sortby);
 
-my($query)=$req->cgi->var('QUERY_STRING');
+my($query)=$cgi->query_string;
 #this tree is a little bit redundant
 if ( $query eq 'svcnum' ) {
   $sortby=\*svcnum_sort;
@@ -69,15 +74,14 @@ if ( $query eq 'svcnum' ) {
 
 if ( scalar(@svc_acct) == 1 ) {
   my($svcnum)=$svc_acct[0]->svcnum;
-  $req->cgi->redirect("../view/svc_acct.cgi?$svcnum");  #redirect
+  print $cgi->redirect(popurl(2). "view/svc_acct.cgi?$svcnum");  #redirect
   exit;
 } elsif ( scalar(@svc_acct) == 0 ) { #error
   idiot("Account not found");
   exit;
 } else {
   my($total)=scalar(@svc_acct);
-  CGI::Base::SendHeaders(); # one guess
-  print header("Account Search Results",''), <<END;
+  print $cgi->header("Account Search Results",''), <<END;
     $total matching accounts found
     <TABLE BORDER=4 CELLSPACING=0 CELLPADDING=0>
       <TR>
@@ -91,9 +95,8 @@ if ( scalar(@svc_acct) == 1 ) {
       </TR>
 END
 
-  my($lines)=16;
-  my($lcount)=$lines;
   my(%saw,$svc_acct);
+  my $p = popurl(2);
   foreach $svc_acct (
     sort $sortby grep(!$saw{$_->svcnum}++, @svc_acct)
   ) {
@@ -119,13 +122,13 @@ END
       $cust_svc->pkgnum ? $cust_main->company : '',
     );
     my($pcustnum) = $custnum
-      ? "<A HREF=\"../view/cust_main.cgi?$custnum\"><FONT SIZE=-1>$custnum</FONT></A>"
+      ? "<A HREF=\"${p}view/cust_main.cgi?$custnum\"><FONT SIZE=-1>$custnum</FONT></A>"
       : "<I>(unlinked)</I>"
     ;
     my($pname) = $custnum ? "$last, $first" : '';
     print <<END;
     <TR>
-      <TD><A HREF="../view/svc_acct.cgi?$svcnum"><FONT SIZE=-1>$svcnum</FONT></A></TD>
+      <TD><A HREF="${p}view/svc_acct.cgi?$svcnum"><FONT SIZE=-1>$svcnum</FONT></A></TD>
       <TD><FONT SIZE=-1>$username</FONT></TD>
       <TD><FONT SIZE=-1>$uid</FONT></TD>
       <TD><FONT SIZE=-1>$svc</FONT></TH>
@@ -134,22 +137,7 @@ END
       <TD><FONT SIZE=-1>$company</FONT></TH>
     </TR>
 END
-    if ($lcount-- == 0) { # lots of little tables instead of one big one
-      $lcount=$lines;
-      print <<END;   
-  </TABLE>
-  <TABLE BORDER=4 CELLSPACING=0 CELLPADDING=0>
-    <TR>
-      <TH>Service #</TH>
-      <TH>Userame</TH>
-      <TH>UID</TH>
-        <TH>Service</TH>
-        <TH>Customer #</TH>
-        <TH>Contact name</TH>
-        <TH>Company</TH>
-    </TR>
-END
-    }
+
   }
  
   print <<END;
@@ -176,7 +164,7 @@ sub uid_sort {
 
 sub usernamesearch {
 
-  $req->param('username') =~ /^([\w\d\-]{2,8})$/; #untaint username_text
+  $cgi->param('username') =~ /^([\w\d\-]{2,8})$/; #untaint username_text
   my($username)=$1;
 
   @svc_acct=qsearch('svc_acct',{'username'=>$username});
index 38656ea..824a551 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# svc_acct_sm.cgi: Search for domains (process form)
+# $Id: svc_acct_sm.cgi,v 1.3 1998-12-17 09:41:11 ivan Exp $
 #
 # Usage: post form to:
 #        http://server.name/path/svc_domain.cgi
 #
 # Changes to allow page to work at a relative position in server
 #       bmccane@maxbaud.net     98-apr-3
+#
+# $Log: svc_acct_sm.cgi,v $
+# Revision 1.3  1998-12-17 09:41:11  ivan
+# s/CGI::(Base|Request)/CGI.pm/;
+#
 
 use strict;
 use vars qw($conf);
 use CGI::Request;
 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;
 
+my($cgi)=new CGI;
+&cgisuidsetup($cgi);
+
 $conf = new FS::Conf;
 my $mydomain = $conf->config('domain');
 
-my($req)=new CGI::Request; # create form object
-&cgisuidsetup($req->cgi);
-
-$req->param('domuser') =~ /^([a-z0-9_\-]{0,32})$/;
+$cgi->param('domuser') =~ /^([a-z0-9_\-]{0,32})$/;
 my($domuser)=$1;
 
-$req->param('domain') =~ /^([\w\-\.]+)$/ or die "Illegal domain";
+$cgi->param('domain') =~ /^([\w\-\.]+)$/ or die "Illegal domain";
 my($svc_domain)=qsearchs('svc_domain',{'domain'=>$1})
   or die "Unknown domain";
 my($domsvc)=$svc_domain->svcnum;
@@ -52,18 +58,10 @@ if ($domuser) {
 
 if ( scalar(@svc_acct_sm) == 1 ) {
   my($svcnum)=$svc_acct_sm[0]->svcnum;
-  $req->cgi->redirect("../view/svc_acct_sm.cgi?$svcnum");  #redirect
+  print $cgi->redirect(popurl(2). "view/svc_acct_sm.cgi?$svcnum");  #redirect
 } elsif ( scalar(@svc_acct_sm) > 1 ) {
   CGI::Base::SendHeaders();
-  print <<END;
-<HTML>
-  <HEAD>
-    <TITLE>Mail Alias Search Results</TITLE>
-  </HEAD>
-  <BODY>
-    <CENTER>
-    <H4>Mail Alias Search Results</H4>
-    <TABLE BORDER=4 CELLSPACING=0 CELLPADDING=0>
+  print $cgi->header, header('Mail Alias Search Results'), table, <<END;
       <TR>
         <TH>Mail to<BR><FONT SIZE=-2>(click here to view mail alias)</FONT></TH>
         <TH>Forwards to<BR><FONT SIZE=-2>(click here to view account)</FONT></TH>
@@ -84,9 +82,7 @@ END
     my($username)=$svc_acct->username;
     my($svc_acct_svcnum)=$svc_acct->svcnum;
 
-    print <<END;
-<TR>\n        <TD> <A HREF="../view/svc_acct_sm.cgi?$svcnum">
-END
+    print qq!<TR>\n        <TD> <A HREF="!. popurl(2). qq!view/svc_acct_sm.cgi?$svcnum">!;
 
     print '', ( ($domuser eq '*') ? "<I>(anything)</I>" : $domuser );
 
@@ -105,21 +101,6 @@ END
 END
 
 } else { #error
-  CGI::Base::SendHeaders(); # one guess
-  print <<END;
-<HTML>
-  <HEAD>
-    <TITLE>Mail Alias Search Error</TITLE>
-  </HEAD>
-  <BODY>
-    <CENTER>
-    <H3>Mail Alias Search Error</H3>
-    <HR>
-    Mail Alias not found.
-    </CENTER>
-  </BODY>
-</HTML>
-END
-
+  idiot("Mail Alias not found");
 }
 
index d527703..1fd6a51 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# svc_domain.cgi: Search for domains (process form)
+# $Id: svc_domain.cgi,v 1.2 1998-12-17 09:41:12 ivan Exp $
 #
 # Usage: post form to:
 #        http://server.name/path/svc_domain.cgi
 #       bmccane@maxbaud.net     98-apr-3
 #
 # display total, use FS::CGI now does browsing too ivan@sisd.com 98-jul-17
+#
+# $Log: svc_domain.cgi,v $
+# Revision 1.2  1998-12-17 09:41:12  ivan
+# s/CGI::(Base|Request)/CGI.pm/;
+#
 
 use strict;
-use CGI::Request;
+use CGI;
 use CGI::Carp qw(fatalsToBrowser);
 use FS::UID qw(cgisuidsetup);
 use FS::Record qw(qsearch qsearchs);
-use FS::CGI qw(header idiot);
+use FS::CGI qw(header idiot popurl);
 
-my($req)=new CGI::Request;
-&cgisuidsetup($req->cgi);
+my($cgi)=new CGI;
+&cgisuidsetup($cgi);
 
 my(@svc_domain);
 my($sortby);
 
-my($query)=$req->cgi->var('QUERY_STRING');
+my($query)=$cgi->query_string;
 if ( $query eq 'svcnum' ) {
   $sortby=\*svcnum_sort;
   @svc_domain=qsearch('svc_domain',{});
@@ -49,13 +54,13 @@ if ( $query eq 'svcnum' ) {
       'pkgnum' => '',
     }), qsearch('svc_domain',{});
 } else {
-  $req->param('domain') =~ /^([\w\-\.]+)$/; 
+  $cgi->param('domain') =~ /^([\w\-\.]+)$/; 
   my($domain)=$1;
   push @svc_domain, qsearchs('svc_domain',{'domain'=>$domain});
 }
 
 if ( scalar(@svc_domain) == 1 ) {
-  $req->cgi->redirect("../view/svc_domain.cgi?". $svc_domain[0]->svcnum);
+  print $cgi->redirect(popurl(2). "view/svc_domain.cgi?". $svc_domain[0]->svcnum);
   exit;
 } elsif ( scalar(@svc_domain) == 0 ) {
   idiot "No matching domains found!\n";
@@ -76,9 +81,8 @@ if ( scalar(@svc_domain) == 1 ) {
       </TR>
 END
 
-  my($lines)=16;
-  my($lcount)=$lines;
   my(%saw,$svc_domain);
+  my $p = popurl(2);
   foreach $svc_domain (
     sort $sortby grep(!$saw{$_->svcnum}++, @svc_domain)
   ) {
@@ -100,23 +104,11 @@ END
     }
     print <<END;
     <TR>
-      <TD><A HREF="../view/svc_domain.cgi?$svcnum"><FONT SIZE=-1>$svcnum</FONT></A></TD>
+      <TD><A HREF="${p}view/svc_domain.cgi?$svcnum"><FONT SIZE=-1>$svcnum</FONT></A></TD>
       <TD><FONT SIZE=-1>$domain</FONT></TD>
       <TD><FONT SIZE=-1>$malias</FONT></TD>
     </TR>
 END
-    if ($lcount-- == 0) { # lots of little tables instead of one big one
-      $lcount=$lines;
-      print <<END;   
-  </TABLE>
-  <TABLE BORDER=4 CELLSPACING=0 CELLPADDING=0>
-    <TR>
-      <TH>Service #</TH>
-      <TH>Domain</TH>
-      <TH></TH>
-    </TR>
-END
-    }
   }
  
   print <<END;