summaryrefslogtreecommitdiff
path: root/htdocs/edit
diff options
context:
space:
mode:
Diffstat (limited to 'htdocs/edit')
-rwxr-xr-xhtdocs/edit/cust_main.cgi12
-rwxr-xr-xhtdocs/edit/cust_main_county-expand.cgi28
-rwxr-xr-xhtdocs/edit/cust_main_county.cgi34
-rwxr-xr-xhtdocs/edit/process/cust_main_county-expand.cgi49
-rwxr-xr-xhtdocs/edit/process/cust_main_county.cgi24
5 files changed, 87 insertions, 60 deletions
diff --git a/htdocs/edit/cust_main.cgi b/htdocs/edit/cust_main.cgi
index 14556010c..fd36ab7d4 100755
--- a/htdocs/edit/cust_main.cgi
+++ b/htdocs/edit/cust_main.cgi
@@ -63,7 +63,6 @@ if ( $cgi->var('QUERY_STRING') =~ /^(\d+)$/ ) { #editing
$custnum='';
$cust_main = create FS::cust_main ( {} );
$cust_main->setfield('otaker',&getotaker);
- $cust_main->setfield('country','US');
$action='Add';
}
@@ -130,21 +129,23 @@ Name (last)<INPUT TYPE="text" NAME="last" VALUE="$last"> (first)<INPUT TYPE="tex
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) <SELECT NAME="state" SIZE="1">
+City <INPUT TYPE="text" NAME="city" VALUE="$city"> State (county) / Country<SELECT NAME="state" SIZE="1">
END
foreach ( qsearch('cust_main_county',{}) ) {
print "<OPTION";
print " SELECTED" if ( $cust_main->state eq $_->state
- && $cust_main->county eq $_->county );
+ && $cust_main->county eq $_->county
+ && $cust_main->country eq $_->country
+ );
print ">",$_->state;
print " (",$_->county,")" if $_->county;
+ print " / ", $_->country;
}
print "</SELECT>";
-my($zip,$country,$daytime,$night,$fax)=(
+my($zip,$daytime,$night,$fax)=(
$cust_main->zip,
- $cust_main->country,
$cust_main->daytime,
$cust_main->night,
$cust_main->fax,
@@ -152,7 +153,6 @@ my($zip,$country,$daytime,$night,$fax)=(
print <<END;
Zip <INPUT TYPE="text" NAME="zip" VALUE="$zip" SIZE=10 MAXLENGTH=10>
-Country: <FONT SIZE="+1"><B>$country</B></FONT><INPUT TYPE="hidden" NAME="country" VALUE="$country">
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>
diff --git a/htdocs/edit/cust_main_county-expand.cgi b/htdocs/edit/cust_main_county-expand.cgi
index 59ff7043a..9b687993f 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
#
-# cust_main_county-expand.cgi: Expand a state into counties (output form)
+# $Id: cust_main_county-expand.cgi,v 1.2 1998-11-18 09:01:38 ivan Exp $
#
# ivan@sisd.com 97-dec-16
#
@@ -8,39 +8,43 @@
# bmccane@maxbaud.net 98-apr-3
#
# lose background, FS::CGI ivan@sisd.com 98-sep-2
+#
+# $Log: cust_main_county-expand.cgi,v $
+# Revision 1.2 1998-11-18 09:01:38 ivan
+# i18n! i18n!
+#
use strict;
-use CGI::Base;
+use CGI;
use CGI::Carp qw(fatalsToBrowser);
use FS::UID qw(cgisuidsetup);
use FS::Record qw(qsearch qsearchs);
-use FS::CGI qw(header menubar);
+use FS::CGI qw(header menubar popurl);
+use FS::cust_main_county;
-my($cgi) = new CGI::Base;
-$cgi->get;
+my($cgi) = new CGI;
&cgisuidsetup($cgi);
-SendHeaders(); # one guess.
-
-$cgi->var('QUERY_STRING') =~ /^(\d+)$/
+my($query) = $cgi->keywords;
+$query =~ /^(\d+)$/
or die "Illegal taxnum!";
my($taxnum)=$1;
my($cust_main_county)=qsearchs('cust_main_county',{'taxnum'=>$taxnum});
die "Can't expand entry!" if $cust_main_county->getfield('county');
-print header("Tax Rate (expand state)", menubar(
- 'Main Menu' => '../',
+print $cgi->header, header("Tax Rate (expand)", menubar(
+ 'Main Menu' => popurl(2),
)), <<END;
<FORM ACTION="process/cust_main_county-expand.cgi" METHOD=POST>
<INPUT TYPE="hidden" NAME="taxnum" VALUE="$taxnum">
- Separate counties by
+ 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.
<BR><INPUT TYPE="submit" VALUE="Submit">
- <BR><TEXTAREA NAME="counties" ROWS=100></TEXTAREA>
+ <BR><TEXTAREA NAME="expansion" ROWS=100></TEXTAREA>
</FORM>
</CENTER>
</BODY>
diff --git a/htdocs/edit/cust_main_county.cgi b/htdocs/edit/cust_main_county.cgi
index 904d58346..96574f0ef 100755
--- a/htdocs/edit/cust_main_county.cgi
+++ b/htdocs/edit/cust_main_county.cgi
@@ -1,6 +1,6 @@
#!/usr/bin/perl -Tw
#
-# cust_main_county.cgi: Edit tax rates (output form)
+# $Id: cust_main_county.cgi,v 1.2 1998-11-18 09:01:39 ivan Exp $
#
# ivan@sisd.com 97-dec-13-16
#
@@ -9,27 +9,30 @@
# bmccane@maxbaud.net 98-apr-3
#
# lose background, FS::CGI ivan@sisd.com 98-sep-2
+#
+# $Log: cust_main_county.cgi,v $
+# Revision 1.2 1998-11-18 09:01:39 ivan
+# i18n! i18n!
+#
use strict;
-use CGI::Base;
+use CGI;
use CGI::Carp qw(fatalsToBrowser);
use FS::UID qw(cgisuidsetup);
use FS::Record qw(qsearch qsearchs);
-use FS::CGI qw(header menubar);
+use FS::CGI qw(header menubar popurl table);
+use FS::cust_main_county;
-my($cgi) = new CGI::Base;
-$cgi->get;
+my($cgi) = new CGI;
&cgisuidsetup($cgi);
-SendHeaders(); # one guess.
-
-print header("Edit tax rates", menubar(
- 'Main Menu' => '../',
-)),<<END;
- <FORM ACTION="process/cust_main_county.cgi" METHOD=POST>
- <TABLE BORDER>
+print $cgi->header, header("Edit tax rates", menubar(
+ 'Main Menu' => popurl(2),
+)), qq!<FORM ACTION="!, popurl(1),
+ qq!/process/cust_main_county.cgi" METHOD=POST>!, table, <<END;
<TR>
+ <TH><FONT SIZE=-1>Country</FONT></TH>
<TH><FONT SIZE=-1>State</FONT></TH>
<TH>County</TH>
<TH><FONT SIZE=-1>Tax</FONT></TH>
@@ -41,9 +44,14 @@ foreach $cust_main_county ( qsearch('cust_main_county',{}) ) {
my($hashref)=$cust_main_county->hashref;
print <<END;
<TR>
- <TD>$hashref->{state}</TD>
+ <TD>$hashref->{country}</TD>
END
+ print "<TD>", $hashref->{state}
+ ? $hashref->{state}
+ : '(ALL)'
+ , "</TD>";
+
print "<TD>", $hashref->{county}
? $hashref->{county}
: '(ALL)'
diff --git a/htdocs/edit/process/cust_main_county-expand.cgi b/htdocs/edit/process/cust_main_county-expand.cgi
index a821560c6..c70d5b9d7 100755
--- a/htdocs/edit/process/cust_main_county-expand.cgi
+++ b/htdocs/edit/process/cust_main_county-expand.cgi
@@ -1,6 +1,6 @@
#!/usr/bin/perl -Tw
#
-# process/cust_main_county-expand.cgi: Expand counties (process form)
+# $Id: cust_main_county-expand.cgi,v 1.2 1998-11-18 09:01:40 ivan Exp $
#
# ivan@sisd.com 97-dec-16
#
@@ -12,45 +12,55 @@
# lose background, FS::CGI
# undo default tax to 0.0 if using Pg6.3: comes from pre-expanded record
# for that state
-#ivan@sisd.com 98-sep-2
+# ivan@sisd.com 98-sep-2
+#
+# $Log: cust_main_county-expand.cgi,v $
+# Revision 1.2 1998-11-18 09:01:40 ivan
+# i18n! i18n!
+#
use strict;
-use CGI::Request;
+use CGI;
use CGI::Carp qw(fatalsToBrowser);
use FS::UID qw(cgisuidsetup datasrc);
use FS::Record qw(qsearch qsearchs);
+use FS::CGI qw(eidiot popurl);
use FS::cust_main_county;
-use FS::CGI qw(eidiot);
+use FS::cust_main;
-my($req)=new CGI::Request; # create form object
+my($cgi)=new CGI;
-&cgisuidsetup($req->cgi);
+&cgisuidsetup($cgi);
-$req->param('taxnum') =~ /^(\d+)$/ or die "Illegal taxnum!";
+$cgi->param('taxnum') =~ /^(\d+)$/ or die "Illegal taxnum!";
my($taxnum)=$1;
my($cust_main_county)=qsearchs('cust_main_county',{'taxnum'=>$taxnum})
or die ("Unknown taxnum!");
-my(@counties);
-if ( $req->param('delim') eq 'n' ) {
- @counties=split(/\n/,$req->param('counties'));
-} elsif ( $req->param('delim') eq 's' ) {
- @counties=split(/\s+/,$req->param('counties'));
+my(@expansion);
+if ( $cgi->param('delim') eq 'n' ) {
+ @expansion=split(/\n/,$cgi->param('expansion'));
+} elsif ( $cgi->param('delim') eq 's' ) {
+ @expansion=split(/\s+/,$cgi->param('expansion'));
} else {
die "Illegal delim!";
}
-@counties=map {
- /^\s*([\w\- ]+)\s*$/ or eidiot("Illegal county");
+@expansion=map {
+ /^\s*([\w\- ]+)\s*$/ or eidiot("Illegal expansion");
$1;
-} @counties;
+} @expansion;
-my($county);
-foreach ( @counties) {
+my($expansion);
+foreach ( @expansion) {
my(%hash)=$cust_main_county->hash;
my($new)=create FS::cust_main_county \%hash;
$new->setfield('taxnum','');
- $new->setfield('county',$_);
+ if ( ! $cust_main_county->state ) {
+ $new->setfield('state',$_);
+ } else {
+ $new->setfield('county',$_);
+ }
#if (datasrc =~ m/Pg/)
#{
# $new->setfield('tax',0.0);
@@ -62,10 +72,11 @@ foreach ( @counties) {
unless ( qsearch('cust_main',{
'state' => $cust_main_county->getfield('state'),
'county' => $cust_main_county->getfield('county'),
+ 'country' => $cust_main_county->getfield('country'),
} ) ) {
my($error)=($cust_main_county->delete);
die $error if $error;
}
-$req->cgi->redirect("../../edit/cust_main_county.cgi");
+print $cgi->redirect(popurl(3). "/edit/cust_main_county.cgi");
diff --git a/htdocs/edit/process/cust_main_county.cgi b/htdocs/edit/process/cust_main_county.cgi
index 58eaa63ce..ce5a4f671 100755
--- a/htdocs/edit/process/cust_main_county.cgi
+++ b/htdocs/edit/process/cust_main_county.cgi
@@ -1,6 +1,6 @@
#!/usr/bin/perl -Tw
#
-# process/agent.cgi: Edit cust_main_county (process form)
+# $Id: cust_main_county.cgi,v 1.2 1998-11-18 09:01:41 ivan Exp $
#
# ivan@sisd.com 97-dec-16
#
@@ -8,31 +8,35 @@
# bmccane@maxbaud.net 98-apr-3
#
# lose background, FS::CGI ivan@sisd.com 98-sep-2
+#
+# $Log: cust_main_county.cgi,v $
+# Revision 1.2 1998-11-18 09:01:41 ivan
+# i18n! i18n!
+#
use strict;
-use CGI::Request;
+use CGI;
use CGI::Carp qw(fatalsToBrowser);
use FS::UID qw(cgisuidsetup);
+use FS::CGI qw(eidiot);
use FS::Record qw(qsearch qsearchs);
use FS::cust_main_county;
-use FS::CGI qw(eidiot);
-
-my($req)=new CGI::Request; # create form object
-&cgisuidsetup($req->cgi);
+my($req)=new CGI;
+&cgisuidsetup($cgi);
-foreach ( $req->params ) {
+foreach ( $cgi->param ) {
/^tax(\d+)$/ or die "Illegal form $_!";
my($taxnum)=$1;
my($old)=qsearchs('cust_main_county',{'taxnum'=>$taxnum})
or die "Couldn't find taxnum $taxnum!";
- next unless $old->getfield('tax') ne $req->param("tax$taxnum");
+ next unless $old->getfield('tax') ne $cgi->param("tax$taxnum");
my(%hash)=$old->hash;
- $hash{tax}=$req->param("tax$taxnum");
+ $hash{tax}=$cgi->param("tax$taxnum");
my($new)=create FS::cust_main_county \%hash;
my($error)=$new->replace($old);
eidiot($error) if $error;
}
-$req->cgi->redirect("../../browse/cust_main_county.cgi");
+$cgi->redirect(popurl(3). "/browse/cust_main_county.cgi");