i18n! i18n!
authorivan <ivan>
Wed, 18 Nov 1998 09:01:44 +0000 (09:01 +0000)
committerivan <ivan>
Wed, 18 Nov 1998 09:01:44 +0000 (09:01 +0000)
15 files changed:
CREDITS
TODO
bin/fs-setup
htdocs/browse/cust_main_county.cgi
htdocs/docs/schema.html
htdocs/docs/upgrade3.html
htdocs/edit/cust_main.cgi
htdocs/edit/cust_main_county-expand.cgi
htdocs/edit/cust_main_county.cgi
htdocs/edit/process/cust_main_county-expand.cgi
htdocs/edit/process/cust_main_county.cgi
htdocs/index.html
site_perl/cust_main.pm
site_perl/cust_main_county.pm
site_perl/cust_pay_batch.pm

diff --git a/CREDITS b/CREDITS
index 87c79a7..4e13c72 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -1,14 +1,21 @@
 Thanks to Matt Simerson <matt@michweb.net> of MichWeb Inc. for documentation
-and pre-release testing.  Without his help the documentation in the first
+and pre-release testing.  Without his help the documentation in 1.0.0
 release would have consisted of a single screenfull of text.
 
-# Steve Cleff <cleff@yahoo.com> did the default background image and is also
-# the creator of Freeside's mascot, Snakeman.
+Steve Cleff <cleff@yahoo.com> did the default background image in 1.0.x and
+is also the creator of Freeside's elusive mascot, Snakeman.
 
-Jerry St. Pierre <jstpi@city.timmins.on.ca> did the "SISD" graphic.
+Jerry St. Pierre <jstpi@city.timmins.on.ca> did the "SISD" graphic used in
+1.0.x and most of 1.1.x.
 
 Brian McCane? <bmccane@maxbaud.net> contributed PostgreSQL support, HTML
 style enhancements and many, many bugfixes.
 
+CompleteHOST, Inc. (http://www.completehost.com) funded the development of the
+following Freeside features:
+  - Multiple, separate databases and configurations on one box.
+  - Per-customer pricing (packages)
+  - Integration with Radiator, http://www.open.com.au/radiator
+  - Integration with NetSurfer NetKit ISP, http://www.netsurfer.com/
 Everything else is my (Ivan Kohler <ivan@sisd.com>) fault.
 
diff --git a/TODO b/TODO
index 1d21d81..0e70ba4 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-$Id: TODO,v 1.13 1998-11-13 09:56:33 ivan Exp $
+$Id: TODO,v 1.14 1998-11-18 09:01:30 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,6 +6,8 @@ duplication of effort.
 
 -- 1.1.x --
 
+test and document libapache-dbi-logger (woo!)
+
 remove whois_hack set to 1 for svc_domain.pm?  add all known registries and
 whois accordingly.
 
@@ -254,22 +256,14 @@ write batch senders and batch parsers for the different credit card processors
 people use/
 More CC processors/methods.
 
-In FS::Record, the counter dir should have .datasrc appended to it like the 
-dbdef does, which should place all the (most of) the DB metadata in unique 
-files and let me run concurrent .datasrc's.  Maybe do something similar for 
-user, password and datasrc itself? (or something to get the out of the source
-files) and then we're set. (secrets file also needs .datasrc appended, or maybe
-"/var/spool/freeside".datasrc
-
 you should be able to fiddle the setup date in cust_pkg. (at least initially)
 
-cych v3 and v2 support
-
 delete options in administration section
 
 write a generic batch senders and batch parsers.
 
-need a way to override svc_acct export on a per-machine basis; just use config files based on machine name i suppose; document that.
+need a way to override svc_acct export on a per-machine basis; just use config files based on machine name i suppose; document that. (no, import desync_hosts
+type stuff from cerkit)
 
 you should be able to get column types as a method against an FS::Record object
 as well as dbdef->table($table)->column($column)->type
index aab24b7..b3fc5c5 100755 (executable)
 # fix radius attributes ivan@sisd.com 98-sep-27
 #
 # $Log: fs-setup,v $
-# Revision 1.6  1998-11-15 13:18:02  ivan
+# Revision 1.7  1998-11-18 09:01:31  ivan
+# i18n! i18n!
+#
+# Revision 1.6  1998/11/15 13:18:02  ivan
 # remove debugging
 #
 # Revision 1.5  1998/11/15 09:43:03  ivan
@@ -191,6 +194,8 @@ foreach  ($dbdef->tables) {
 #not really sample data (and shouldn't default to US)
 
 #cust_main_county
+
+#USPS state codes
 foreach ( qw(
 AL AK AS AZ AR CA CO CT DC DE FM FL GA GU HI ID IL IN IA KS KY LA
 ME MH MD MA MI MN MS MO MT NC ND NE NH NJ NM NV NY MP OH OK OR PA PW PR RI 
@@ -199,6 +204,29 @@ SC SD TN TX TT UT VT VI VA WA WV WI WY AE AA AP
   my($cust_main_county)=create FS::cust_main_county({
     'state' => $_,
     'tax'   => 0,
+    'country' => 'US',
+  });  
+  my($error);
+  $error=$cust_main_county->insert;
+  die $error if $error;
+}
+
+#ISO 2-letter country codes (same as country TLDs) except US
+foreach ( qw(
+AF AL DZ AS AD AO AI AQ AG AR AM AW AU AT AZ BS BH BD BB BY BE BZ BJ BM BT BO
+BA BW BV BR IO BN BG BF BI KH CM CA CV KY CF TD CL CN CX CC CO KM CG CK CR CI
+HR CU CY CZ DK DJ DM DO TP EC EG SV GQ ER EE ET FK FO FJ FI FR FX GF PF TF GA
+GM GE DE GH GI GR GL GD GP GU GT GN GW GY HT HM HN HK HU IS IN ID IR IQ IE IL
+IT JM JP JO KZ KE KI KP KR KW KG LA LV LB LS LR LY LI LT LU MO MK MG MW MY MV
+ML MT MH MQ MR MU YT MX FM MD MC MN MS MA MZ MM NA NR NP NL AN NC NZ NI NE NG
+NU NF MP NO OM PK PW PA PG PY PE PH PN PL PT PR QA RE RO RU RW KN LC VC WS SM
+ST SA SN SC SL SG SK SI SB SO ZA GS ES LK SH PM SD SR SJ SZ SE CH SY TW TJ TZ
+TH TG TK TO TT TN TR TM TC TV UG UA AE GB UM UY UZ VU VA VE VN VG VI WF EH
+YE YU ZR ZM ZW
+) ) {
+  my($cust_main_county)=create FS::cust_main_county({
+    'tax'   => 0,
+    'country' => $_,
   });  
   my($error);
   $error=$cust_main_county->insert;
@@ -302,7 +330,9 @@ sub tables_hash_hack {
       'columns' => [
         'custnum',  'int',  '',     '',
         'agentnum', 'int',  '',     '',
+        'titlenum', 'int',  'NULL',   '',
         'last',     'varchar', '',     $char_d,
+        'middle',   'varchar', 'NULL', $char_d,
         'first',    'varchar', '',     $char_d,
         'ss',       'char', 'NULL', 11,
         'company',  'varchar', 'NULL', $char_d,
@@ -310,7 +340,7 @@ sub tables_hash_hack {
         'address2', 'varchar', 'NULL', $char_d,
         'city',     'varchar', '',     $char_d,
         'county',   'varchar', 'NULL', $char_d,
-        'state',    'char', '',     2,
+        'state',    'varchar', '',     $char_d,
         'zip',      'varchar', '',     10,
         'country',  'char', '',     2,
         'daytime',  'varchar', 'NULL', 20,
@@ -330,13 +360,14 @@ sub tables_hash_hack {
       'index' => [ ['last'], ],
     },
 
-    'cust_main_county' => { #county+state are checked off the cust_main_county
-                            #table for validation and to provide a tax rate.
-                            #add country?
+    'cust_main_county' => { #county+state+country are checked off the
+                            #cust_main_county for validation and to provide
+                            # a tax rate.
       'columns' => [
         'taxnum',   'int',   '',    '',
-        'state',    'char',  '',    2,  #two letters max in US... elsewhere?
+        'state',    'char',  'NULL',    $char_d,
         'county',   'varchar',  'NULL',    $char_d,
+        'country',  'char',  '', 2, 
         'tax',      'real',  '',    '', #tax %
       ],
       'primary_key' => 'taxnum',
@@ -444,6 +475,16 @@ sub tables_hash_hack {
       'index' => [ [] ],
     },
 
+    'part_title' => {
+      'columns' => [
+        'titlenum',   'int',    '',   '',
+        'title',      'varchar',   '',   $char_d,
+      ],
+      'primary_key' => 'titlenum',
+      'unique' => [ [] ],
+      'index' => [ [] ],
+    },
+
     'pkg_svc' => {
       'columns' => [
         'pkgpart',    'int',    '',   '',
index d615198..4defa57 100755 (executable)
@@ -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",
 )),<<END;
-    <BR>Click on <u>expand</u> to specify tax rates by county.
-    <P><TABLE BORDER>
+    Click on <u>expand country</u> to specify a country's tax rates by state.
+    <BR>Click on <u>expand state</u> to specify a state's tax rates by county.
+    <BR><BR>
+END
+print 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>
@@ -39,15 +48,26 @@ 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->{county}
-      ? $hashref->{county}
+  print "<TD>", $hashref->{state}
+      ? $hashref->{state}
       : qq!(ALL) <FONT SIZE=-1>!.
-        qq!<A HREF="../edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
-        qq!">expand</A></FONT>!
+        qq!<A HREF="!. popurl(2). qq!/edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
+        qq!">expand country</A></FONT>!
     , "</TD>";
+  print "<TD>";
+  if ( $hashref->{county} ) {
+    print $hashref->{county};
+  } else {
+    print "(ALL)";
+    if ( $hashref->{state} ) {
+      print qq!<FONT SIZE=-1>!.
+          qq!<A HREF="!. popurl(2). qq!/edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
+          qq!">expand state</A></FONT>!;
+    }
+  }
+  print "</TD>";
 
   print <<END;
         <TD>$hashref->{tax}%</TD>
index 5a296ec..f7a9bc1 100644 (file)
@@ -50,7 +50,9 @@
         <li>custnum - primary key
         <li>agentnum - <a href="#agent">agent</a>
         <li>refnum - <a href="#part_referral">referral</a>
+        <li>titlenum - <a href="#part_title">title</a>
         <li>first - name
+        <li>middle - name
         <li>last - name
         <li>ss - social security number
         <li>company
@@ -75,6 +77,7 @@
         <li>taxnum - primary key
         <li>state
         <li>county
+        <li>country
         <li>tax - % rate
       </ul>
     <li><a name="cust_pay">cust_pay</a> - Payments
         <li><i>table</i>__<i>field</i> - Default or fixed value for <i>field</i> in <i>table</i>
         <li><i>table</i>__<i>field</i>_flag - null, D or F
       </ul>
+    <li><a name="part_title">part_title</a> - Personal titles
+      <ul>
+        <li>titlenum - primary key
+        <li>title - personal title (`Dr.' or `Mr.')
+      </ul>
     <li><a name="pkg_svc">pkg_svc</a>
       <ul>
         <li>pkgpart - <a href="#part_pkg">Package definition</a>
index bfb717c..1506642 100644 (file)
   <li>Move /var/spool/freeside/dbdef.<i>datasrc</i> to /usr/local/etc/freeside/dbdef.<i>datasrc</i>.
   <li>Move /var/spool/freeside/counters to /usr/local/etc/freeside/counters.<i>datasrc</i>.
   <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 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)
+);
+</pre>
+  <li>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.
   <li>Copy or symlink htdocs and site_perl to the new copies.
 </body>
index 1455601..fd36ab7 100755 (executable)
@@ -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>
 
index 59ff704..9b68799 100755 (executable)
@@ -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>
index 904d583..96574f0 100755 (executable)
@@ -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)'
index a821560..c70d5b9 100755 (executable)
@@ -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
 #
 # 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");
 
index 58eaa63..ce5a4f6 100755 (executable)
@@ -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");
 
index d2b5a1e..316ac5e 100755 (executable)
@@ -83,8 +83,8 @@
           <LI><A HREF="browse/cust_main_county.cgi">
             View/Edit locales and tax rates
           </A>
-            - 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.
           <BR>
           <LI><A HREF="browse/svc_acct_pop.cgi">
             View/Edit POPs 
index 51c9519..57e76ba 100644 (file)
@@ -283,21 +283,24 @@ sub check {
     $self->ss("$1-$2-$3");
   }
 
-  return "Unknown state/county/country, state ".
-      "\"". $self->state. "\" county \"". $self->county. "\""
-    unless qsearchs('cust_main_county',{
-      'state'  => $self->state,
-      'county' => $self->county,
-    } );
+  $self->country =~ /^(\w\w)$/ or return "Illegal country";
+  $self->country($1);
+  unless ( qsearchs('cust_main_county', {
+    'country' => $self->country,
+    'state'   => '',
+   } ) ) {
+    return "Unknown state/county/country"
+      #" state ". $self->state. " county ". $self->county. " country ". $self->country
+      unless qsearchs('cust_main_county',{
+        'state'   => $self->state,
+        'county'  => $self->county,
+        'country' => $self->country,
+      } );
+  }
 
-  #int'l zips?
-  $self->zip =~ /^(\d{5}(-\d{4})?)$/ or return "Illegal zip";
+  $self->zip =~ /^([\w\-]{10})$/ or return "Illegal zip";
   $self->zip($1);
 
-  #int'l countries!
-  $self->country =~ /^(US)$/ or return "Illegal country";
-  $self->country($1);
-
   $self->payby =~ /^(CARD|BILL|COMP)$/ or return "Illegal payby";
   $self->payby($1);
 
@@ -873,7 +876,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.5  1998-11-15 11:23:14  ivan
+Revision 1.6  1998-11-18 09:01:42  ivan
+i18n! i18n!
+
+Revision 1.5  1998/11/15 11:23:14  ivan
 use FS::table_name for all searches to eliminate warnings,
 emit state/county when they don't match
 
index f4b4595..9c81406 100644 (file)
@@ -41,6 +41,8 @@ currently supported:
 
 =item county
 
+=item country
+
 =item tax - percentage
 
 =back
@@ -126,7 +128,7 @@ sub check {
   my($recref) = $self->hashref;
 
   $self->ut_numbern('taxnum')
-    or $self->ut_text('state')
+    or $self->ut_textn('state')
     or $self->ut_textn('county')
     or $self->ut_float('tax')
   ;
@@ -135,12 +137,14 @@ sub check {
 
 =back
 
+=head1 VERSION
+
+$Id: cust_main_county.pm,v 1.2 1998-11-18 09:01:43 ivan Exp $
+
 =head1 BUGS
 
 It doesn't properly override FS::Record yet.
 
-A country field (and possibly a currency field) should be added.
-
 =head1 SEE ALSO
 
 L<FS::Record>, L<FS::cust_main>, L<FS::cust_bill>, schema.html from the base
@@ -155,6 +159,11 @@ Changed check for 'tax' to use the new ut_float subroutine
 
 pod ivan@sisd.com 98-sep-21
 
+$Log: cust_main_county.pm,v $
+Revision 1.2  1998-11-18 09:01:43  ivan
+i18n! i18n!
+
+
 =cut
 
 1;
index 186b4c1..f40a049 100644 (file)
@@ -216,12 +216,10 @@ sub check {
     $self->payname($1);
   }
 
-  #int'l zips?
-  $self->zip =~ /^(\d{5}(-\d{4})?)$/ or return "Illegal zip";
+  $self->zip =~ /^([\w\-]{10})$/ or return "Illegal zip";
   $self->zip($1);
 
-  #int'l countries!
-  $self->country =~ /^(US)$/ or return "Illegal country";
+  $self->country =~ /^(\w\w)$/ or return "Illegal \w\wy";
   $self->country($1);
 
   #check invnum, custnum, ?
@@ -233,12 +231,10 @@ sub check {
 
 =head1 VERSION
 
-$Id: cust_pay_batch.pm,v 1.1 1998-11-15 05:19:58 ivan Exp $
+$Id: cust_pay_batch.pm,v 1.2 1998-11-18 09:01:44 ivan Exp $
 
 =head1 BUGS
 
-The author forgot to customize this manpage.
-
 =head1 SEE ALSO
 
 L<FS::cust_main>, L<FS::Record>
@@ -251,7 +247,10 @@ added hfields
 ivan@sisd.com 97-nov-13
 
 $Log: cust_pay_batch.pm,v $
-Revision 1.1  1998-11-15 05:19:58  ivan
+Revision 1.2  1998-11-18 09:01:44  ivan
+i18n! i18n!
+
+Revision 1.1  1998/11/15 05:19:58  ivan
 long overdue
 
 Revision 1.3  1998/11/15 04:33:00  ivan