This commit was generated by cvs2svn to compensate for changes in r8593,
[freeside.git] / FS / FS / cust_credit_bill_pkg.pm
index 98521d6..8b01cd2 100644 (file)
@@ -2,9 +2,14 @@ package FS::cust_credit_bill_pkg;
 
 use strict;
 use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
+use FS::Record qw( qsearchs ); # qsearch );
+use FS::cust_main_Mixin;
+use FS::cust_credit_bill;
+use FS::cust_bill_pkg;
+use FS::cust_bill_pkg_tax_location;
+use FS::cust_bill_pkg_tax_rate_location;
 
-@ISA = qw(FS::Record);
+@ISA = qw( FS::cust_main_Mixin FS::Record );
 
 =head1 NAME
 
@@ -34,7 +39,7 @@ The following fields are currently supported:
 
 =over 4
 
-=item creditbillpkg -  primary key
+=item creditbillpkgnum -  primary key
 
 =item creditbillnum - Credit application to the overall invoice (see L<FS::cust_credit::bill>)
 
@@ -44,8 +49,15 @@ The following fields are currently supported:
 
 =item setuprecur - 'setup' or 'recur', designates whether the payment was applied to the setup or recurring portion of the line item.
 
+=item sdate - starting date of recurring fee
+
+=item edate - ending date of recurring fee
+
 =back
 
+sdate and edate are specified as UNIX timestamps; see L<perlfunc/"time">.  Also
+see L<Time::Local> and L<Date::Parse> for conversion functions.
+
 =head1 METHODS
 
 =over 4
@@ -107,14 +119,27 @@ sub check {
     $self->ut_numbern('creditbillpkgnum')
     || $self->ut_foreign_key('creditbillnum', 'cust_credit_bill', 'creditbillnum')
     || $self->ut_foreign_key('billpkgnum', 'cust_bill_pkg', 'billpkgnum' )
+    || $self->ut_foreign_keyn('billpkgtaxlocationnum',
+                              'cust_bill_pkg_tax_location',
+                              'billpkgtaxlocationnum')
+    || $self->ut_foreign_keyn('billpkgtaxratelocationnum',
+                              'cust_bill_pkg_tax_rate_location',
+                              'billpkgtaxratelocationnum')
     || $self->ut_money('amount')
     || $self->ut_enum('setuprecur', [ 'setup', 'recur' ] )
+    || $self->ut_numbern('sdate')
+    || $self->ut_numbern('edate')
   ;
   return $error if $error;
 
   $self->SUPER::check;
 }
 
+sub cust_credit_bill {
+  my $self = shift;
+  qsearchs('cust_credit_bill', { 'creditbillnum' => $self->creditbillnum } );
+}
+
 =back
 
 =head1 BUGS