for mod_perl: no more top-level my() variables; use vars instead
[freeside.git] / htdocs / view / cust_main.cgi
index 8e61455..7c5f4be 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: cust_main.cgi,v 1.7 1998-12-30 23:03:34 ivan Exp $
+# $Id: cust_main.cgi,v 1.10 1999-01-19 05:14:19 ivan Exp $
 #
 # Usage: cust_main.cgi custnum
 #        http://server.name/path/cust_main.cgi?custnum
 # lose background, FS::CGI ivan@sisd.com 98-sep-2
 #
 # $Log: cust_main.cgi,v $
-# Revision 1.7  1998-12-30 23:03:34  ivan
+# Revision 1.10  1999-01-19 05:14:19  ivan
+# for mod_perl: no more top-level my() variables; use vars instead
+# also the last s/create/new/;
+#
+# Revision 1.9  1999/01/18 09:41:43  ivan
+# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
+# (good idea anyway)
+#
+# Revision 1.8  1999/01/18 09:22:35  ivan
+# changes to track email addresses for email invoicing
+#
+# Revision 1.7  1998/12/30 23:03:34  ivan
 # bugfixes; fields isn't exported by derived classes
 #
 # Revision 1.6  1998/12/23 02:42:33  ivan
@@ -53,6 +64,9 @@
 #
 
 use strict;
+use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral 
+              @packages $package @history @bills $bill @credits $credit
+              $balance $item ); 
 use CGI;
 use CGI::Carp qw(fatalsToBrowser);
 use Date::Format;
@@ -69,22 +83,22 @@ use FS::agent;
 use FS::cust_main;
 use FS::cust_refund;
 
-my($cgi) = new CGI;
+$cgi = new CGI;
 &cgisuidsetup($cgi);
 
-print $cgi->header, header("Customer View", menubar(
+print $cgi->header( '-expires' => 'now' ), header("Customer View", menubar(
   'Main Menu' => popurl(2)
 )),<<END;
     <BASEFONT SIZE=3>
 END
 
 die "No customer specified (bad URL)!" unless $cgi->keywords;
-my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
+($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
 $query =~ /^(\d+)$/;
-my($custnum)=$1;
-my($cust_main)=qsearchs('cust_main',{'custnum'=>$custnum});
+$custnum = $1;
+$cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
 die "Customer not found!" unless $cust_main;
-my($hashref)=$cust_main->hashref;
+$hashref = $cust_main->hashref;
 
 #custnum
 print "<FONT SIZE=+1><CENTER>Customer #<B>$custnum</B></CENTER></FONT>",
@@ -100,11 +114,11 @@ print qq!<HR><CENTER><A HREF="!, popurl(2), qq!/misc/bill.cgi?$custnum">!,
 #formatting
 print qq!<HR><A NAME="cust_main"><CENTER><FONT SIZE=+1>Customer Information!,
       qq!</FONT>!,
-      qq!<BR><A HREF="!, popurl(2), qq!/edit/cust_main.cgi?$custnum!,
+      qq!<BR><A HREF="!, popurl(2), qq!edit/cust_main.cgi?$custnum!,
       qq!">Edit this information</A></CENTER><FONT SIZE=-1>!;
 
 #agentnum
-my($agent)=qsearchs('agent',{
+$agent = qsearchs('agent',{
   'agentnum' => $cust_main->getfield('agentnum')
 } );
 die "Agent not found!" unless $agent;
@@ -112,7 +126,7 @@ print "<BR>Agent #<B>" , $agent->getfield('agentnum') , ": " ,
                          $agent->getfield('agent') , "</B>";
 
 #refnum
-my($referral)=qsearchs('part_referral',{'refnum' => $cust_main->refnum});
+$referral = qsearchs('part_referral',{'refnum' => $cust_main->refnum});
 die "Referral not found!" unless $referral;
 print "<BR>Referral #<B>", $referral->refnum, ": ",
       $referral->referral, "<\B>"; 
@@ -208,8 +222,7 @@ print qq!<CENTER>!, table, "\n",
       qq!</TR>\n!;
 
 #get package info
-my(@packages)=qsearch('cust_pkg',{'custnum'=>$custnum});
-my($package);
+@packages = qsearch('cust_pkg',{'custnum'=>$custnum});
 foreach $package (@packages) {
   my($pref)=$package->hashref;
   my($part_pkg)=qsearchs('part_pkg',{
@@ -258,10 +271,7 @@ print qq!<CENTER><HR><A NAME="history"><FONT SIZE=+1>Payment History!,
 # major problem: this whole thing is way too sloppy.
 # minor problem: the description lines need better formatting.
 
-my(@history);
-
-my(@bills)=qsearch('cust_bill',{'custnum'=>$custnum});
-my($bill);
+@bills = qsearch('cust_bill',{'custnum'=>$custnum});
 foreach $bill (@bills) {
   my($bref)=$bill->hashref;
   push @history,
@@ -285,8 +295,7 @@ foreach $bill (@bills) {
   }
 }
 
-my(@credits)=qsearch('cust_credit',{'custnum'=>$custnum});
-my($credit);
+@credits = qsearch('cust_credit',{'custnum'=>$custnum});
 foreach $credit (@credits) {
   my($cref)=$credit->hashref;
   push @history,
@@ -321,8 +330,7 @@ END
 
 #display payment history
 
-my($balance)=0;
-my($item);
+$balance = 0;
 foreach $item (sort keyfield_numerically @history) {
   my($date,$desc,$charge,$payment,$credit,$refund)=split(/\t/,$item);
   $charge ||= 0;