diff options
author | ivan <ivan> | 2002-01-03 17:40:26 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-01-03 17:40:26 +0000 |
commit | 69a0a7504f84aa9bb1f204d1f3522e1520e0885e (patch) | |
tree | de4cb175a70c7a7da58f84454fd29dfca55bd249 /FS | |
parent | e3f87d761538a0a21d26fc86b5bce7c9d737d590 (diff) |
more schema changes: part_bill_event and cust_bill_event tables
remove old 1.4.0pre READMEs
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cust_bill_event.pm | 134 | ||||
-rw-r--r-- | FS/FS/part_bill_event.pm | 132 | ||||
-rw-r--r-- | FS/MANIFEST | 4 | ||||
-rw-r--r-- | FS/t/cust_bill_event.t | 5 | ||||
-rw-r--r-- | FS/t/part_bill_event.t | 5 |
5 files changed, 280 insertions, 0 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"; |