From ef834d58bfd2ce38c8bea73262c8091a5d88388f Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 18 Nov 1998 09:01:44 +0000 Subject: i18n! i18n! --- htdocs/edit/cust_main.cgi | 12 +++--- htdocs/edit/cust_main_county-expand.cgi | 28 ++++++++------ htdocs/edit/cust_main_county.cgi | 34 ++++++++++------- htdocs/edit/process/cust_main_county-expand.cgi | 49 +++++++++++++++---------- htdocs/edit/process/cust_main_county.cgi | 24 +++++++----- 5 files changed, 87 insertions(+), 60 deletions(-) (limited to 'htdocs/edit') 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) (first) Address -City State (county) State (county) / Country"; -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 < -Country: $country Phone (daytime) (night) (fax) 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), )), < - Separate counties by + Separate by line (rumor has it broken on some browsers) or whitespace.
-
+
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' => '../', -)),< - +print $cgi->header, header("Edit tax rates", menubar( + 'Main Menu' => popurl(2), +)), qq!!, table, < + @@ -41,9 +44,14 @@ foreach $cust_main_county ( qsearch('cust_main_county',{}) ) { my($hashref)=$cust_main_county->hashref; print < - + END + print ""; + print "
Country State County Tax$hashref->{state}$hashref->{country}", $hashref->{state} + ? $hashref->{state} + : '(ALL)' + , "", $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"); -- cgit v1.2.1