part_export schema changes
authorivan <ivan>
Mon, 28 Jan 2002 05:15:29 +0000 (05:15 +0000)
committerivan <ivan>
Mon, 28 Jan 2002 05:15:29 +0000 (05:15 +0000)
FS/FS/part_export.pm [new file with mode: 0644]
FS/FS/part_export_option.pm [new file with mode: 0644]
README.1.4.0pre4567-8
bin/fs-setup
httemplate/docs/schema.html
httemplate/docs/upgrade8.html

diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm
new file mode 100644 (file)
index 0000000..67371bc
--- /dev/null
@@ -0,0 +1,138 @@
+package FS::part_export;
+
+use strict;
+use vars qw( @ISA );
+use FS::Record qw( qsearch qsearchs );
+use FS::part_svc;
+
+@ISA = qw(FS::Record);
+
+=head1 NAME
+
+FS::part_export - Object methods for part_export records
+
+=head1 SYNOPSIS
+
+  use FS::part_export;
+
+  $record = new FS::part_export \%hash;
+  $record = new FS::part_export { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+=head1 DESCRIPTION
+
+An FS::part_export object represents an export of Freeside data to an external
+provisioning system.  FS::part_export inherits from FS::Record.  The following
+fields are currently supported:
+
+=over 4
+
+=item eventpart - primary key
+
+=item svcpart - Service definition (see L<FS::part_svc>) to which this export applies
+
+=item machine - Machine name 
+
+=item exporttype - Export type
+
+=item nodomain - blank or "Y" : usernames are exported to this service with no domain
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item new HASHREF
+
+Creates a new export.  To add the export to the database, see L<"insert">.
+
+Note that this stores the hash reference, not a distinct copy of the hash it
+points to.  You can ask the object for a copy with the I<hash> method.
+
+=cut
+
+# the new method can be inherited from FS::Record, if a table method is defined
+
+sub table { 'part_export'; }
+
+=item insert
+
+Adds this record to the database.  If there is an error, returns the error,
+otherwise returns false.
+
+=cut
+
+# the insert method can be inherited from FS::Record
+
+=item delete
+
+Delete this record from the database.
+
+=cut
+
+# the delete method can be inherited from FS::Record
+
+=item replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database.  If there is an error,
+returns the error, otherwise returns false.
+
+=cut
+
+# the replace method can be inherited from FS::Record
+
+=item check
+
+Checks all fields to make sure this is a valid export.  If there is
+an error, returns the error, otherwise returns false.  Called by the insert
+and replace methods.
+
+=cut
+
+sub check {
+  my $self = shift;
+  my $error = 
+    $self->ut_numbern('exportnum')
+    || $self->ut_number('svcpart')
+    || $self->ut_alpha('exporttype')
+  ;
+  return $error if $error;
+
+  return "Unknown svcpart: ". $self->svcpart
+    unless qsearchs( 'part_svc', { 'svcpart' => $self->svcpart } );
+
+  $self->machine =~ /^([\w\-\.]*)$/
+    or return "Illegal machine: ". $self->machine;
+  $self->machine($1);
+
+  $self->nodomain =~ /^(Y?)$/ or return "Illegal nodomain: ". $self->nodomain;
+  $self->nodomain($1);
+
+  #check exporttype?
+
+  ''; #no error
+}
+
+=back
+
+=head1 BUGS
+
+Probably.
+
+=head1 SEE ALSO
+
+L<FS::part_export_option>, L<FS::part_svc>, L<FS::svc_acct>, L<FS::svc_domain>,
+L<FS::svc_forward>, L<FS::Record>, schema.html from the base documentation.
+
+=cut
+
+1;
+
diff --git a/FS/FS/part_export_option.pm b/FS/FS/part_export_option.pm
new file mode 100644 (file)
index 0000000..4ce70b4
--- /dev/null
@@ -0,0 +1,134 @@
+package FS::part_export_option;
+
+use strict;
+use vars qw( @ISA );
+use FS::Record qw( qsearch qsearchs );
+use FS::part_export;
+
+@ISA = qw(FS::Record);
+
+=head1 NAME
+
+FS::part_export_option - Object methods for part_export_option records
+
+=head1 SYNOPSIS
+
+  use FS::part_export_option;
+
+  $record = new FS::part_export_option \%hash;
+  $record = new FS::part_export_option { 'column' => 'value' };
+
+  $error = $record->insert;
+
+  $error = $new_record->replace($old_record);
+
+  $error = $record->delete;
+
+  $error = $record->check;
+
+=head1 DESCRIPTION
+
+An FS::part_export_option object represents an export option.
+FS::part_export_option inherits from FS::Record.  The following fields are
+currently supported:
+
+=over 4
+
+=item optionnum - primary key
+
+=item exportnum - export (see L<FS::part_export>)
+
+=item option - option name
+
+=item opeionvalue - option value
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item new HASHREF
+
+Creates a new export option.  To add the export option to the database, see
+L<"insert">.
+
+Note that this stores the hash reference, not a distinct copy of the hash it
+points to.  You can ask the object for a copy with the I<hash> method.
+
+=cut
+
+# the new method can be inherited from FS::Record, if a table method is defined
+
+sub table { 'part_export_option'; }
+
+=item insert
+
+Adds this record to the database.  If there is an error, returns the error,
+otherwise returns false.
+
+=cut
+
+# the insert method can be inherited from FS::Record
+
+=item delete
+
+Delete this record from the database.
+
+=cut
+
+# the delete method can be inherited from FS::Record
+
+=item replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database.  If there is an error,
+returns the error, otherwise returns false.
+
+=cut
+
+# the replace method can be inherited from FS::Record
+
+=item check
+
+Checks all fields to make sure this is a valid export option.  If there is
+an error, returns the error, otherwise returns false.  Called by the insert
+and replace methods.
+
+=cut
+
+# the check method should currently be supplied - FS::Record contains some
+# data checking routines
+
+sub check {
+  my $self = shift;
+
+  my $error = 
+    $self->ut_numbern('optionnum')
+    || $self->ut_number('exportnum')
+    || $self->ut_alpha('option')
+    || $self->ut_textn('optionvalue')
+  ;
+  return $error if $error;
+
+  return "Unknown exportnum: ". $self->exportnum
+    unless qsearchs('part_export', { 'exportnum' => $self->exportnum } );
+
+  #check options & values?
+
+  ''; #no error
+}
+
+=back
+
+=head1 BUGS
+
+Possibly.
+
+=head1 SEE ALSO
+
+L<FS::part_export>, L<FS::Record>, schema.html from the base documentation.
+
+=cut
+
+1;
+
index e567120..57474fe 100644 (file)
@@ -1,11 +1,19 @@
 the following is necessary to upgrade from 1.4.0pre (4 thru 7) to 1.4.0pre8
 
+if you're upgrading from 1.3.1 follow the instructions in
+httemplate/docs/upgrade8.html instead
+
+if you're upgradeing from before 1.4.0pre4, see
+http://cleanwhisker.420.am/cgi-bin/cvsweb/freeside/Attic/
+
+-----
+
 install the perl modules and httemplate as per install.html or upgrade8.html
 
 ALTER TABLE part_pkg ADD disabled char(1) NULL;
 ALTER TABLE part_svc ADD disabled char(1) NULL;
 
-CREATE TABLE cust_bill_events (
+CREATE TABLE cust_bill_event (
   eventnum int primary key,
   invnum int not null,
   eventpart int not null,
@@ -14,7 +22,7 @@ CREATE TABLE cust_bill_events (
 CREATE UNIQUE INDEX cust_bill_events1 ON cust_bill_events ( eventpart, invnum );
 CREATE INDEX cust_bill_events2 ON cust_bill_events ( invnum );
 
-CREATE TABLE part_bill_events (
+CREATE TABLE part_bill_event (
   eventpart int primary key,
   payby char(4) not null,
   event varchar(80) not null,
@@ -24,6 +32,25 @@ CREATE TABLE part_bill_events (
 );
 CREATE INDEX part_bill_events1 ON part_bill_events ( payby );
 
+CREATE TABLE part_export (
+  exportnum int primary key,
+  svcpart int not null,
+  machine varchar(80) not null,
+  exporttype varchar(80) not null,
+  nodomain char(1) NULL
+);
+CREATE INDEX part_export1 ON part_export ( machine );
+CREATE INDEX part_export2 ON part_export ( exporttype );
+
+CREATE INDEX part_export_option (
+  optionnum int primary key,
+  exportnum int not null,
+  option varchar(80) not null,
+  optionvalue text NULL
+);
+CREATE INDEX part_export_option1 ON part_export ( exportnum );
+CREATE INDEX part_export_option2 ON part_export ( option );
+
 Run bin/dbdef-create
 
 Restart Apache and freeside-queued
index c7335a8..5b82eaf 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: fs-setup,v 1.69 2002-01-03 17:40:26 ivan Exp $
+# $Id: fs-setup,v 1.70 2002-01-28 05:15:28 ivan Exp $
 
 #to delay loading dbdef until we're ready
 BEGIN { $FS::Record::setup_hack = 1; }
@@ -842,6 +842,32 @@ sub tables_hash_hack {
       'unique'      => [],
       'index'       => [ [ 'jobnum' ] ],
     },
+
+    'part_export' => {
+      'columns' => [
+        'exportnum', 'int', '', '',
+        'svcpart',   'int', '', '',
+        'machine', 'varchar', '', $char_d,
+        'exporttype', 'varchar', '', $char_d,
+        'nodomain',     'char', 'NULL', 1,
+      ],
+      'primary_key' => 'exportnum',
+      'unique'      => [],
+      'index'       => [ [ 'machine' ], [ 'exporttype' ] ],
+    },
+
+    'part_export_option' => {
+      'columns' => [
+        'optionnum', 'int', '', '',
+        'exportnum', 'int', '', '',
+        'option', 'varchar', '', $char_d,
+        'optionvalue', 'text', 'NULL', '',
+      ],
+      'primary_key' => 'optionnum',
+      'unique'      => [],
+      'index'       => [ [ 'exportnum' ], [ 'option' ] ],
+    },
+
   );
 
   %tables;
index a51bf6e..3e9189b 100644 (file)
         <li>svcpart - <a href="#part_svc">Service definition</a>
         <li>quantity - quantity of this service that this package includes
       </ul>
+    <li><a name="part_export" href="man/FS/part_export.html">part_export</a> - Export to external provisioning
+      <ul>
+        <li>exportnum - primary key
+        <li>svcpart - <a href="#part_svc">Service definition</a>
+        <li>machine - Machine name 
+        <li>exporttype - Export type
+        <li>nodomain - blank or Y: usernames are exported to this service with no domain
+      </ul>
+    <li><a name="part_export_option" href="man/FS/part_export_option.html">part_export_option</a> - provisioning options
+      <ul>
+        <li>optionnum - primary key
+        <li>exportnum - <a href="#part_export">Export</a>
+        <li>option - option name
+        <li>optionvalue - option value
+      </ul>
     <li><a name="port" href="man/FS/port.html">port</a> - individual port on a <a href="#nas">nas</a>
       <ul>
         <li>portnum - primary key
index 9046948..144242b 100644 (file)
@@ -143,6 +143,25 @@ CREATE TABLE part_bill_event (
 );
 CREATE INDEX part_bill_event1 ON part_bill_event ( payby );
 
+CREATE TABLE part_export (
+  exportnum int primary key,
+  svcpart int not null,
+  machine varchar(80) not null,
+  exporttype varchar(80) not null,
+  nodomain char(1) NULL
+);
+CREATE INDEX part_export1 ON part_export ( machine );
+CREATE INDEX part_export2 ON part_export ( exporttype );
+
+CREATE INDEX part_export_option (
+  optionnum int primary key,
+  exportnum int not null,
+  option varchar(80) not null,
+  optionvalue text NULL
+);
+CREATE INDEX part_export_option1 ON part_export ( exportnum );
+CREATE INDEX part_export_option2 ON part_export ( option );
+
 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;