summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2002-01-03 17:40:26 +0000
committerivan <ivan>2002-01-03 17:40:26 +0000
commit69a0a7504f84aa9bb1f204d1f3522e1520e0885e (patch)
treede4cb175a70c7a7da58f84454fd29dfca55bd249
parente3f87d761538a0a21d26fc86b5bce7c9d737d590 (diff)
more schema changes: part_bill_event and cust_bill_event tables
remove old 1.4.0pre READMEs
-rw-r--r--FS/FS/cust_bill_event.pm134
-rw-r--r--FS/FS/part_bill_event.pm132
-rw-r--r--FS/MANIFEST4
-rw-r--r--FS/t/cust_bill_event.t5
-rw-r--r--FS/t/part_bill_event.t5
-rw-r--r--README.1.4.0pre2-339
-rw-r--r--README.1.4.0pre3-423
-rw-r--r--README.1.4.0pre4567-819
-rwxr-xr-xbin/fs-setup28
-rw-r--r--httemplate/docs/schema.html16
-rw-r--r--httemplate/docs/upgrade8.html19
11 files changed, 361 insertions, 63 deletions
diff --git a/FS/FS/cust_bill_event.pm b/FS/FS/cust_bill_event.pm
new file mode 100644
index 000000000..910b4dead
--- /dev/null
+++ b/FS/FS/cust_bill_event.pm
@@ -0,0 +1,134 @@
+package FS::cust_bill_event;
+
+use strict;
+use vars qw( @ISA );
+use FS::Record qw( qsearch qsearchs );
+
+@ISA = qw(FS::Record);
+
+=head1 NAME
+
+FS::cust_bill_event - Object methods for cust_bill_event records
+
+=head1 SYNOPSIS
+
+ use FS::cust_bill_event;
+
+ $record = new FS::cust_bill_event \%hash;
+ $record = new FS::cust_bill_event { 'column' => 'value' };
+
+ $error = $record->insert;
+
+ $error = $new_record->replace($old_record);
+
+ $error = $record->delete;
+
+ $error = $record->check;
+
+=head1 DESCRIPTION
+
+An FS::cust_bill_event object represents an complete invoice event.
+FS::cust_bill_event inherits from FS::Record. The following fields are
+currently supported:
+
+=over 4
+
+=item eventnum - primary key
+
+=item invnum - invoice (see L<FS::cust_bill>)
+
+=item eventpart - event definition (see L<FS::part_bill_event>)
+
+=item _date - specified as a UNIX timestamp; see L<perlfunc/"time">. Also see
+L<Time::Local> and L<Date::Parse> for conversion functions.
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item new HASHREF
+
+Creates a new completed invoice event. To add the compelted invoice event 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 { 'cust_bill_event'; }
+
+=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 completed invoice event. 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('eventnum')
+ || $self->ut_number('invnum')
+ || $self->ut_number('eventpart')
+ || $self->ut_number('_date')
+ ;
+
+ return "Unknown invnum"
+ unless qsearchs( 'cust_bill' ,{ 'invnum' => $self->invnum } );
+
+ return "Unknown eventpart"
+ unless qsearchs( 'part_bill_event' ,{ 'eventpart' => $self->eventpart } );
+
+ ''; #no error
+}
+
+=back
+
+=head1 BUGS
+
+Far too early in the morning.
+
+=head1 SEE ALSO
+
+L<FS::part_bill_event>, L<FS::cust_bill>, L<FS::Record>, schema.html from the
+base documentation.
+
+=cut
+
+1;
+
diff --git a/FS/FS/part_bill_event.pm b/FS/FS/part_bill_event.pm
new file mode 100644
index 000000000..fb2c06ad4
--- /dev/null
+++ b/FS/FS/part_bill_event.pm
@@ -0,0 +1,132 @@
+package FS::part_bill_event;
+
+use strict;
+use vars qw( @ISA );
+use FS::Record qw( qsearch qsearchs );
+
+@ISA = qw(FS::Record);
+
+=head1 NAME
+
+FS::part_bill_event - Object methods for part_bill_event records
+
+=head1 SYNOPSIS
+
+ use FS::part_bill_event;
+
+ $record = new FS::part_bill_event \%hash;
+ $record = new FS::part_bill_event { 'column' => 'value' };
+
+ $error = $record->insert;
+
+ $error = $new_record->replace($old_record);
+
+ $error = $record->delete;
+
+ $error = $record->check;
+
+=head1 DESCRIPTION
+
+An FS::part_bill_event object represents an invoice event definition -
+a callback which is triggered when an invoice is a certain amount of time
+overdue. FS::part_bill_event inherits from
+FS::Record. The following fields are currently supported:
+
+=over 4
+
+=item eventpart - primary key
+
+=item payby - CARD, BILL, or COMP
+
+=item event - event name
+
+=item eventcode - event action
+
+=item seconds - how long after the invoice date events of this type are triggered
+
+=item disabled - Disabled flag, empty or `Y'
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item new HASHREF
+
+Creates a new invoice event definition. To add the example 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_bill_event'; }
+
+=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 invoice event definition. 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;
+
+ $self->ut_numbern('eventpart')
+ || $self->ut_enum('payby', [qw( CARD BILL COMP )] )
+ || $self->ut_text('event')
+ || $self->ut_anything('eventcode')
+ || $self->ut_number('seconds')
+ || $self->ut_enum('disabled', [ '', 'Y' ] )
+ ;
+}
+
+=back
+
+=head1 BUGS
+
+Alas.
+
+=head1 SEE ALSO
+
+L<FS::cust_bill>, L<FS::cust_bill_event>, L<FS::Record>, schema.html from the
+base documentation.
+
+=cut
+
+1;
+
diff --git a/FS/MANIFEST b/FS/MANIFEST
index 23a27d1d3..0a9205c7f 100644
--- a/FS/MANIFEST
+++ b/FS/MANIFEST
@@ -31,12 +31,14 @@ FS/cust_main.pm
FS/cust_main_county.pm
FS/cust_main_invoice.pm
FS/cust_pay.pm
+FS/cust_bill_event.pm
FS/cust_bill_pay.pm
FS/cust_pay_batch.pm
FS/cust_pkg.pm
FS/cust_refund.pm
FS/cust_credit_refund.pm
FS/cust_svc.pm
+FS/part_bill_event.pm
FS/part_pkg.pm
FS/part_pop_local.pm
FS/part_referral.pm
@@ -67,6 +69,7 @@ t/CGIwrapper.t
t/Conf.t
t/ConfItem.t
t/cust_bill.t
+t/cust_bill_event.t
t/cust_bill_pay.t
t/cust_bill_pkg.t
t/cust_credit.t
@@ -82,6 +85,7 @@ t/cust_refund.t
t/cust_svc.t
t/domain_record.t
t/nas.t
+t/part_bill_event.t
t/part_pkg.t
t/part_pop_local.t
t/part_referral.t
diff --git a/FS/t/cust_bill_event.t b/FS/t/cust_bill_event.t
new file mode 100644
index 000000000..0e2ca3e24
--- /dev/null
+++ b/FS/t/cust_bill_event.t
@@ -0,0 +1,5 @@
+BEGIN { $| = 1; print "1..1\n" }
+END {print "not ok 1\n" unless $loaded;}
+use FS::cust_bill_event;
+$loaded=1;
+print "ok 1\n";
diff --git a/FS/t/part_bill_event.t b/FS/t/part_bill_event.t
new file mode 100644
index 000000000..5626a9f97
--- /dev/null
+++ b/FS/t/part_bill_event.t
@@ -0,0 +1,5 @@
+BEGIN { $| = 1; print "1..1\n" }
+END {print "not ok 1\n" unless $loaded;}
+use FS::part_bill_event;
+$loaded=1;
+print "ok 1\n";
diff --git a/README.1.4.0pre2-3 b/README.1.4.0pre2-3
deleted file mode 100644
index eac5dae10..000000000
--- a/README.1.4.0pre2-3
+++ /dev/null
@@ -1,39 +0,0 @@
-the following is necessary to upgrade from 1.4.0pre2 to pre3 or later.
-
-install the perl modules and httemplate as per install.html or upgrade8.html
-
-CREATE TABLE part_svc_column (
- columnnum int primary key,
- svcpart int not null,
- columnname varchar(64) not null,
- columnvalue varchar(80) null,
- columnflag char(1) null
-);
-
-CREATE UNIQUE INDEX part_svc_column1 ON part_svc_column ( svcpart, columnname );
-
-CREATE TABLE queue (
- jobnum int primary key,
- job varchar not null,
- _date int not null,
- status varchar(80) not null
-);
-
-CREATE TABLE queue_arg (
- argnum int primary key,
- jobnum int not null,
- arg varchar null
-);
-
-CREATE INDEX queue_arg1 ON queue_arg ( jobnum );
-
-Run bin/dbdef-create
-
-Run bin/fs-migrate-part_svc
-
-Create the `/usr/local/etc/freeside/cache.<i>datasrc</i>' directory
- (ownded by the freeside user).
-
-freeside-queued was installed with the Perl modules. Start it now and ensure
-that it is run upon system startup.
-
diff --git a/README.1.4.0pre3-4 b/README.1.4.0pre3-4
deleted file mode 100644
index 0027d3450..000000000
--- a/README.1.4.0pre3-4
+++ /dev/null
@@ -1,23 +0,0 @@
-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 INDEX part_pop_local1 ON part_pop_local ( npa, nxx );
-ALTER TABLE cust_pkg ADD manual_flag char(1) NULL;
-ALTER TABLE cust_pay_batch ADD paybatchnum integer;
-CREATE UNIQUE INDEX cust_pay_batch_pkey ON cust_pay_batch ( paybatchnum );
-ALTER TABLE part_pkg ADD plan varchar NULL;
-ALTER TABLE part_pkg ADD plandata varchar NULL;
-ALTER TABLE part_pkg ADD setuptax char(1) NULL;
-ALTER TABLE part_pkg ADD recurtax char(1) NULL;
-
-Run bin/dbdef-create
-
diff --git a/README.1.4.0pre4567-8 b/README.1.4.0pre4567-8
index 2e2138b37..e567120a9 100644
--- a/README.1.4.0pre4567-8
+++ b/README.1.4.0pre4567-8
@@ -5,6 +5,25 @@ 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 (
+ eventnum int primary key,
+ invnum int not null,
+ eventpart int not null,
+ _date int not null,
+);
+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 (
+ eventpart int primary key,
+ payby char(4) not null,
+ event varchar(80) not null,
+ eventcode text null,
+ seconds int null,
+ disabled char(1) null,
+);
+CREATE INDEX part_bill_events1 ON part_bill_events ( payby );
+
Run bin/dbdef-create
Restart Apache and freeside-queued
diff --git a/bin/fs-setup b/bin/fs-setup
index e7aa3b0d9..c7335a8fb 100755
--- a/bin/fs-setup
+++ b/bin/fs-setup
@@ -1,6 +1,6 @@
#!/usr/bin/perl -Tw
#
-# $Id: fs-setup,v 1.68 2001-12-27 09:26:13 ivan Exp $
+# $Id: fs-setup,v 1.69 2002-01-03 17:40:26 ivan Exp $
#to delay loading dbdef until we're ready
BEGIN { $FS::Record::setup_hack = 1; }
@@ -299,6 +299,32 @@ sub tables_hash_hack {
'index' => [ ['custnum'] ],
},
+ 'cust_bill_event' => {
+ 'columns' => [
+ 'eventnum', 'int', '', '',
+ 'invnum', 'int', '', '',
+ 'eventpart', 'int', '', '',
+ '_date', @date_type,
+ ],
+ 'primary_key' => 'eventnum',
+ 'unique' => [ [ 'eventpart', 'invnum' ] ],
+ 'index' => [ ['invnum'] ],
+ },
+
+ 'part_bill_event' => {
+ 'columns' => [
+ 'eventpart', 'int', '', '',
+ 'payby', 'int', '', '',
+ 'event', 'varchar', '', $char_d,
+ 'eventcode', @perl_type,
+ 'seconds', 'int', 'NULL', '',
+ 'disabled', 'char', 'NULL', 1,
+ ],
+ 'primary_key' => 'eventpart',
+ 'unique' => [ [] ],
+ 'index' => [ ['payby'] ],
+ },
+
'cust_bill_pkg' => {
'columns' => [
'pkgnum', 'int', '', '',
diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html
index 9f00d48b1..a51bf6e68 100644
--- a/httemplate/docs/schema.html
+++ b/httemplate/docs/schema.html
@@ -25,6 +25,22 @@
<li>charged - amount of this invoice
<li>printed - how many times this invoice has been printed automatically
</ul>
+ <li><a name="cust_bill_event" href="man/FS/cust_bill_event.html">cust_bill_event</a> - Invoice event history
+ <ul>
+ <li>eventnum - primary key
+ <li>invnum - <a href="#cust_bill">invoice</a>
+ <li>eventpart - <a href="#part_bill_event">event definition</a>
+ <li>_date
+ </ul>
+ <li><a name="part_bill_event" href="man/FS/part_bill_event.html">part_bill_event</a> - Invoice event definitions
+ <ul>
+ <li>eventpart - primary key
+ <li>payby - CARD, BILL, or COMP
+ <li>event - event name
+ <li>eventcode - event action
+ <li>seconds - how long after the invoice date (<a href="#cust_bill">cust_bill</a>._date) events of this type are triggered
+ <li>disabled - Disabled flag, empty or `Y'
+ </ul>
<li><a name="cust_bill_pkg" href="man/FS/cust_bill_pkg.html">cust_bill_pkg</a> - Invoice line items
<ul>
<li>invnum - (multiple) key
diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html
index 0855e6dee..13830dc6c 100644
--- a/httemplate/docs/upgrade8.html
+++ b/httemplate/docs/upgrade8.html
@@ -124,6 +124,25 @@ CREATE TABLE part_pop_local (
);
CREATE UNIQUE INDEX part_pop_local1 ON part_pop_local ( npa, nxx );
+CREATE TABLE cust_bill_event (
+ eventnum int primary key,
+ invnum int not null,
+ eventpart int not null,
+ _date int not null,
+);
+CREATE UNIQUE INDEX cust_bill_event1 ON cust_bill_event ( eventpart, invnum );
+CREATE INDEX cust_bill_event2 ON cust_bill_event ( invnum );
+
+CREATE TABLE part_bill_event (
+ eventpart int primary key,
+ payby char(4) not null,
+ event varchar(80) not null,
+ eventcode text null,
+ seconds int null,
+ disabled char(1) null,
+);
+CREATE INDEX part_bill_event1 ON part_bill_event ( payby );
+
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;