diff options
author | ivan <ivan> | 1999-01-18 09:22:42 +0000 |
---|---|---|
committer | ivan <ivan> | 1999-01-18 09:22:42 +0000 |
commit | c93520accf00e15095e7af5fcb59caed2bd9e556 (patch) | |
tree | 0fb501a33e9b55ba467a0a516ad1d90363342a83 | |
parent | e74e6d0896eae348d54dbd6e436f37a2a0e69389 (diff) |
changes to track email addresses for email invoicing
-rwxr-xr-x | htdocs/browse/agent.cgi | 20 | ||||
-rw-r--r-- | htdocs/docs/trouble.html | 4 | ||||
-rw-r--r-- | htdocs/docs/upgrade3.html | 11 | ||||
-rwxr-xr-x | htdocs/edit/agent_type.cgi | 11 | ||||
-rwxr-xr-x | htdocs/edit/cust_main.cgi | 235 | ||||
-rwxr-xr-x | htdocs/edit/process/cust_main.cgi | 70 | ||||
-rwxr-xr-x | htdocs/search/cust_pkg.cgi | 27 | ||||
-rwxr-xr-x | htdocs/search/svc_acct.cgi | 17 | ||||
-rwxr-xr-x | htdocs/view/cust_main.cgi | 9 | ||||
-rwxr-xr-x | htdocs/view/svc_acct.cgi | 21 | ||||
-rw-r--r-- | site_perl/CGI.pm | 28 | ||||
-rw-r--r-- | site_perl/Record.pm | 13 | ||||
-rw-r--r-- | site_perl/UID.pm | 11 | ||||
-rw-r--r-- | site_perl/cust_main.pm | 48 | ||||
-rw-r--r-- | site_perl/cust_main_invoice.pm | 15 |
15 files changed, 325 insertions, 215 deletions
diff --git a/htdocs/browse/agent.cgi b/htdocs/browse/agent.cgi index 1241ced03..442ea6ee0 100755 --- a/htdocs/browse/agent.cgi +++ b/htdocs/browse/agent.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: agent.cgi,v 1.7 1998-12-17 05:25:16 ivan Exp $ +# $Id: agent.cgi,v 1.8 1999-01-18 09:22:26 ivan Exp $ # # ivan@sisd.com 97-dec-12 # @@ -15,7 +15,10 @@ # lose background, FS::CGI ivan@sisd.com 98-sep-2 # # $Log: agent.cgi,v $ -# Revision 1.7 1998-12-17 05:25:16 ivan +# Revision 1.8 1999-01-18 09:22:26 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.7 1998/12/17 05:25:16 ivan # fix visual and other bugs # # Revision 1.6 1998/11/23 05:29:46 ivan @@ -43,6 +46,19 @@ use FS::CGI qw(header menubar table popurl); use FS::agent; use FS::agent_type; +#Begin silliness + +use FS::UI::CGI; +use FS::UI::agent; + +my $ui = new FS::UI::agent; +$ui->browse; +exit; + +#End silliness + +__END__ + my($cgi) = new CGI; &cgisuidsetup($cgi); diff --git a/htdocs/docs/trouble.html b/htdocs/docs/trouble.html index 2c5b92fd5..dcbe1bbd2 100644 --- a/htdocs/docs/trouble.html +++ b/htdocs/docs/trouble.html @@ -5,7 +5,7 @@ <h1>Troubleshooting</h1> <ul> <li>When troubleshooting the web interface, helpful information is often in your web server's error log. - <li>Internet Explorer will not work with Freeside's HTML interface. + <li>Internet Explorer will not work with Freeside's HTML interface. <b>This may be fixed in >1.2, please report your experiences!</b> <a HREF="http://www.netscape.com">Netscape</a>, <a HREF="http://lynx.browser.org">Lynx</a>, and <a HREF="http://www.cs.indiana.edu/elisp/w3/docs.html">Emacs/W3</a>, @@ -17,7 +17,7 @@ Ambiguous use of value => resolved to "value" => at /usr/lib/perl5/site_perl/File/CounterFile.pm line 132. </pre> This clutters up your log files but is otherwise harmless. Upgrade to the latest File::CounterFile. - <li>If you get an Internal Server Error when adding or editing, but find that the update has occured, and you get something like the following in your web server's error log: + <li><b>(No longer applicable in >1.2!)</b> If you get an Internal Server Error when adding or editing, but find that the update has occured, and you get something like the following in your web server's error log: <pre> access to <i>/your/path</i>/edit/process/<i>some_table</i>.cgi failed for <i>machine.domain.tld</i>, reason: malformed header from script. diff --git a/htdocs/docs/upgrade3.html b/htdocs/docs/upgrade3.html index d2795bdb2..539fe5d82 100644 --- a/htdocs/docs/upgrade3.html +++ b/htdocs/docs/upgrade3.html @@ -14,18 +14,19 @@ <li>Move /var/spool/freeside/export to /usr/local/etc/freeside/export.<i>datasrc</i>. <li>Apply the following changes to your database: <pre> -ALTER TABLE cust_main ADD middle varchar(80) NULL; +<!-- ALTER TABLE cust_main ADD middle varchar(80) NULL; ALTER TABLE cust_main ADD titlenum int NULL; -ALTER TABLE cust_main CHANGE state state varchar(80) NULL; +-->ALTER TABLE cust_main CHANGE state state varchar(80) NULL; ALTER TABLE cust_main_county CHANGE state state varchar(80) NULL; ALTER TABLE cust_main_county ADD country char(2); -UPDATE cust_main_county SET country = "US" where country IS NULL; -CREATE TABLE part_title ( +UPDATE cust_main SET country = "US" where country IS NULL OR country = ''; +UPDATE cust_main_county SET country = "US" where country IS NULL OR country = ""; +<!--CREATE TABLE part_title ( titlenum int NOT NULL, title varchar(80) NOT NULL, PRIMARY KEY (titlenum) ); -CREATE TABLE cust_main_invoice ( +-->CREATE TABLE cust_main_invoice ( destnum int NOT NULL, custnum int NOT NULL, dest varchar(80) NOT NULL, diff --git a/htdocs/edit/agent_type.cgi b/htdocs/edit/agent_type.cgi index d9c0851aa..9bfc37429 100755 --- a/htdocs/edit/agent_type.cgi +++ b/htdocs/edit/agent_type.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: agent_type.cgi,v 1.6 1998-12-17 06:16:58 ivan Exp $ +# $Id: agent_type.cgi,v 1.7 1999-01-18 09:22:29 ivan Exp $ # # agent_type.cgi: Add/Edit agent type (output form) # @@ -13,7 +13,10 @@ # use FS::CGI, added inline documentation ivan@sisd.com 98-jul-12 # # $Log: agent_type.cgi,v $ -# Revision 1.6 1998-12-17 06:16:58 ivan +# Revision 1.7 1999-01-18 09:22:29 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.6 1998/12/17 06:16:58 ivan # fix double // in relative URLs, s/CGI::Base/CGI/; # # Revision 1.5 1998/11/21 07:58:27 ivan @@ -46,7 +49,9 @@ my($cgi) = new CGI; &cgisuidsetup($cgi); my($agent_type,$action); -if ( $cgi->keywords =~ /^(\d+)$/ ) { #editing +if ( $cgi->keywords ) { #editing + my( $query ) = $cgi->keywords; + $query =~ /^(\d+)$/; $agent_type=qsearchs('agent_type',{'typenum'=>$1}); $action='Edit'; } else { #adding diff --git a/htdocs/edit/cust_main.cgi b/htdocs/edit/cust_main.cgi index 19db4a907..d712f7649 100755 --- a/htdocs/edit/cust_main.cgi +++ b/htdocs/edit/cust_main.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: cust_main.cgi,v 1.4 1998-12-23 08:08:15 ivan Exp $ +# $Id: cust_main.cgi,v 1.5 1999-01-18 09:22:30 ivan Exp $ # # Usage: cust_main.cgi custnum # http://server.name/path/cust_main.cgi?custnum @@ -40,7 +40,10 @@ # fixed one missed day->daytime ivan@sisd.com 98-jul-13 # # $Log: cust_main.cgi,v $ -# Revision 1.4 1998-12-23 08:08:15 ivan +# Revision 1.5 1999-01-18 09:22:30 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.4 1998/12/23 08:08:15 ivan # fix typo # # Revision 1.3 1998/12/17 06:17:00 ivan @@ -48,71 +51,63 @@ # use strict; -use CGI; +use CGI::Switch; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup getotaker); use FS::Record qw(qsearch qsearchs); -use FS::CGI qw(header popurl); +use FS::CGI qw(header popurl itable table); use FS::cust_main; -my($cgi) = new CGI; - +my $cgi = new CGI; cgisuidsetup($cgi); #get record -my($custnum,$action,$cust_main); -my($query) = $cgi->keywords; -if ( $query =~ /^(\d+)$/ ) { #editing + +my ( $custnum, $action, $cust_main ); +if ( $cgi->keywords ) { #editing + my( $query ) = $cgi->keywords; + $query =~ /^(\d+)$/; $custnum=$1; - $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); + $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); $action='Edit'; } else { $custnum=''; - $cust_main = create FS::cust_main ( {} ); + $cust_main = new FS::cust_main ( {} ); $cust_main->setfield('otaker',&getotaker); $action='Add'; } +# top + my $p1 = popurl(1); -print $cgi->header, header("Customer $action", ''), <<END; - <FORM ACTION="${p1}process/cust_main.cgi" METHOD=POST> - <PRE> -END +print $cgi->header, header("Customer $action", ''), + qq!<FORM ACTION="${p1}process/cust_main.cgi" METHOD=POST>!, + qq!<INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum">!, + qq!Customer # !, ( $custnum ? $custnum : " (NEW)" ), + +; -print qq!<INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum">!, - qq!Customer #<FONT SIZE="+1"><B>!; -print $custnum ? $custnum : " (NEW)" , "</B></FONT>"; +# agent -#agentnum -my($agentnum)=$cust_main->agentnum || 1; #set to first agent by default my @agents = qsearch( 'agent', {} ); -print qq!\n\nAgent # <SELECT NAME="agentnum" SIZE="1">!; -my($agent); -foreach $agent (sort { - $a->agent cmp $b->agent; -} @agents) { - print "<OPTION" . " SELECTED"x($agent->agentnum==$agentnum), - ">", $agent->agentnum,": ", $agent->agent, "\n"; -} -print "</SELECT>"; - -#referral -#unless ($custnum) { - my($refnum)=$cust_main->refnum || 0; #to avoid "arguement not numeric" error - my(@referrals) = qsearch('part_referral',{}); - print qq!\nReferral <SELECT NAME="refnum" SIZE="1">!; - print "<OPTION> \n"; - my($referral); - foreach $referral (sort { - $a->refnum <=> $b->refnum; - } @referrals) { - print "<OPTION" . " SELECTED"x($referral->refnum==$refnum), - ">", $referral->refnum, ": ", $referral->referral,"\n"; +my $agentnum = $cust_main->agentnum || $agents[0]->agentnum; #default to first +if ( scalar(@agents) == 1 ) { + print qq!<INPUT TYPE="hidden" NAME="agentnum" VALUE="$agentnum">!; +} else { + print qq!<BR><BR>Agent <SELECT NAME="agentnum" SIZE="1">!; + my $agent; + foreach $agent (sort { + $a->agent cmp $b->agent; + } @agents) { + print "<OPTION" . " SELECTED"x($agent->agentnum==$agentnum), + ">", $agent->agentnum,": ", $agent->agent; } print "</SELECT>"; -#} +} -my($last,$first,$ss,$company,$address1,$address2,$city)=( +# contact info + +my($last,$first,$ss,$company,$address1,$address2,$city,$zip)=( $cust_main->last, $cust_main->first, $cust_main->ss, @@ -120,18 +115,18 @@ my($last,$first,$ss,$company,$address1,$address2,$city)=( $cust_main->address1, $cust_main->address2, $cust_main->city, + $cust_main->zip, ); -print <<END; - - -Name (last)<INPUT TYPE="text" NAME="last" VALUE="$last"> (first)<INPUT TYPE="text" NAME="first" VALUE="$first"> SS# <INPUT TYPE="text" NAME="ss" VALUE="$ss" SIZE=11 MAXLENGTH=11> -Company <INPUT TYPE="text" NAME="company" VALUE="$company"> -Address <INPUT TYPE="text" NAME="address1" VALUE="$address1" SIZE=40 MAXLENGTH=40> - <INPUT TYPE="text" NAME="address2" VALUE="$address2" SIZE=40 MAXLENGTH=40> -City <INPUT TYPE="text" NAME="city" VALUE="$city"> State (county) / Country<SELECT NAME="state" SIZE="1"> +print "<BR><BR>Contact information", itable("#c0c0c0"), <<END; +<TR><TH ALIGN="right">Contact name<BR>(last, first)</TH><TD COLSPAN=3><INPUT TYPE="text" NAME="last" VALUE="$last">, <INPUT TYPE="text" NAME="first" VALUE="$first"></TD><TD ALIGN="right">SS#</TD><TD><INPUT TYPE="text" NAME="ss" VALUE="$ss" SIZE=11></TD></TR> +<TR><TD ALIGN="right">Company</TD><TD COLSPAN=5><INPUT TYPE="text" NAME="company" VALUE="$company" SIZE=70></TD></TR> +<TR><TH ALIGN="right">Address</TH><TD COLSPAN=5><INPUT TYPE="text" NAME="address1" VALUE="$address1" SIZE=70></TH></TR> +<TR><TD ALIGN="right"> </TD><TD COLSPAN=5><INPUT TYPE="text" NAME="address2" VALUE="$address2" SIZE=70></TD></TR> +<TR><TH ALIGN="right">City</TH><TD><INPUT TYPE="text" NAME="city" VALUE="$city"><TH ALIGN="right">State/Country</TH><TD><SELECT NAME="state" SIZE="1"> END +$cust_main->country('US') unless $cust_main->country; #eww foreach ( qsearch('cust_main_county',{}) ) { print "<OPTION"; print " SELECTED" if ( $cust_main->state eq $_->state @@ -142,73 +137,115 @@ foreach ( qsearch('cust_main_county',{}) ) { print " (",$_->county,")" if $_->county; print " / ", $_->country; } -print "</SELECT>"; +print qq!</SELECT></TD><TH>Zip</TH><TD><INPUT TYPE="text" NAME="zip" VALUE="$zip" SIZE=10></TD></TR>!; -my($zip,$daytime,$night,$fax)=( - $cust_main->zip, +my($daytime,$night,$fax)=( $cust_main->daytime, $cust_main->night, $cust_main->fax, ); print <<END; - Zip <INPUT TYPE="text" NAME="zip" VALUE="$zip" SIZE=10 MAXLENGTH=10> - -Phone (daytime)<INPUT TYPE="text" NAME="daytime" VALUE="$daytime" SIZE=18 MAXLENGTH=20> (night)<INPUT TYPE="text" NAME="night" VALUE="$night" SIZE=18 MAXLENGTH=20> (fax)<INPUT TYPE="text" NAME="fax" VALUE="$fax" SIZE=12 MAXLENGTH=12> - +<TR><TD ALIGN="right">Day Phone</TD><TD COLSPAN=5><INPUT TYPE="text" NAME="daytime" VALUE="$daytime" SIZE=18></TD></TR> +<TR><TD ALIGN="right">Night Phone</TD><TD COLSPAN=5><INPUT TYPE="text" NAME="night" VALUE="$night" SIZE=18></TD></TR> +<TR><TD ALIGN="right">Fax</TD><TD COLSPAN=5><INPUT TYPE="text" NAME="fax" VALUE="$fax" SIZE=12></TD></TR> END -my(%payby)=( - 'CARD' => "Credit card ", - 'BILL' => "Billing ", - 'COMP' => "Complimentary", -); -for (qw(CARD BILL COMP)) { - print qq!<INPUT TYPE="radio" NAME="payby" VALUE="$_"!; - print qq! CHECKED! if ($cust_main->payby eq "$_"); - print qq!>$payby{$_}!; -} +print "</TABLE>"; +# billing info -my($payinfo,$payname,$otaker)=( - $cust_main->payinfo, - $cust_main->payname, - $cust_main->otaker, -); +sub expselect { + my $prefix = shift; + my $date = shift || ''; + my( $m, $y ) = ( 0, 0 ); + if ( $date =~ /^(\d{4})-(\d{2})-\d{2}$/ ) { #PostgreSQL date format + ( $m, $y ) = ( $2, $1 ); + } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { + ( $m, $y ) = ( $1, $3 ); + } + my $return = qq!<SELECT NAME="$prefix!. qq!_month" SIZE="1">!; + for ( 1 .. 12 ) { + $return .= "<OPTION"; + $return .= " SELECTED" if $_ == $m; + $return .= ">$_"; + } + $return .= qq!</SELECT>/<SELECT NAME="$prefix!. qq!_year" SIZE="1">!; + for ( 1999 .. 2037 ) { + $return .= "<OPTION"; + $return .= " SELECTED" if $_ == $y; + $return .= ">$_"; + } + $return .= "</SELECT>"; -my($paydate); -if ( $cust_main->paydate =~ /^(\d{4})-(\d{2})-\d{2}$/ ) { - $paydate="$2/$1" -} elsif ( $cust_main->paydate =~ /^(\d{2})-\d{2}-(\d{4}$)/ ) { - $paydate="$1/$2" -} -else { - $paydate=''; + $return; } -print <<END; +print "<BR>Billing information", itable("#c0c0c0"), + qq!<TR><TD><INPUT TYPE="checkbox" NAME="tax" VALUE="Y"!; +print qq! CHECKED! if $cust_main->tax eq "Y"; +print qq!>Tax Exempt!; +print qq!</TD></TR><TR><TD><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST"!; +my @invoicing_list = $cust_main->invoicing_list; +print qq! CHECKED! + if ! @invoicing_list || grep { $_ eq 'POST' } @invoicing_list; +print qq!> Postal mail invoice!; +my $invoicing_list = join(', ', grep { $_ ne 'POST' } @invoicing_list ); +print qq!</TD></TR><TR><TD>Email invoice <INPUT TYPE="text" NAME="invoicing_list" VALUE="$invoicing_list"></TD>!; - Card number , P.O. # or Authorization <INPUT TYPE="text" NAME="payinfo" VALUE="$payinfo" SIZE=19 MAXLENGTH=19> -END +print "</TD></TR></TABLE>"; -print qq!Exp. date (MM/YY or MM/YYYY)<INPUT TYPE="text" NAME="paydate" VALUE="$paydate" SIZE=8 MAXLENGTH=7> Billing name <INPUT TYPE="text" NAME="payname" VALUE="$payname">\n<INPUT TYPE="checkbox" NAME="tax" VALUE="Y"!; -print qq! CHECKED! if $cust_main->tax eq "Y"; -print qq!> Tax Exempt!; +print table("#c0c0c0"), "<TR>"; -print <<END; +my($payinfo, $payname)=( + $cust_main->payinfo, + $cust_main->payname, +); +my %payby = ( + 'CARD' => qq!Credit card<BR><INPUT TYPE="text" NAME="CARD_payinfo" VALUE="" MAXLENGTH=19><BR>Exp !. expselect("CARD"). qq!<BR>Name on card<BR><INPUT TYPE="text" NAME="CARD_payname" VALUE="">!, + 'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE=""><BR>Exp !. expselect("BILL", "12-2037"). qq!<BR>Attention<BR><INPUT TYPE="text" NAME="BILL_payname" VALUE="Accounts Payable">!, + 'COMP' => qq!Complimentary<BR>Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE=""><BR>Exp !. expselect("COMP"), +); +my %paybychecked = ( + 'CARD' => qq!Credit card<BR><INPUT TYPE="text" NAME="CARD_payinfo" VALUE="$payinfo" MAXLENGTH=19><BR>Exp !. expselect("CARD", $cust_main->paydate). qq!<BR>Name on card<BR><INPUT TYPE="text" NAME="CARD_payname" VALUE="$payname">!, + 'BILL' => qq!Billing<BR>P.O. <INPUT TYPE="text" NAME="BILL_payinfo" VALUE="$payinfo"><BR>Exp !. expselect("BILL", $cust_main->paydate). qq!<BR>Attention<BR><INPUT TYPE="text" NAME="BILL_payname" VALUE="$payname">!, + 'COMP' => qq!Complimentary<BR>Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE="$payinfo"><BR>Exp !. expselect("COMP", $cust_main->paydate), +); +for (qw(CARD BILL COMP)) { + print qq!<TD VALIGN=TOP><INPUT TYPE="radio" NAME="payby" VALUE="$_"!; + if ($cust_main->payby eq "$_") { + print qq! CHECKED> $paybychecked{$_}</TD>!; + } else { + print qq!> $payby{$_}</TD>!; + } +} -Order taken by: <FONT SIZE="+1"><B>$otaker</B></FONT><INPUT TYPE="hidden" NAME="otaker" VALUE="$otaker"> -</PRE> -END +print "</TR></TABLE>"; -print qq!<CENTER><INPUT TYPE="submit" VALUE="!, - $custnum ? "Apply Changes" : "Add Customer", qq!"></CENTER>!; +#referral -print <<END; +my $refnum = $cust_main->refnum || 0; +if ( $custnum ) { + print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!; +} else { + my(@referrals) = qsearch('part_referral',{}); + print qq!<BR>Referral <SELECT NAME="refnum" SIZE="1">!; + print "<OPTION> "; + my($referral); + foreach $referral (sort { + $a->refnum <=> $b->refnum; + } @referrals) { + print "<OPTION" . " SELECTED"x($referral->refnum==$refnum), + ">", $referral->refnum, ": ", $referral->referral; + } + print "</SELECT>"; +} - </FORM> - </BODY> -</HTML> -END +my $otaker = $cust_main->otaker; +print qq!<INPUT TYPE="hidden" NAME="otaker" VALUE="$otaker">!, + qq!<BR><BR><INPUT TYPE="submit" VALUE="!, + $custnum ? "Apply Changes" : "Add Customer", qq!">!, + "</FORM></BODY></HTML>", +; diff --git a/htdocs/edit/process/cust_main.cgi b/htdocs/edit/process/cust_main.cgi index 8404ba894..f65665142 100755 --- a/htdocs/edit/process/cust_main.cgi +++ b/htdocs/edit/process/cust_main.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: cust_main.cgi,v 1.3 1998-12-17 08:40:19 ivan Exp $ +# $Id: cust_main.cgi,v 1.4 1999-01-18 09:22:32 ivan Exp $ # # Usage: post form to: # http://server.name/path/cust_main.cgi @@ -22,7 +22,10 @@ # bmccane@maxbaud.net 98-apr-3 # # $Log: cust_main.cgi,v $ -# Revision 1.3 1998-12-17 08:40:19 ivan +# Revision 1.4 1999-01-18 09:22:32 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.3 1998/12/17 08:40:19 ivan # s/CGI::Request/CGI.pm/; etc # # Revision 1.2 1998/11/18 08:57:36 ivan @@ -30,60 +33,71 @@ # use strict; +#use CGI; use CGI; use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); +use FS::UID qw(cgisuidsetup getotaker); use FS::CGI qw(eidiot popurl); -use FS::Record qw(qsearchs); +use FS::Record qw(qsearchs fields); use FS::cust_main; my($cgi)=new CGI; - &cgisuidsetup($cgi); -#create new record object +#unmunge stuff -#unmunge agentnum -$cgi->param('agentnum', - (split(/:/, ($cgi->param('agentnum'))[0] ))[0] -); +$cgi->param('agentnum', (split(/:/, ($cgi->param('agentnum'))[0] ))[0] ); -#unmunge tax $cgi->param('tax','') unless defined($cgi->param('tax')); -#unmunge refnum -$cgi->param('refnum', - (split(/:/, ($cgi->param('refnum'))[0] ))[0] -); +$cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] ); -#unmunge state/county/country $cgi->param('state') =~ /^(\w+)( \((\w+)\))? \/ (\w+)$/; $cgi->param('state', $1); $cgi->param('county', $3 || ''); $cgi->param('country', $4); -my($new) = create FS::cust_main ( { +my $payby = $cgi->param('payby'); +$cgi->param('payinfo', $cgi->param( $payby. '_payinfo' ) ); +$cgi->param('paydate', + $cgi->param( $payby. '_month' ). '-'. $cgi->param( $payby. '_year' ) ); +$cgi->param('payname', $cgi->param( $payby. '_payname' ) ); + +$cgi->param('otaker', &getotaker ); + +my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') ); +push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST'); + +#create new record object + +my($new) = new FS::cust_main ( { map { $_, scalar($cgi->param($_)) - } qw(custnum agentnum last first ss company address1 address2 city county - state zip daytime night fax payby payinfo paydate payname tax - otaker refnum) +# } qw(custnum agentnum last first ss company address1 address2 city county +# state zip daytime night fax payby payinfo paydate payname tax +# otaker refnum) + } fields('cust_main') } ); +#perhaps the invocing_list magic should move to cust_main.pm? if ( $new->custnum eq '' ) { - - my($error)=$new->insert; + my $error; + $error = $new->check_invoicing_list( \@invoicing_list ); + &ediot($error) if $error; + $error = $new->insert; &eidiot($error) if $error; - + $new->invoicing_list( \@invoicing_list ); } else { #create old record object - - my($old) = qsearchs( 'cust_main', { 'custnum', $new->custnum } ); + my $error; + my $old = qsearchs( 'cust_main', { 'custnum' => $new->custnum } ); &eidiot("Old record not found!") unless $old; - my($error)=$new->replace($old); + $error = $new->check_invoicing_list( \@invoicing_list ); &eidiot($error) if $error; - + $error = $new->replace($old); + &eidiot($error) if $error; + $new->invoicing_list( \@invoicing_list ); } -my($custnum)=$new->custnum; +my $custnum = $new->custnum; print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum#cust_main"); diff --git a/htdocs/search/cust_pkg.cgi b/htdocs/search/cust_pkg.cgi index d1db3747a..c198a56b6 100755 --- a/htdocs/search/cust_pkg.cgi +++ b/htdocs/search/cust_pkg.cgi @@ -1,11 +1,14 @@ #!/usr/bin/perl -Tw # -# $Id: cust_pkg.cgi,v 1.3 1998-12-23 03:05:59 ivan Exp $ +# $Id: cust_pkg.cgi,v 1.4 1999-01-18 09:22:33 ivan Exp $ # # based on search/svc_acct.cgi ivan@sisd.com 98-jul-17 # # $Log: cust_pkg.cgi,v $ -# Revision 1.3 1998-12-23 03:05:59 ivan +# Revision 1.4 1999-01-18 09:22:33 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.3 1998/12/23 03:05:59 ivan # $cgi->keywords instead of $cgi->query_string # # Revision 1.2 1998/12/17 09:41:09 ivan @@ -65,8 +68,7 @@ if ( scalar(@cust_pkg) == 1 ) { exit; } else { my($total)=scalar(@cust_pkg); - CGI::Base::SendHeaders(); # one guess - print header('Package Search Results',''), <<END; + print $cgi->header, header('Package Search Results',''), <<END; $total matching packages found <TABLE BORDER=4 CELLSPACING=0 CELLPADDING=0> <TR> @@ -77,8 +79,6 @@ if ( scalar(@cust_pkg) == 1 ) { </TR> END - my($lines)=16; - my($lcount)=$lines; my(%saw,$cust_pkg); foreach $cust_pkg ( sort $sortby grep(!$saw{$_->pkgnum}++, @cust_pkg) @@ -98,20 +98,7 @@ END <TD><FONT SIZE=-1>$company</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>Package #</TH> - <TH>Customer #</TH> - <TH>Name</TH> - <TH>Company</TH> - <TH> - </TR> -END - } + } print <<END; diff --git a/htdocs/search/svc_acct.cgi b/htdocs/search/svc_acct.cgi index 0afdb1a26..75fbcb9b7 100755 --- a/htdocs/search/svc_acct.cgi +++ b/htdocs/search/svc_acct.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: svc_acct.cgi,v 1.3 1998-12-23 03:06:28 ivan Exp $ +# $Id: svc_acct.cgi,v 1.4 1999-01-18 09:22:34 ivan Exp $ # # Usage: post form to: # http://server.name/path/svc_acct.cgi @@ -23,7 +23,10 @@ # give service and customer info too ivan@sisd.com 98-aug-16 # # $Log: svc_acct.cgi,v $ -# Revision 1.3 1998-12-23 03:06:28 ivan +# Revision 1.4 1999-01-18 09:22:34 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.3 1998/12/23 03:06:28 ivan # $cgi->keywords instead of $cgi->query_string # # Revision 1.2 1998/12/17 09:41:10 ivan @@ -36,6 +39,8 @@ 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::svc_acct; +use FS::cust_main; my($cgi)=new CGI; &cgisuidsetup($cgi); @@ -43,6 +48,7 @@ my($cgi)=new CGI; my(@svc_acct,$sortby); my($query)=$cgi->keywords; +$query ||= ''; #to avoid use of unitialized value errors #this tree is a little bit redundant if ( $query eq 'svcnum' ) { $sortby=\*svcnum_sort; @@ -84,7 +90,7 @@ if ( scalar(@svc_acct) == 1 ) { exit; } else { my($total)=scalar(@svc_acct); - print $cgi->header("Account Search Results",''), <<END; + print $cgi->header, header("Account Search Results",''), <<END; $total matching accounts found <TABLE BORDER=4 CELLSPACING=0 CELLPADDING=0> <TR> @@ -128,7 +134,8 @@ END ? "<A HREF=\"${p}view/cust_main.cgi?$custnum\"><FONT SIZE=-1>$custnum</FONT></A>" : "<I>(unlinked)</I>" ; - my($pname) = $custnum ? "$last, $first" : ''; + my($pname) = $custnum ? "<A HREF=\"${p}view/cust_main.cgi?$custnum\">$last, $first</A>" : ''; + my $pcompany = $custnum ? "<A HREF=\"${p}view/cust_main.cgi?$custnum\">$company</A>" : ''; print <<END; <TR> <TD><A HREF="${p}view/svc_acct.cgi?$svcnum"><FONT SIZE=-1>$svcnum</FONT></A></TD> @@ -137,7 +144,7 @@ END <TD><FONT SIZE=-1>$svc</FONT></TH> <TD><FONT SIZE=-1>$pcustnum</FONT></TH> <TD><FONT SIZE=-1>$pname<FONT></TH> - <TD><FONT SIZE=-1>$company</FONT></TH> + <TD><FONT SIZE=-1>$pcompany</FONT></TH> </TR> END diff --git a/htdocs/view/cust_main.cgi b/htdocs/view/cust_main.cgi index 8e6145519..0f7a3f4d3 100755 --- a/htdocs/view/cust_main.cgi +++ b/htdocs/view/cust_main.cgi @@ -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.8 1999-01-18 09:22:35 ivan Exp $ # # Usage: cust_main.cgi custnum # http://server.name/path/cust_main.cgi?custnum @@ -33,7 +33,10 @@ # 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.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 @@ -100,7 +103,7 @@ 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 diff --git a/htdocs/view/svc_acct.cgi b/htdocs/view/svc_acct.cgi index e658d2bb8..66ae2d1e9 100755 --- a/htdocs/view/svc_acct.cgi +++ b/htdocs/view/svc_acct.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: svc_acct.cgi,v 1.4 1998-12-23 03:09:19 ivan Exp $ +# $Id: svc_acct.cgi,v 1.5 1999-01-18 09:22:36 ivan Exp $ # # Usage: svc_acct.cgi svcnum # http://server.name/path/svc_acct.cgi?svcnum @@ -35,7 +35,10 @@ # displays arbitrary radius attributes ivan@sisd.com 98-aug-16 # # $Log: svc_acct.cgi,v $ -# Revision 1.4 1998-12-23 03:09:19 ivan +# Revision 1.5 1999-01-18 09:22:36 ivan +# changes to track email addresses for email invoicing +# +# Revision 1.4 1998/12/23 03:09:19 ivan # $cgi->keywords instead of $cgi->query_string # # Revision 1.3 1998/12/17 09:57:23 ivan @@ -46,12 +49,18 @@ # use strict; -use vars qw($conf); +use vars qw( $conf ); use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs fields); +use CGI::Carp qw( fatalsToBrowser ); +use FS::UID qw( cgisuidsetup ); +use FS::CGI qw( header popurl ); +use FS::Record qw( qsearchs fields ); use FS::Conf; +use FS::svc_acct; +use FS::cust_svc; +use FS::cust_pkg; +use FS::part_svc; +use FS::svc_acct_pop; my($cgi) = new CGI; &cgisuidsetup($cgi); diff --git a/site_perl/CGI.pm b/site_perl/CGI.pm index a7856f8dd..136a05cf7 100644 --- a/site_perl/CGI.pm +++ b/site_perl/CGI.pm @@ -9,7 +9,7 @@ use CGI::Carp qw(fatalsToBrowser); use FS::UID; @ISA = qw(Exporter); -@EXPORT_OK = qw(header menubar idiot eidiot popurl table); +@EXPORT_OK = qw(header menubar idiot eidiot popurl table itable); =head1 NAME @@ -45,21 +45,21 @@ Returns an HTML header. sub header { my($title,$menubar)=@_; - <<END; + my $x = <<END; <HTML> <HEAD> <TITLE> $title </TITLE> </HEAD> - <BODY BGCOLOR="#ffffff"> + <BODY BGCOLOR="#e8e8e8"> <FONT COLOR="#FF0000" SIZE=7> $title </FONT> <BR><BR> - $menubar - <BR><BR> END + $x .= $menubar. "<BR><BR>" if $menubar; + $x; } =item menubar ITEM, URL, ... @@ -146,7 +146,12 @@ Returns HTML tag for beginning a table. =cut sub table { - "<TABLE BORDER=1>"; + my $col = shift; + if ( $col ) { + "<TABLE BGCOLOR=$col BORDER=1 WIDTH=\"100%\">"; + } else { + "<TABLE BORDER=1>"; + } } =item itable @@ -156,7 +161,12 @@ Returns HTML tag for beginning an (invisible) table. =cut sub itable { - "<TABLE>"; + my $col = shift; + if ( $col ) { + qq!<TABLE BGCOLOR=$col BORDER=0 CELLSPACING=0 WIDTH=\"100%\">!; + } else { + "<TABLE>"; + } } =back @@ -183,8 +193,8 @@ lose the background, eidiot ivan@sisd.com 98-sep-2 pod ivan@sisd.com 98-sep-12 $Log: CGI.pm,v $ -Revision 1.13 1999-01-17 04:04:13 ivan -itable +Revision 1.14 1999-01-18 09:22:37 ivan +changes to track email addresses for email invoicing Revision 1.12 1998/12/23 02:23:16 ivan popurl always has trailing slash diff --git a/site_perl/Record.pm b/site_perl/Record.pm index 0f098b471..81574131e 100644 --- a/site_perl/Record.pm +++ b/site_perl/Record.pm @@ -166,7 +166,7 @@ sub qsearch { ? " WHERE ". join(' AND ', map { $record->{$_} eq '' - ? "$_ IS NULL" + ? "( $_ IS NULL OR $_ = \"\" )" : "$_ = ". _quote($record->{$_},$table,$_) } @fields ) : '' @@ -383,7 +383,7 @@ sub delete { my($statement)="DELETE FROM ". $self->table. " WHERE ". join(' AND ', map { $self->getfield($_) eq '' - ? "$_ IS NULL" + ? "( $_ IS NULL OR $_ = \"\" )" : "$_ = ". _quote($self->getfield($_),$self->table,$_) } ( $self->dbdef_table->primary_key ) ? ( $self->dbdef_table->primary_key) @@ -450,7 +450,7 @@ sub replace { join(' AND ', map { $old->getfield($_) eq '' - ? "$_ IS NULL" + ? "( $_ IS NULL OR $_ = \"\" )" : "$_ = ". _quote($old->getfield($_),$old->table,$_) } ( $primary_key ? ( $primary_key ) : $old->fields ) ) @@ -805,7 +805,7 @@ sub hfields { =head1 VERSION -$Id: Record.pm,v 1.10 1998-12-29 11:59:33 ivan Exp $ +$Id: Record.pm,v 1.11 1999-01-18 09:22:38 ivan Exp $ =head1 BUGS @@ -927,7 +927,10 @@ added pod documentation ivan@sisd.com 98-sep-6 ut_phonen got ''; at the end ivan@sisd.com 98-sep-27 $Log: Record.pm,v $ -Revision 1.10 1998-12-29 11:59:33 ivan +Revision 1.11 1999-01-18 09:22:38 ivan +changes to track email addresses for email invoicing + +Revision 1.10 1998/12/29 11:59:33 ivan mostly properly OO, some work still to be done with svc_ stuff Revision 1.9 1998/11/21 07:26:45 ivan diff --git a/site_perl/UID.pm b/site_perl/UID.pm index 156bd3024..c141cab63 100644 --- a/site_perl/UID.pm +++ b/site_perl/UID.pm @@ -78,7 +78,7 @@ sub adminsuidsetup { 'ChopBlanks' => 'true', } ) or die "DBI->connect error: $DBI::errstr\n"; - swapuid(); #go to non-privledged user if running setuid freeside + #swapuid(); #go to non-privledged user if running setuid freeside foreach ( keys %callback ) { &{$callback{$_}}; @@ -200,7 +200,7 @@ Swaps real and effective UIDs. =cut sub swapuid { - ($<,$>) = ($>,$<); + ($<,$>) = ($>,$<) if $< != $>; } =item getsecrets [ USER ] @@ -241,7 +241,7 @@ coderef into the hash %FS::UID::callback : =head1 VERSION -$Id: UID.pm,v 1.6 1998-11-15 05:27:48 ivan Exp $ +$Id: UID.pm,v 1.7 1999-01-18 09:22:40 ivan Exp $ =head1 BUGS @@ -287,7 +287,10 @@ inlined suidsetup ivan@sisd.com 98-sep-12 $Log: UID.pm,v $ -Revision 1.6 1998-11-15 05:27:48 ivan +Revision 1.7 1999-01-18 09:22:40 ivan +changes to track email addresses for email invoicing + +Revision 1.6 1998/11/15 05:27:48 ivan bugfix for new configuration layout Revision 1.5 1998/11/15 00:51:51 ivan diff --git a/site_perl/cust_main.pm b/site_perl/cust_main.pm index 77ebb2d04..979b6f4d6 100644 --- a/site_perl/cust_main.pm +++ b/site_perl/cust_main.pm @@ -203,7 +203,8 @@ sub check { my $self = shift; my $error = - $self->ut_number('agentnum') + $self->ut_numbern('custnum') + || $self->ut_number('agentnum') || $self->ut_number('refnum') || $self->ut_textn('company') || $self->ut_text('address1') @@ -254,7 +255,7 @@ sub check { } ); } - $self->zip =~ /^([\w\-]{10})$/ or return "Illegal zip"; + $self->zip =~ /^([\w\-]{5,10})$/ or return "Illegal zip"; $self->zip($1); $self->payby =~ /^(CARD|BILL|COMP)$/ or return "Illegal payby"; @@ -760,34 +761,42 @@ sub balance { sprintf( "%.2f", $self->total_owed - $self->total_credited ); } -=item invoicing_list [ ITEM, ITEM, ... ] +=item invoicing_list [ ARRAYREF ] -If arguements are given, sets these email addresses as invoice recipients +If an arguement is given, sets these email addresses as invoice recipients (see L<FS::cust_main_invoice>). Errors are not fatal and are not reported (except as warnings), so use check_invoicing_list first. Returns a list of email addresses (with svcnum entries expanded). +Note: You can clear the invoicing list by passing an empty ARRAYREF. You can +check it without disturbing anything by passing nothing. + +This interface may change in the future. + =cut sub invoicing_list { - my( $self, @addresses ) = @_; - if ( @addresses ) { + my( $self, $arrayref ) = @_; + if ( $arrayref ) { my @cust_main_invoice = qsearch( 'cust_main_invoice', { 'custnum' => $self->custnum } ); foreach my $cust_main_invoice ( @cust_main_invoice ) { - unless ( grep { $cust_main_invoice->address eq $_ } @addresses ) { - $cust_main_invoice->delete; + #warn $cust_main_invoice->destnum; + unless ( grep { $cust_main_invoice->address eq $_ } @{$arrayref} ) { + #warn $cust_main_invoice->destnum; + my $error = $cust_main_invoice->delete; + warn $error if $error; } } @cust_main_invoice = qsearch( 'cust_main_invoice', { 'custnum' => $self->custnum } ); - foreach my $address ( @addresses ) { + foreach my $address ( @{$arrayref} ) { unless ( grep { $address eq $_->address } @cust_main_invoice ) { - my $cust_main_invoice = new FS::cust_main_invoice ( + my $cust_main_invoice = new FS::cust_main_invoice ( { 'custnum' => $self->custnum, 'dest' => $address, - ); + } ); my $error = $cust_main_invoice->insert; warn $error if $error; } @@ -797,7 +806,7 @@ sub invoicing_list { qsearch( 'cust_main_invoice', { 'custnum' => $self->custnum } ); } -=item check_invoicing_list ITEM, ITEM +=item check_invoicing_list ARRAYREF Checks these arguements as valid input for the invoicing_list method. If there is an error, returns the error, otherwise returns false. @@ -805,12 +814,12 @@ is an error, returns the error, otherwise returns false. =cut sub check_invoicing_list { - my( $self, @addresses ) = @_; - foreach my $address ( @addresses ) { - my $cust_main_invoice = new FS::cust_main_invoice ( + my( $self, $arrayref ) = @_; + foreach my $address ( @{$arrayref} ) { + my $cust_main_invoice = new FS::cust_main_invoice ( { 'custnum' => $self->custnum, 'dest' => $address, - ); + } ); my $error = $cust_main_invoice->check; return $error if $error; } @@ -821,7 +830,7 @@ sub check_invoicing_list { =head1 VERSION -$Id: cust_main.pm,v 1.8 1998-12-29 11:59:39 ivan Exp $ +$Id: cust_main.pm,v 1.9 1999-01-18 09:22:41 ivan Exp $ =head1 BUGS @@ -877,7 +886,10 @@ enable cybercash, cybercash v3 support, don't need to import FS::UID::{datasrc,checkruid} ivan@sisd.com 98-sep-19-21 $Log: cust_main.pm,v $ -Revision 1.8 1998-12-29 11:59:39 ivan +Revision 1.9 1999-01-18 09:22:41 ivan +changes to track email addresses for email invoicing + +Revision 1.8 1998/12/29 11:59:39 ivan mostly properly OO, some work still to be done with svc_ stuff Revision 1.7 1998/12/16 09:58:52 ivan diff --git a/site_perl/cust_main_invoice.pm b/site_perl/cust_main_invoice.pm index 9c1a86a12..61edae961 100644 --- a/site_perl/cust_main_invoice.pm +++ b/site_perl/cust_main_invoice.pm @@ -103,9 +103,9 @@ and repalce methods. sub check { my $self = shift; - my $error = $self->ut_number('destnum') - or $self->ut_number('custnum') - or $self->ut_text('dest') + my $error = $self->ut_numbern('destnum') + || $self->ut_number('custnum') + || $self->ut_text('dest') ; return $error if $error; @@ -117,7 +117,7 @@ sub check { } elsif ( $self->dest =~ /^(\d+)$/ ) { return "Unknown local account (specified by svcnum)" unless qsearchs( 'svc_acct', { 'svcnum' => $self->dest } ); - } elsif ( $self->dest =~ /^([\w\.\-]+)\@(([\w\.\-]\.)+\w+)$/ ) { + } elsif ( $self->dest =~ /^([\w\.\-]+)\@(([\w\.\-]+\.)+\w+)$/ ) { my($user, $domain) = ($1, $2); if ( $domain eq $mydomain ) { my $svc_acct = qsearchs( 'svc_acct', { 'username' => $user } ); @@ -152,7 +152,7 @@ sub address { =head1 VERSION -$Id: cust_main_invoice.pm,v 1.3 1998-12-29 11:59:42 ivan Exp $ +$Id: cust_main_invoice.pm,v 1.4 1999-01-18 09:22:42 ivan Exp $ =head1 BUGS @@ -168,7 +168,10 @@ added hfields ivan@sisd.com 97-nov-13 $Log: cust_main_invoice.pm,v $ -Revision 1.3 1998-12-29 11:59:42 ivan +Revision 1.4 1999-01-18 09:22:42 ivan +changes to track email addresses for email invoicing + +Revision 1.3 1998/12/29 11:59:42 ivan mostly properly OO, some work still to be done with svc_ stuff Revision 1.2 1998/12/16 09:58:53 ivan |