X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=htdocs%2Fsearch%2Fcust_pkg.cgi;h=b6439d654654e30ad48ec680b16f98e426812c0f;hb=e890290677daab75e0ce28d5679baddb8a997a8e;hp=6685aea70e634e2456febaaffc04e57b2292a658;hpb=c116ce940c33dcd7e37a87a8eb2936e17cc68b11;p=freeside.git diff --git a/htdocs/search/cust_pkg.cgi b/htdocs/search/cust_pkg.cgi index 6685aea70..b6439d654 100755 --- a/htdocs/search/cust_pkg.cgi +++ b/htdocs/search/cust_pkg.cgi @@ -1,11 +1,27 @@ #!/usr/bin/perl -Tw # -# $Id: cust_pkg.cgi,v 1.6 1999-01-19 05:14:13 ivan Exp $ +# $Id: cust_pkg.cgi,v 1.11 2000-07-17 16:45:41 ivan Exp $ # # based on search/svc_acct.cgi ivan@sisd.com 98-jul-17 # # $Log: cust_pkg.cgi,v $ -# Revision 1.6 1999-01-19 05:14:13 ivan +# Revision 1.11 2000-07-17 16:45:41 ivan +# first shot at invoice browsing and some other cleanups +# +# Revision 1.10 2000/07/17 12:49:29 ivan +# better error message if a package isn't linked to a customer (that shouldn't happen) +# +# Revision 1.9 1999/07/17 10:38:52 ivan +# scott nelson noticed this mod_perl-triggered bug and +# gave me a great bugreport at the last rhythmethod +# +# Revision 1.8 1999/02/09 09:22:57 ivan +# visual and bugfixes +# +# Revision 1.7 1999/02/07 09:59:37 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.6 1999/01/19 05:14:13 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -29,7 +45,11 @@ use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header idiot popurl); +use FS::CGI qw(header eidiot popurl); +use FS::cust_pkg; +use FS::pkg_svc; +use FS::cust_svc; +use FS::cust_main; $cgi = new CGI; &cgisuidsetup($cgi); @@ -41,7 +61,7 @@ if ( $query eq 'pkgnum' ) { @cust_pkg=qsearch('cust_pkg',{}); } elsif ( $query eq 'APKG_pkgnum' ) { $sortby=\*pkgnum_sort; - + @cust_pkg=(); #perhaps this should go in cust_pkg as a qsearch-like constructor? my($cust_pkg); foreach $cust_pkg (qsearch('cust_pkg',{})) { @@ -71,8 +91,7 @@ if ( scalar(@cust_pkg) == 1 ) { print $cgi->redirect(popurl(2). "view/cust_pkg.cgi?$pkgnum"); exit; } elsif ( scalar(@cust_pkg) == 0 ) { #error - &idiot("No packages found"); - exit; + eidiot("No packages found"); } else { my($total)=scalar(@cust_pkg); print $cgi->header( '-expires' => 'now' ), header('Package Search Results',''), < Package # Customer # - Name + Contact name Company END @@ -93,24 +112,32 @@ END my($cust_main)=qsearchs('cust_main',{'custnum'=>$cust_pkg->custnum}); my($pkgnum,$custnum,$name,$company)=( $cust_pkg->pkgnum, - $cust_main->custnum, - $cust_main->last. ', '. $cust_main->first, - $cust_main->company, + $cust_pkg->custnum, + $cust_main ? $cust_main->last. ', '. $cust_main->first : '', + $cust_main ? $cust_main->company : '', ); + my $p = popurl(2); print < - $pkgnum - $custnum - $name - $company + $pkgnum +END + if ( $cust_main ) { + print <$custnum + $name + $company END - + } else { + print <WARNING: couldn't find cust_main.custnum $custnum (cust_pkg.pkgnum $pkgnum) + +END + } } print < - END