From ef834d58bfd2ce38c8bea73262c8091a5d88388f Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 18 Nov 1998 09:01:44 +0000 Subject: i18n! i18n! --- htdocs/browse/cust_main_county.cgi | 54 +++++++++++++++++-------- htdocs/docs/schema.html | 8 ++++ htdocs/docs/upgrade3.html | 16 ++++++++ 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 ++++++----- htdocs/index.html | 4 +- 9 files changed, 150 insertions(+), 79 deletions(-) (limited to 'htdocs') diff --git a/htdocs/browse/cust_main_county.cgi b/htdocs/browse/cust_main_county.cgi index d615198c9..4defa574d 100755 --- a/htdocs/browse/cust_main_county.cgi +++ b/htdocs/browse/cust_main_county.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# cust_main_county.cgi: browse cust_main_county +# $Id: cust_main_county.cgi,v 1.2 1998-11-18 09:01:34 ivan Exp $ # # ivan@sisd.com 97-dec-13 # @@ -8,26 +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:34 ivan +# i18n! i18n! +# use strict; -use CGI::Base; +use CGI; +use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup swapuid); 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("Tax Rate Listing", menubar( - 'Main Menu' => '../', - 'Edit tax rates' => "../edit/cust_main_county.cgi", +print $cgi->header, header("Tax Rate Listing", menubar( + 'Main Menu' => popurl(2), + 'Edit tax rates' => popurl(2). "/edit/cust_main_county.cgi", )),<Click on expand to specify tax rates by county. -

+ Click on expand country to specify a country's tax rates by state. +
Click on expand state to specify a state's tax rates by county. +

+END +print table, < + @@ -39,15 +48,26 @@ foreach $cust_main_county ( qsearch('cust_main_county',{}) ) { my($hashref)=$cust_main_county->hashref; print < - + END - - print ""; + print ""; print <$hashref->{tax}% diff --git a/htdocs/docs/schema.html b/htdocs/docs/schema.html index 5a296ec83..f7a9bc101 100644 --- a/htdocs/docs/schema.html +++ b/htdocs/docs/schema.html @@ -50,7 +50,9 @@
  • custnum - primary key
  • agentnum - agent
  • refnum - referral +
  • titlenum - title
  • first - name +
  • middle - name
  • last - name
  • ss - social security number
  • company @@ -75,6 +77,7 @@
  • taxnum - primary key
  • state
  • county +
  • country
  • tax - % rate
  • cust_pay - Payments @@ -155,6 +158,11 @@
  • table__field - Default or fixed value for field in table
  • table__field_flag - null, D or F +
  • part_title - Personal titles +
      +
    • titlenum - primary key +
    • title - personal title (`Dr.' or `Mr.') +
  • pkg_svc
    • pkgpart - Package definition diff --git a/htdocs/docs/upgrade3.html b/htdocs/docs/upgrade3.html index bfb717cfa..15066423e 100644 --- a/htdocs/docs/upgrade3.html +++ b/htdocs/docs/upgrade3.html @@ -12,5 +12,21 @@
    • Move /var/spool/freeside/dbdef.datasrc to /usr/local/etc/freeside/dbdef.datasrc.
    • Move /var/spool/freeside/counters to /usr/local/etc/freeside/counters.datasrc.
    • Move /var/spool/freeside/export to /usr/local/etc/freeside/export.datasrc. +
    • Apply the following changes to your database: +
      +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_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 (
      +   titlenum int NOT NULL,
      +   title varchar(80),
      +   PRIMARY KEY (titlenum)
      +);
      +
      +
    • Run bin/dbdef-create. This file uses MySQL-specific syntax. If you are r +unning a different database engine you will need to modify it slightly.
    • Copy or symlink htdocs and site_perl to the new copies. 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' => '../', -)),< -
  • Country State County Tax$hashref->{state}$hashref->{country}", $hashref->{county} - ? $hashref->{county} + print "", $hashref->{state} + ? $hashref->{state} : qq!(ALL) !. - qq!expand! + qq!expand country! , ""; + if ( $hashref->{county} ) { + print $hashref->{county}; + } else { + print "(ALL)"; + if ( $hashref->{state} ) { + print qq!!. + qq!expand state!; + } + } + print "
    +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"); diff --git a/htdocs/index.html b/htdocs/index.html index d2b5a1e93..316ac5e7b 100755 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -83,8 +83,8 @@
  • View/Edit locales and tax rates - - Change tax rates by state, or break down a state into counties - and assign different tax rates to each county. + - Change tax rates, or break down a country into states, or a state + into counties and assign different tax rates to each.
  • View/Edit POPs -- cgit v1.2.1