diff options
-rw-r--r-- | TODO | 48 | ||||
-rwxr-xr-x | htdocs/edit/agent.cgi | 36 | ||||
-rwxr-xr-x | htdocs/edit/agent_type.cgi | 27 | ||||
-rwxr-xr-x | htdocs/edit/cust_credit.cgi | 56 | ||||
-rwxr-xr-x | htdocs/edit/cust_main.cgi | 116 | ||||
-rwxr-xr-x | htdocs/edit/cust_main_county-expand.cgi | 46 | ||||
-rwxr-xr-x | htdocs/edit/cust_main_county.cgi | 15 | ||||
-rwxr-xr-x | htdocs/edit/cust_pay.cgi | 47 | ||||
-rwxr-xr-x | htdocs/edit/process/agent.cgi | 16 | ||||
-rwxr-xr-x | htdocs/edit/process/agent_type.cgi | 22 | ||||
-rwxr-xr-x | htdocs/edit/process/cust_credit.cgi | 21 | ||||
-rwxr-xr-x | htdocs/edit/process/cust_main.cgi | 51 |
12 files changed, 314 insertions, 187 deletions
@@ -1,4 +1,4 @@ -$Id: TODO,v 1.19 1999-01-18 23:05:00 ivan Exp $ +$Id: TODO,v 1.20 1999-01-25 12:09:48 ivan Exp $ If you are interested in helping with any of these, please join the mailing list (send a blank message to ivan-freeside-subscribe@sisd.com) to avoid @@ -6,18 +6,9 @@ duplication of effort. -- before 1.2b1 -- -Lay out the forms a bit better. - -view/cust_main.cgi should show country - -add doc on mod_perl: upgrade to current CGI.pm -doc Apache::AuthDBI as well +Can't use [e]idiot with mod_perl. -FS::cust_pkg _require_'s FS::$svc, but this won't work with %FS::UID::callback -loading of configuration. (pry need same idea, but will run immediately if -context allows). Looks like error is masked by 'use FS::cust_svc' which in -turn 'use's FS::{svc_acct, svc_acct_sm, svc_domain}' which is now explicit -w/comments in source +Lay out the forms a bit better. libwww regression test - since it will create sample data, can also use this for the web demo @@ -41,11 +32,24 @@ associated with any agent types so it won't show up for other customers to buy. (but also... make sure they go away when the customer does! - need this? : one-off package edits! : need a cust_pkgs or cust_part_pkgs or something table, with custnum and partpkg (like type_pkgs) +(what happens if you hit "custom pricing" but the pricing is already custom?) update site_perl/table_template* (pry out of date) +update web demo + -- before or after --- +FS::cust_pkg _require_'s FS::$svc, but this won't work with %FS::UID::callback +loading of configuration. (pry need same idea, but will run immediately if +context allows). Looks like error is masked by 'use FS::cust_svc' which in +turn 'use's FS::{svc_acct, svc_acct_sm, svc_domain}' which is now explicit +w/comments in source + +Allow a cancelled/suspended/active status from packages to bubble up to +the customer lists. Put active, then suspended, then cancelled accounts. +Similar ordering on the package listing inside a single customer. + svc_domain.pm mail sending uses Date::Format which doesn't seem to pick up correct timezone. @@ -62,6 +66,19 @@ site_perl/svc_domain.cgi (hmm... or maybe should have a button? or maybe svc_do -- after -- +bah, table/itable/*table in FS::CGI is silly. + +doc Apache::AuthDBI as well +.. +Provide sample httpd.conf files. + +hey look: Tie::DBI! Check that out. Override its commit with something that +does perl-side caching for ? a performance improvement and as an emulation +layer to plug in f.ex mysql's atomic transactions +.. +Record.pm uses does some non-portable DBI things. MySQL and Pg seem fine. +Fix it anyway unless we migrate to Tie::DBI. + faq cust_bill.pm uses '==' comparison on dates because they're currently ints @@ -366,6 +383,13 @@ transactions or atomic updates). Or just require a RDBMS that supports rollback and/or atomic updates and get rid of the work-arounds? The /rdb interface had this kludge on top of it but is a technical dead-end in most other ways, unless it can gain an SQL parser and DBD interface. +... +if i'm really bored, find the /rdb interface in fsold and port it to NoSQL, +and while I'm add it add interfaces for AnyDBM_File tied hash.. hmm. Shouldn't +an FS::Record have something to do with a tied hash? But we don't want +performance to go gaga... maybe something with commit to help out here? +... +Ok: FS::Record gives you a tied hash, and you get methods for commit, etc. Better automated comparison of our CC records with processors (CyberCash, at least, has not always had 100% accuracy, though recent versions are diff --git a/htdocs/edit/agent.cgi b/htdocs/edit/agent.cgi index 85489079b..d0ceac38d 100755 --- a/htdocs/edit/agent.cgi +++ b/htdocs/edit/agent.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: agent.cgi,v 1.5 1999-01-19 05:13:31 ivan Exp $ +# $Id: agent.cgi,v 1.6 1999-01-25 12:09:50 ivan Exp $ # # ivan@sisd.com 97-dec-12 # @@ -11,7 +11,10 @@ # use FS::CGI, added inline documentation ivan@sisd.com 98-jul-12 # # $Log: agent.cgi,v $ -# Revision 1.5 1999-01-19 05:13:31 ivan +# Revision 1.6 1999-01-25 12:09:50 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:31 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -27,12 +30,12 @@ # use strict; -use vars qw ( $cgi $agent $action $query $hashref $p $agent_type ); +use vars qw ( $cgi $agent $action $hashref $p $agent_type ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); use FS::CGI qw(header menubar popurl); -use FS::Record qw(qsearch qsearchs); +use FS::Record qw(qsearch qsearchs fields); use FS::agent; use FS::agent_type; @@ -40,14 +43,18 @@ $cgi = new CGI; &cgisuidsetup($cgi); -($query) = $cgi->keywords; -if ( $query =~ /^(\d+)$/ ) { #editing - $agent=qsearchs('agent',{'agentnum'=>$1}); - $action='Edit'; +if ( $cgi->param('error') ) { + $agent = new FS::agent ( { + map { $_, scalar($cgi->param($_)) } fields('agent') + } ); +} elsif ( $cgi->keywords ) { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $agent = qsearchs( 'agent', { 'agentnum' => $1 } ); } else { #adding $agent = new FS::agent {}; - $action='Add'; } +$action = $agent->agentnum ? 'Edit' : 'Add'; $hashref = $agent->hashref; $p = popurl(2); @@ -55,9 +62,14 @@ $p = popurl(2); print $cgi->header( '-expires' => 'now' ), header("$action Agent", menubar( 'Main Menu' => $p, 'View all agents' => $p. 'browse/agent.cgi', -)), '<FORM ACTION="', popurl(1), 'process/agent.cgi" METHOD=POST>'; +)); + +print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), + "</FONT>" + if $cgi->param('error'); -print qq!<INPUT TYPE="hidden" NAME="agentnum" VALUE="$hashref->{agentnum}">!, +print '<FORM ACTION="', popurl(1), 'process/agent.cgi" METHOD=POST>', + qq!<INPUT TYPE="hidden" NAME="agentnum" VALUE="$hashref->{agentnum}">!, "Agent #", $hashref->{agentnum} ? $hashref->{agentnum} : "(NEW)"; print <<END; @@ -67,7 +79,7 @@ Agent type <SELECT NAME="typenum" SIZE=1> END foreach $agent_type (qsearch('agent_type',{})) { - print "<OPTION"; + print "<OPTION VALUE=". $agent_type->typenum; print " SELECTED" if $hashref->{typenum} == $agent_type->getfield('typenum'); print ">", $agent_type->getfield('typenum'), ": ", diff --git a/htdocs/edit/agent_type.cgi b/htdocs/edit/agent_type.cgi index b12c4e28f..147bb6f98 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.9 1999-01-19 05:13:32 ivan Exp $ +# $Id: agent_type.cgi,v 1.10 1999-01-25 12:09:51 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.9 1999-01-19 05:13:32 ivan +# Revision 1.10 1999-01-25 12:09:51 ivan +# yet more mod_perl stuff +# +# Revision 1.9 1999/01/19 05:13:32 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -46,7 +49,7 @@ use vars qw( $cgi $agent_type $action $hashref $p $part_pkg ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearch qsearchs); +use FS::Record qw(qsearch qsearchs fields); use FS::agent_type; use FS::CGI qw(header menubar popurl); use FS::agent_type; @@ -57,24 +60,32 @@ $cgi = new CGI; &cgisuidsetup($cgi); -if ( $cgi->keywords ) { #editing +if ( $cgi->param('error') ) { + $agent_type = new FS::agent_type ( { + map { $_, scalar($cgi->param($_)) } fields('agent') + } ); +} elsif ( $cgi->keywords ) { #editing my( $query ) = $cgi->keywords; $query =~ /^(\d+)$/; $agent_type=qsearchs('agent_type',{'typenum'=>$1}); - $action='Edit'; } else { #adding $agent_type = new FS::agent_type {}; - $action='Add'; } +$action = $agent_type->typenum ? 'Edit' : 'Add'; $hashref = $agent_type->hashref; $p = popurl(2); print $cgi->header( '-expires' => 'now' ), header("$action Agent Type", menubar( 'Main Menu' => "$p", 'View all agent types' => "${p}browse/agent_type.cgi", -)), '<FORM ACTION="', popurl(1), 'process/agent_type.cgi" METHOD=POST>'; +)); + +print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), + "</FONT>" + if $cgi->param('error'); -print qq!<INPUT TYPE="hidden" NAME="typenum" VALUE="$hashref->{typenum}">!, +print '<FORM ACTION="', popurl(1), 'process/agent_type.cgi" METHOD=POST>', + qq!<INPUT TYPE="hidden" NAME="typenum" VALUE="$hashref->{typenum}">!, "Agent Type #", $hashref->{typenum} ? $hashref->{typenum} : "(NEW)"; print <<END; diff --git a/htdocs/edit/cust_credit.cgi b/htdocs/edit/cust_credit.cgi index fdb821fa6..f0b17e172 100755 --- a/htdocs/edit/cust_credit.cgi +++ b/htdocs/edit/cust_credit.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: cust_credit.cgi,v 1.5 1999-01-19 05:13:33 ivan Exp $ +# $Id: cust_credit.cgi,v 1.6 1999-01-25 12:09:52 ivan Exp $ # # Usage: cust_credit.cgi custnum [ -paybatch ] # http://server.name/path/cust_credit?custnum [ -paybatch ] @@ -25,7 +25,10 @@ # rewrite ivan@sisd.com 98-mar-16 # # $Log: cust_credit.cgi,v $ -# Revision 1.5 1999-01-19 05:13:33 ivan +# Revision 1.6 1999-01-25 12:09:52 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:33 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -41,56 +44,65 @@ # use strict; -use vars qw( $cgi $query $custnum $otaker $p1 $crednum $date $amount $reason ); +use vars qw( $cgi $query $custnum $otaker $p1 $crednum $_date $amount $reason ); use Date::Format; use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup getotaker); use FS::CGI qw(header popurl); +use FS::Record qw(fields); +#use FS::cust_credit; $cgi = new CGI; - cgisuidsetup($cgi); -($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -$custnum = $1; +if ( $cgi->param('error') ) { + #$cust_credit = new FS::cust_credit ( { + # map { $_, scalar($cgi->param($_)) } fields('cust_credit') + #} ); + $custnum = $cgi->param('custnum'); + $amount = $cgi->param('amount'); + #$refund = $cgi->param('refund'); + $reason = $cgi->param('reason'); +} else { + ($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $custnum = $1; + $amount = ''; + #$refund = 'yes'; + $reason = ''; +} +$_date = time; $otaker = getotaker; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Post Credit", ''), <<END; +print $cgi->header( '-expires' => 'now' ), header("Post Credit", ''); +print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), + "</FONT>" + if $cgi->param('error'); +print <<END; <FORM ACTION="${p1}process/cust_credit.cgi" METHOD=POST> - <HR><PRE> + <PRE> END -#crednum $crednum = ""; print qq!Credit #<B>!, $crednum ? $crednum : " <I>(NEW)</I>", qq!</B><INPUT TYPE="hidden" NAME="crednum" VALUE="$crednum">!; -#custnum print qq!\nCustomer #<B>$custnum</B><INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum">!; -#paybatch print qq!<INPUT TYPE="hidden" NAME="paybatch" VALUE="">!; -#date -$date = time; -print qq!\nDate: <B>!, time2str("%D",$date), qq!</B><INPUT TYPE="hidden" NAME="_date" VALUE="$date">!; +print qq!\nDate: <B>!, time2str("%D",$_date), qq!</B><INPUT TYPE="hidden" NAME="_date" VALUE="">!; -#amount -$amount = ''; print qq!\nAmount \$<INPUT TYPE="text" NAME="amount" VALUE="$amount" SIZE=8 MAXLENGTH=8>!; +print qq!<INPUT TYPE="hidden" NAME="credited" VALUE="">!; -#refund? -#print qq! <INPUT TYPE="checkbox" NAME="refund" VALUE="yes">Also post refund!; +#print qq! <INPUT TYPE="checkbox" NAME="refund" VALUE="$refund">Also post refund!; -#otaker (hidden) print qq!<INPUT TYPE="hidden" NAME="otaker" VALUE="$otaker">!; -#reason -$reason = ''; print qq!\nReason <INPUT TYPE="text" NAME="reason" VALUE="$reason" SIZE=72>!; print <<END; diff --git a/htdocs/edit/cust_main.cgi b/htdocs/edit/cust_main.cgi index 1c2ba4cd4..03252b054 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.7 1999-01-19 05:13:34 ivan Exp $ +# $Id: cust_main.cgi,v 1.8 1999-01-25 12:09:53 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.7 1999-01-19 05:13:34 ivan +# Revision 1.8 1999-01-25 12:09:53 ivan +# yet more mod_perl stuff +# +# Revision 1.7 1999/01/19 05:13:34 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -62,11 +65,11 @@ use strict; use vars qw( $cgi $custnum $action $cust_main $p1 @agents $agentnum $last $first $ss $company $address1 $address2 $city $zip $daytime $night $fax @invoicing_list $invoicing_list $payinfo - $payname %payby %paybychecked $refnum $otaker ); + $payname %payby %paybychecked $refnum $otaker $r ); use CGI::Switch; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup getotaker); -use FS::Record qw(qsearch qsearchs); +use FS::Record qw(qsearch qsearchs fields); use FS::CGI qw(header popurl itable table); use FS::cust_main; @@ -75,24 +78,31 @@ cgisuidsetup($cgi); #get record -if ( $cgi->keywords ) { #editing +if ( $cgi->param('error') ) { + $cust_main = new FS::cust_main ( { + map { $_, scalar($cgi->param($_)) } fields('cust_main') + } ); + $custnum = $cust_main->custnum; +} elsif ( $cgi->keywords ) { #editing my( $query ) = $cgi->keywords; $query =~ /^(\d+)$/; $custnum=$1; $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); - $action='Edit'; } else { $custnum=''; $cust_main = new FS::cust_main ( {} ); $cust_main->setfield('otaker',&getotaker); - $action='Add'; } +$action = $custnum ? 'Edit' : 'Add'; # top $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Customer $action", ''), - qq!<FORM ACTION="${p1}process/cust_main.cgi" METHOD=POST>!, +print $cgi->header( '-expires' => 'now' ), header("Customer $action", ''); +print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), + "</FONT>" + if $cgi->param('error'); +print qq!<FORM ACTION="${p1}process/cust_main.cgi" METHOD=POST>!, qq!<INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum">!, qq!Customer # !, ( $custnum ? $custnum : " (NEW)" ), @@ -100,22 +110,50 @@ print $cgi->header( '-expires' => 'now' ), header("Customer $action", ''), # agent +$r = qq!<font color="#ff0000">*</font>!; + @agents = qsearch( 'agent', {} ); $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">!; + print qq!<BR><BR>${r}Agent <SELECT NAME="agentnum" SIZE="1">!; my $agent; foreach $agent (sort { $a->agent cmp $b->agent; } @agents) { - print "<OPTION" . " SELECTED"x($agent->agentnum==$agentnum), + print '<OPTION VALUE="', $agent->agentnum, '"', + " SELECTED"x($agent->agentnum==$agentnum), ">", $agent->agentnum,": ", $agent->agent; } print "</SELECT>"; } +#referral + +$refnum = $cust_main->refnum || 0; +if ( $custnum ) { + print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!; +} else { + my(@referrals) = qsearch('part_referral',{}); + if ( scalar(@referrals) == 1 ) { + $refnum ||= $referrals[0]->refnum; + print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!; + } else { + print qq!<BR>${r}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>"; + } +} + + # contact info ($last,$first,$ss,$company,$address1,$address2,$city,$zip)=( @@ -130,11 +168,11 @@ if ( scalar(@agents) == 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><TH ALIGN="right">${r}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><TH ALIGN="right">${r}Address</TH><TD COLSPAN=5><INPUT TYPE="text" NAME="address1" VALUE="$address1" SIZE=70></TD></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"> +<TR><TH ALIGN="right">${r}City</TH><TD><INPUT TYPE="text" NAME="city" VALUE="$city"><TH ALIGN="right">${r}State/Country</TH><TD><SELECT NAME="state" SIZE="1"> END $cust_main->country('US') unless $cust_main->country; #eww @@ -148,7 +186,7 @@ foreach ( qsearch('cust_main_county',{}) ) { print " (",$_->county,")" if $_->county; print " / ", $_->country; } -print qq!</SELECT></TD><TH>Zip</TH><TD><INPUT TYPE="text" NAME="zip" VALUE="$zip" SIZE=10></TD></TR>!; +print qq!</SELECT></TD><TH>${r}Zip</TH><TD><INPUT TYPE="text" NAME="zip" VALUE="$zip" SIZE=10></TD></TR>!; ($daytime,$night,$fax)=( $cust_main->daytime, @@ -162,7 +200,7 @@ print <<END; <TR><TD ALIGN="right">Fax</TD><TD COLSPAN=5><INPUT TYPE="text" NAME="fax" VALUE="$fax" SIZE=12></TD></TR> END -print "</TABLE>"; +print "</TABLE>$r designates required fields<BR>"; # billing info @@ -195,18 +233,18 @@ sub expselect { 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"!; +print qq!>Tax Exempt</TD></TR>!; +print qq!<TR><TD><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST"!; @invoicing_list = $cust_main->invoicing_list; print qq! CHECKED! if ! @invoicing_list || grep { $_ eq 'POST' } @invoicing_list; -print qq!> Postal mail invoice!; +print qq!>Postal mail invoice</TD></TR>!; $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>!; - -print "</TD></TR></TABLE>"; +print qq!<TR><TD>Email invoice <INPUT TYPE="text" NAME="invoicing_list" VALUE="$invoicing_list"></TD></TR>!; -print table("#c0c0c0"), "<TR>"; +print "<TR><TD>Billing type</TD></TR>", + "</TABLE>", + table("#c0c0c0"), "<TR>"; ($payinfo, $payname)=( $cust_main->payinfo, @@ -214,14 +252,14 @@ print table("#c0c0c0"), "<TR>"; ); %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"), + 'CARD' => qq!Credit card<BR>${r}<INPUT TYPE="text" NAME="CARD_payinfo" VALUE="" MAXLENGTH=19><BR>${r}Exp !. expselect("CARD"). qq!<BR>${r}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>${r}Exp !. expselect("BILL", "12-2037"). qq!<BR>${r}Attention<BR><INPUT TYPE="text" NAME="BILL_payname" VALUE="Accounts Payable">!, + 'COMP' => qq!Complimentary<BR>${r}Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE=""><BR>${r}Exp !. expselect("COMP"), ); %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), + 'CARD' => qq!Credit card<BR>${r}<INPUT TYPE="text" NAME="CARD_payinfo" VALUE="$payinfo" MAXLENGTH=19><BR>${r}Exp !. expselect("CARD", $cust_main->paydate). qq!<BR>${r}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>${r}Exp !. expselect("BILL", $cust_main->paydate). qq!<BR>${r}Attention<BR><INPUT TYPE="text" NAME="BILL_payname" VALUE="$payname">!, + 'COMP' => qq!Complimentary<BR>${r}Approved by<INPUT TYPE="text" NAME="COMP_payinfo" VALUE="$payinfo"><BR>${r}Exp !. expselect("COMP", $cust_main->paydate), ); for (qw(CARD BILL COMP)) { print qq!<TD VALIGN=TOP><INPUT TYPE="radio" NAME="payby" VALUE="$_"!; @@ -232,26 +270,8 @@ for (qw(CARD BILL COMP)) { } } -print "</TR></TABLE>"; - -#referral +print "</TR></TABLE>$r designates required fields for each billing type"; -$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>"; -} $otaker = $cust_main->otaker; print qq!<INPUT TYPE="hidden" NAME="otaker" VALUE="$otaker">!, diff --git a/htdocs/edit/cust_main_county-expand.cgi b/htdocs/edit/cust_main_county-expand.cgi index 65629844d..783e92826 100755 --- a/htdocs/edit/cust_main_county-expand.cgi +++ b/htdocs/edit/cust_main_county-expand.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: cust_main_county-expand.cgi,v 1.5 1999-01-19 05:13:35 ivan Exp $ +# $Id: cust_main_county-expand.cgi,v 1.6 1999-01-25 12:09:54 ivan Exp $ # # ivan@sisd.com 97-dec-16 # @@ -10,7 +10,10 @@ # lose background, FS::CGI ivan@sisd.com 98-sep-2 # # $Log: cust_main_county-expand.cgi,v $ -# Revision 1.5 1999-01-19 05:13:35 ivan +# Revision 1.6 1999-01-25 12:09:54 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:35 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -26,7 +29,7 @@ # use strict; -use vars qw( $cgi $query $taxnum $cust_main_county $p1 ); +use vars qw( $cgi $taxnum $cust_main_county $p1 $delim $expansion ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); @@ -38,10 +41,18 @@ $cgi = new CGI; &cgisuidsetup($cgi); -($query) = $cgi->keywords; -$query =~ /^(\d+)$/ - or die "Illegal taxnum!"; -$taxnum = $1; +if ( $cgi->param('error') ) { + $taxnum = $cgi->param('taxnum'); + $delim = $cgi->param('delim'); + $expansion = $cgi->param('expansion'); +} else { + my ($query) = $cgi->keywords; + $query =~ /^(\d+)$/ + or die "Illegal taxnum!"; + $taxnum = $1; + $delim = 'n'; + $expansion = ''; +} $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}); die "Can't expand entry!" if $cust_main_county->getfield('county'); @@ -49,15 +60,26 @@ die "Can't expand entry!" if $cust_main_county->getfield('county'); $p1 = popurl(1); print $cgi->header( '-expires' => 'now' ), header("Tax Rate (expand)", menubar( 'Main Menu' => popurl(2), -)), <<END; +)); + +print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), + "</FONT>" + if $cgi->param('error'); + +print <<END; <FORM ACTION="${p1}process/cust_main_county-expand.cgi" METHOD=POST> <INPUT TYPE="hidden" NAME="taxnum" VALUE="$taxnum"> Separate by - <INPUT TYPE="radio" NAME="delim" VALUE="n" CHECKED>line - (rumor has it broken on some browsers) or - <INPUT TYPE="radio" NAME="delim" VALUE="s">whitespace. +END +print '<INPUT TYPE="radio" NAME="delim" VALUE="n"'; +print ' CHECKED' if $delim eq 'n'; +print '>line (rumor has it broken on some browsers) or', + '<INPUT TYPE="radio" NAME="delim" VALUE="s"'; +print ' CHECKED' if $delim eq 's'; +print '>whitespace.'; +print <<END; <BR><INPUT TYPE="submit" VALUE="Submit"> - <BR><TEXTAREA NAME="expansion" ROWS=100></TEXTAREA> + <BR><TEXTAREA NAME="expansion" ROWS=100>$expansion</TEXTAREA> </FORM> </CENTER> </BODY> diff --git a/htdocs/edit/cust_main_county.cgi b/htdocs/edit/cust_main_county.cgi index 05c072786..3c2efec5b 100755 --- a/htdocs/edit/cust_main_county.cgi +++ b/htdocs/edit/cust_main_county.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: cust_main_county.cgi,v 1.5 1999-01-19 05:13:36 ivan Exp $ +# $Id: cust_main_county.cgi,v 1.6 1999-01-25 12:09:55 ivan Exp $ # # ivan@sisd.com 97-dec-13-16 # @@ -11,7 +11,10 @@ # lose background, FS::CGI ivan@sisd.com 98-sep-2 # # $Log: cust_main_county.cgi,v $ -# Revision 1.5 1999-01-19 05:13:36 ivan +# Revision 1.6 1999-01-25 12:09:55 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:36 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -41,7 +44,13 @@ $cgi = new CGI; print $cgi->header( '-expires' => 'now' ), header("Edit tax rates", menubar( 'Main Menu' => popurl(2), -)), qq!<FORM ACTION="!, popurl(1), +)); + +print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), + "</FONT>" + if $cgi->param('error'); + +print qq!<FORM ACTION="!, popurl(1), qq!process/cust_main_county.cgi" METHOD=POST>!, table, <<END; <TR> <TH><FONT SIZE=-1>Country</FONT></TH> diff --git a/htdocs/edit/cust_pay.cgi b/htdocs/edit/cust_pay.cgi index 4cd95de55..27015171f 100755 --- a/htdocs/edit/cust_pay.cgi +++ b/htdocs/edit/cust_pay.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: cust_pay.cgi,v 1.4 1999-01-19 05:13:37 ivan Exp $ +# $Id: cust_pay.cgi,v 1.5 1999-01-25 12:09:56 ivan Exp $ # # Usage: cust_pay.cgi invnum # http://server.name/path/cust_pay.cgi?invnum @@ -14,7 +14,10 @@ # rewrite ivan@sisd.com 98-mar-16 # # $Log: cust_pay.cgi,v $ -# Revision 1.4 1999-01-19 05:13:37 ivan +# Revision 1.5 1999-01-25 12:09:56 ivan +# yet more mod_perl stuff +# +# Revision 1.4 1999/01/19 05:13:37 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -27,7 +30,7 @@ # use strict; -use vars qw( $cgi $query $invnum $p1 $date $payby $payinfo ); +use vars qw( $cgi $invnum $p1 $_date $payby $payinfo $paid ); use Date::Format; use CGI; use CGI::Carp qw(fatalsToBrowser); @@ -37,32 +40,42 @@ use FS::CGI qw(header popurl); $cgi = new CGI; cgisuidsetup($cgi); -($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -$invnum = $1; +if ( $cgi->param('error') ) { + $invnum = $cgi->param('invnum'); + $paid = $cgi->param('paid'); + $payby = $cgi->param('payby'); + $payinfo = $cgi->param('payinfo'); +} else { + my ($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $invnum = $1; + $paid = ''; + $payby = "BILL"; + $payinfo = ""; +} +$_date = time; $p1 = popurl(1); -print $cgi->header( '-expires' => 'now' ), header("Enter payment", ''), <<END; +print $cgi->header( '-expires' => 'now' ), header("Enter payment", ''); + +print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), + "</FONT>" + if $cgi->param('error'); + +print <<END; <FORM ACTION="${p1}process/cust_pay.cgi" METHOD=POST> <HR><PRE> END -#invnum print qq!Invoice #<B>$invnum</B><INPUT TYPE="hidden" NAME="invnum" VALUE="$invnum">!; -#date -$date = time; -print qq!<BR>Date: <B>!, time2str("%D",$date), qq!</B><INPUT TYPE="hidden" NAME="_date" VALUE="$date">!; +print qq!<BR>Date: <B>!, time2str("%D",$_date), qq!</B><INPUT TYPE="hidden" NAME="_date" VALUE="$_date">!; -#paid -print qq!<BR>Amount \$<INPUT TYPE="text" NAME="paid" VALUE="" SIZE=8 MAXLENGTH=8>!; +print qq!<BR>Amount \$<INPUT TYPE="text" NAME="paid" VALUE="$paid" SIZE=8 MAXLENGTH=8>!; -#payby -$payby = "BILL"; print qq!<BR>Payby: <B>$payby</B><INPUT TYPE="hidden" NAME="payby" VALUE="$payby">!; #payinfo (check # now as payby="BILL" hardcoded.. what to do later?) -$payinfo = ""; print qq!<BR>Check #<INPUT TYPE="text" NAME="payinfo" VALUE="$payinfo">!; #paybatch @@ -71,7 +84,7 @@ print qq!<INPUT TYPE="hidden" NAME="paybatch" VALUE="">!; print <<END; </PRE> <BR> -<CENTER><INPUT TYPE="submit" VALUE="Post"></CENTER> +<INPUT TYPE="submit" VALUE="Post payment"> END print <<END; diff --git a/htdocs/edit/process/agent.cgi b/htdocs/edit/process/agent.cgi index 1dab7601b..c1b397aac 100755 --- a/htdocs/edit/process/agent.cgi +++ b/htdocs/edit/process/agent.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: agent.cgi,v 1.6 1999-01-19 05:13:47 ivan Exp $ +# $Id: agent.cgi,v 1.7 1999-01-25 12:09:57 ivan Exp $ # # ivan@sisd.com 97-dec-12 # @@ -10,7 +10,10 @@ # lose background, FS::CGI ivan@sisd.com 98-sep-2 # # $Log: agent.cgi,v $ -# Revision 1.6 1999-01-19 05:13:47 ivan +# Revision 1.7 1999-01-25 12:09:57 ivan +# yet more mod_perl stuff +# +# Revision 1.6 1999/01/19 05:13:47 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -34,7 +37,7 @@ use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); use FS::Record qw(qsearch qsearchs fields); use FS::agent; -use FS::CGI qw(idiot popurl); +use FS::CGI qw(popurl); $cgi = new CGI; @@ -44,10 +47,6 @@ $agentnum = $cgi->param('agentnum'); $old = qsearchs('agent',{'agentnum'=>$agentnum}) if $agentnum; -#unmunge typenum -$cgi->param('typenum') =~ /^(\d+)(:.*)?$/; -$cgi->param('typenum',$1); - $new = new FS::agent ( { map { $_, scalar($cgi->param($_)); @@ -62,7 +61,8 @@ if ( $agentnum ) { } if ( $error ) { - &idiot($error); + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "agent.cgi?". $cgi->query_string ); } else { print $cgi->redirect(popurl(3). "browse/agent.cgi"); } diff --git a/htdocs/edit/process/agent_type.cgi b/htdocs/edit/process/agent_type.cgi index e13817121..99c54ab3b 100755 --- a/htdocs/edit/process/agent_type.cgi +++ b/htdocs/edit/process/agent_type.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: agent_type.cgi,v 1.6 1999-01-19 05:13:48 ivan Exp $ +# $Id: agent_type.cgi,v 1.7 1999-01-25 12:09:58 ivan Exp $ # # ivan@sisd.com 97-dec-11 # @@ -10,7 +10,10 @@ # lose background, FS::CGI ivan@sisd.com 98-sep-2 # # $Log: agent_type.cgi,v $ -# Revision 1.6 1999-01-19 05:13:48 ivan +# Revision 1.7 1999-01-25 12:09:58 ivan +# yet more mod_perl stuff +# +# Revision 1.6 1999/01/19 05:13:48 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -31,7 +34,7 @@ use strict; use vars qw ( $cgi $typenum $old $new $error $part_pkg ); use CGI; use CGI::Carp qw(fatalsToBrowser); -use FS::CGI qw(idiot popurl); +use FS::CGI qw( popurl); use FS::UID qw(cgisuidsetup); use FS::Record qw(qsearch qsearchs fields); use FS::agent_type; @@ -58,7 +61,8 @@ if ( $typenum ) { } if ( $error ) { - idiot($error); + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "agent_type.cgi?". $cgi->query_string ); exit; } @@ -72,10 +76,7 @@ foreach $part_pkg (qsearch('part_pkg',{})) { if ( $type_pkgs && ! $cgi->param("pkgpart$pkgpart") ) { my($d_type_pkgs)=$type_pkgs; #need to save $type_pkgs for below. $error=$d_type_pkgs->delete; - if ( $error ) { - idiot($error); - exit; - } + die $error if $error; } elsif ( $cgi->param("pkgpart$pkgpart") && ! $type_pkgs @@ -86,10 +87,7 @@ foreach $part_pkg (qsearch('part_pkg',{})) { 'pkgpart' => $pkgpart, }); $error= $type_pkgs->insert; - if ( $error ) { - idiot($error); - exit; - } + die $error if $error; } } diff --git a/htdocs/edit/process/cust_credit.cgi b/htdocs/edit/process/cust_credit.cgi index 8f4515e48..f95688197 100755 --- a/htdocs/edit/process/cust_credit.cgi +++ b/htdocs/edit/process/cust_credit.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: cust_credit.cgi,v 1.4 1999-01-19 05:13:49 ivan Exp $ +# $Id: cust_credit.cgi,v 1.5 1999-01-25 12:09:59 ivan Exp $ # # Usage: post form to: # http://server.name/path/cust_credit.cgi @@ -22,7 +22,10 @@ # bmccane@maxbaud.net 98-apr-3 # # $Log: cust_credit.cgi,v $ -# Revision 1.4 1999-01-19 05:13:49 ivan +# Revision 1.5 1999-01-25 12:09:59 ivan +# yet more mod_perl stuff +# +# Revision 1.4 1999/01/19 05:13:49 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -38,7 +41,7 @@ use vars qw( $cgi $custnum $new $error ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(popurl eidiot); +use FS::CGI qw(popurl); use FS::Record qw(fields); use FS::cust_credit; @@ -54,12 +57,16 @@ $new = new FS::cust_credit ( { map { $_, scalar($cgi->param($_)); #} qw(custnum _date amount otaker reason) - } fields('cust_credit'); + } fields('cust_credit') } ); $error=$new->insert; -&eidiot($error) if $error; -#no errors, no refund, so view our credit. -print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum#history"); +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "cust_credit.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum#history"); +} + diff --git a/htdocs/edit/process/cust_main.cgi b/htdocs/edit/process/cust_main.cgi index 850f2add4..3262c42e2 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.5 1999-01-19 05:13:50 ivan Exp $ +# $Id: cust_main.cgi,v 1.6 1999-01-25 12:10:00 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.5 1999-01-19 05:13:50 ivan +# Revision 1.6 1999-01-25 12:10:00 ivan +# yet more mod_perl stuff +# +# Revision 1.5 1999/01/19 05:13:50 ivan # for mod_perl: no more top-level my() variables; use vars instead # also the last s/create/new/; # @@ -37,11 +40,11 @@ # use strict; -use vars qw( $cgi $payby @invoicing_list $new $custnum ); +use vars qw( $cgi $payby @invoicing_list $new $custnum $error ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup getotaker); -use FS::CGI qw(eidiot popurl); +use FS::CGI qw( popurl ); use FS::Record qw(qsearchs fields); use FS::cust_main; @@ -50,8 +53,6 @@ $cgi = new CGI; #unmunge stuff -$cgi->param('agentnum', (split(/:/, ($cgi->param('agentnum'))[0] ))[0] ); - $cgi->param('tax','') unless defined($cgi->param('tax')); $cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] ); @@ -61,11 +62,12 @@ $cgi->param('state', $1); $cgi->param('county', $3 || ''); $cgi->param('country', $4); -$payby = $cgi->param('payby'); -$cgi->param('payinfo', $cgi->param( $payby. '_payinfo' ) ); -$cgi->param('paydate', +if ( $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('payname', $cgi->param( $payby. '_payname' ) ); +} $cgi->param('otaker', &getotaker ); @@ -83,25 +85,22 @@ $new = new FS::cust_main ( { } fields('cust_main') } ); +$error = $new->check_invoicing_list( \@invoicing_list ); + #perhaps the invocing_list magic should move to cust_main.pm? if ( $new->custnum eq '' ) { - 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 ); + $error ||= $new->insert; } else { #create old record object - my $error; my $old = qsearchs( 'cust_main', { 'custnum' => $new->custnum } ); - &eidiot("Old record not found!") unless $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 ); + $error ||= "Old record not found!" unless $old; + $error ||= $new->replace($old); } -$custnum = $new->custnum; -print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum#cust_main"); - +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "cust_main.cgi?". $cgi->query_string ); +} else { + $new->invoicing_list( \@invoicing_list ); + $custnum = $new->custnum; + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum#cust_main"); +} |