add part_pop_local table
authorivan <ivan>
Wed, 26 Sep 2001 09:17:06 +0000 (09:17 +0000)
committerivan <ivan>
Wed, 26 Sep 2001 09:17:06 +0000 (09:17 +0000)
FS/FS.pm
FS/FS/cust_credit_bill.pm
FS/FS/cust_main.pm
FS/FS/part_pop_local.pm [new file with mode: 0644]
FS/FS/svc_acct_pop.pm
FS/MANIFEST
FS/t/part_pop_local.t [new file with mode: 0644]
README.1.4.0pre3-4
bin/fs-setup
httemplate/docs/schema.html
httemplate/docs/upgrade8.html

index d2f47d7..d2c07e4 100644 (file)
--- a/FS/FS.pm
+++ b/FS/FS.pm
@@ -34,6 +34,8 @@ L<FS::Record> - Database record base class
 L<FS::svc_acct_pop> - POP (Point of Presence, not Post
 Office Protocol) class
 
+L<FS::part_pop_local> - Local calling area class
+
 L<FS::part_referral> - Referral class
 
 L<FS::cust_main_county> - Locale (tax rate) class
@@ -139,7 +141,7 @@ The main documentation is in htdocs/docs.
 
 =head1 VERSION
 
-$Id: FS.pm,v 1.8 2001-09-11 00:08:18 ivan Exp $
+$Id: FS.pm,v 1.9 2001-09-26 09:17:06 ivan Exp $
 
 =head1 SUPPORT
 
index 9613408..8f992b5 100644 (file)
@@ -145,7 +145,7 @@ sub cust_credit {
 
 =head1 VERSION
 
-$Id: cust_credit_bill.pm,v 1.5 2001-09-11 00:08:18 ivan Exp $
+$Id: cust_credit_bill.pm,v 1.6 2001-09-26 09:17:06 ivan Exp $
 
 =head1 BUGS
 
@@ -153,7 +153,7 @@ The delete method.
 
 =head1 SEE ALSO
 
-L<FS::Record>, L<FS::cust_refund>, L<FS::cust_bill>, L<cust_credit>,
+L<FS::Record>, L<FS::cust_refund>, L<FS::cust_bill>, L<FS::cust_credit>,
 schema.html from the base documentation.
 
 =cut
index d791c13..0a7f1f7 100644 (file)
@@ -940,7 +940,7 @@ invoice_time - Use this time when deciding when to print invoices and
 late notices on those invoices.  The default is now.  It is specified as a UNIX timestamp; see L<perlfunc/"time">).  Also see L<Time::Local> and L<Date::Parse>
 for conversion functions.
 
-batch_card - Set this true to batch cards (see L<cust_pay_batch>).  By
+batch_card - Set this true to batch cards (see L<FS::cust_pay_batch>).  By
 default, cards are processed immediately, which will generate an error if
 CyberCash is not installed.
 
@@ -1724,7 +1724,7 @@ sub append_fuzzyfiles {
 
 =head1 VERSION
 
-$Id: cust_main.pm,v 1.37 2001-09-25 18:03:04 ivan Exp $
+$Id: cust_main.pm,v 1.38 2001-09-26 09:17:06 ivan Exp $
 
 =head1 BUGS
 
diff --git a/FS/FS/part_pop_local.pm b/FS/FS/part_pop_local.pm
new file mode 100644 (file)
index 0000000..0b7cdf6
--- /dev/null
@@ -0,0 +1,116 @@
+package FS::part_pop_local;
+
+use strict;
+use vars qw( @ISA );
+use FS::Record; # qw( qsearchs );
+
+@ISA = qw( FS::Record );
+
+=head1 NAME
+
+FS::part_pop_local - Object methods for part_pop_local records
+
+=head1 SYNOPSIS
+
+  use FS::part_pop_local;
+
+  $record = new FS::part_pop_local \%hash;
+  $record = new FS::part_pop_local { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+=head1 DESCRIPTION
+
+An FS::part_pop_local object represents a local call area.  Each
+FS::part_pop_local record maps a NPA/NXX (area code and exchange) to the POP
+(see L<FS::svc_acct_pop>) which is a local call.  FS::part_pop_local inherits
+from FS::Record.  The following fields are currently supported:
+
+=over 4
+
+=item localnum - primary key (assigned automatically for new accounts)
+
+=item popnum - see L<FS::svc_acct_pop>
+
+=item city
+
+=item state
+
+=item npa - area code
+
+=item nxx - exchange
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item new HASHREF
+
+Creates a new point of presence (if only it were that easy!).  To add the 
+point of presence to the database, see L<"insert">.
+
+=cut
+
+sub table { 'part_pop_local'; }
+
+=item insert
+
+Adds this point of presence to the database.  If there is an error, returns the
+error, otherwise returns false.
+
+=item delete
+
+Removes this point of presence from the database.
+
+=item replace OLD_RECORD
+
+Replaces OLD_RECORD with this one in the database.  If there is an error,
+returns the error, otherwise returns false.
+
+=item check
+
+Checks all fields to make sure this is a valid point of presence.  If there is
+an error, returns the error, otherwise returns false.  Called by the insert
+and replace methods.
+
+=cut
+
+sub check {
+  my $self = shift;
+
+    $self->ut_numbern('localnum')
+      or $self->ut_numbern('popnum')
+      or $self->ut_text('city')
+      or $self->ut_text('state')
+      or $self->ut_number('npa')
+      or $self->ut_number('nxx')
+  ;
+
+}
+
+=back
+
+=head1 VERSION
+
+$Id: part_pop_local.pm,v 1.1 2001-09-26 09:17:06 ivan Exp $
+
+=head1 BUGS
+
+US/CA-centric.
+
+=head1 SEE ALSO
+
+L<FS::Record>, L<FS::svc_acct_pop>, schema.html from the base documentation.
+
+=cut
+
+1;
+
index 5e755ef..8ce551c 100644 (file)
@@ -98,7 +98,7 @@ sub check {
 
 =head1 VERSION
 
-$Id: svc_acct_pop.pm,v 1.2 2000-01-28 22:55:06 ivan Exp $
+$Id: svc_acct_pop.pm,v 1.3 2001-09-26 09:17:06 ivan Exp $
 
 =head1 BUGS
 
@@ -106,7 +106,8 @@ It should be renamed to part_pop.
 
 =head1 SEE ALSO
 
-L<FS::Record>, L<svc_acct>, schema.html from the base documentation.
+L<FS::Record>, L<FS::svc_acct>, L<FS::part_pop_local>, schema.html from the
+base documentation.
 
 =cut
 
index b99250d..5af893a 100644 (file)
@@ -34,6 +34,7 @@ FS/cust_refund.pm
 FS/cust_credit_refund.pm
 FS/cust_svc.pm
 FS/part_pkg.pm
+FS/part_pop_local.pm
 FS/part_referral.pm
 FS/part_svc.pm
 FS/part_svc_column.pm
@@ -77,6 +78,7 @@ t/cust_svc.t
 t/domain_record.t
 t/nas.t
 t/part_pkg.t
+t/part_pop_local.t
 t/part_referral.t
 t/part_svc.t
 t/part_svc_column.t
diff --git a/FS/t/part_pop_local.t b/FS/t/part_pop_local.t
new file mode 100644 (file)
index 0000000..4e4ad17
--- /dev/null
@@ -0,0 +1,5 @@
+BEGIN { $| = 1; print "1..1\n" }
+END {print "not ok 1\n" unless $loaded;}
+use FS::part_pop_local;
+$loaded=1;
+print "ok 1\n";
index d2fcf7f..0ac8591 100644 (file)
@@ -2,5 +2,15 @@ the following is necessary to upgrade from 1.4.0pre3 to pre4 or later.
 
 install the perl modules and httemplate as per install.html or upgrade8.html
 
+CREATE TABLE part_pop_local (
+  localnum int primary key,
+  popnum int not null,
+  city varchar(80) null,
+  state char(2) null,
+  npa char(3) not null,
+  nxx char(3) not null
+);
+CREATE UNIQUE INDEX part_pop_local1 ON part_pop_local ( npa, nxx );
+
 Run bin/dbdef-create
 
index e7dda8e..52a2505 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: fs-setup,v 1.58 2001-09-11 22:20:28 ivan Exp $
+# $Id: fs-setup,v 1.59 2001-09-26 09:17:06 ivan Exp $
 
 #to delay loading dbdef until we're ready
 BEGIN { $FS::Record::setup_hack = 1; }
@@ -611,7 +611,21 @@ sub tables_hash_hack {
       ],
       'primary_key' => 'popnum',
       'unique' => [ [] ],
-      'index' => [ [] ],
+      'index' => [ [ 'state' ] ],
+    },
+
+    'part_pop_local' => {
+      'columns' => [
+        'localnum',  'int',     '',     '',
+        'popnum',    'int',     '',     '',
+        'city',      'varchar', 'NULL', $char_d,
+        'state',     'char',    'NULL', 2,
+        'npa',       'char',    '',     3,
+        'nxx',       'char',    '',     3,
+      ],
+      'primary_key' => 'popnum',
+      'unique' => [ [] ],
+      'index' => [ [ 'npa', 'nxx' ] ],
     },
 
     'svc_acct' => {
index e3fe980..c3cb514 100644 (file)
         <li>exch - exchange
         <li>loc - rest of number
       </ul>
+    <li><a name="part_pop_local" href="man/FS/part_pop_local.html">part_pop_local</a> - Local calling areas
+      <ul>
+        <li>localnum - primary key
+        <li>popnum - primary key
+        <li>city
+        <li>state
+        <li>npa - area code
+        <li>nxx - exchange
+      </ul>
     <li><a name="svc_acct_sm" href="man/FS/svc_acct_sm.html">svc_acct_sm</a> - <b>DEPRECIATED</b> Domain mail aliases
       <ul>
         <li>svcnum - <a href="#cust_svc">primary key</a>
index a179e96..747b8e2 100644 (file)
@@ -118,6 +118,16 @@ CREATE TABLE queue_arg (
 );
 CREATE INDEX queue_arg1 ON queue_arg ( jobnum );
 
+CREATE TABLE part_pop_local (
+  localnum int primary key,
+  popnum int not null,
+  city varchar(80) null,
+  state char(2) null,
+  npa char(3) not null,
+  nxx char(3) not null
+);
+CREATE UNIQUE INDEX part_pop_local1 ON part_pop_local ( npa, nxx );
+
 ALTER TABLE svc_acct ADD domsvc integer NOT NULL;
 ALTER TABLE svc_domain ADD catchall integer NULL;
 ALTER TABLE cust_main ADD referral_custnum integer NULL;