fix 'Can't call method svcdb without a package or object reference' when ordering...
[freeside.git] / FS / FS / cust_tax_exempt_pkg.pm
index 28fa243..e63b84b 100644 (file)
@@ -6,6 +6,7 @@ use FS::Record qw( qsearch qsearchs );
 use FS::cust_main_Mixin;
 use FS::cust_bill_pkg;
 use FS::cust_main_county;
 use FS::cust_main_Mixin;
 use FS::cust_bill_pkg;
 use FS::cust_main_county;
+use FS::cust_credit_bill_pkg;
 
 @ISA = qw( FS::cust_main_Mixin FS::Record );
 
 
 @ISA = qw( FS::cust_main_Mixin FS::Record );
 
@@ -56,8 +57,8 @@ inherits from FS::Record.  The following fields are currently supported:
 
 =item new HASHREF
 
 
 =item new HASHREF
 
-Creates a new exemption record.  To add the example to the database, see
-L<"insert">.
+Creates a new exemption record.  To add the examption record 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.
 
 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.
@@ -96,7 +97,7 @@ returns the error, otherwise returns false.
 
 =item check
 
 
 =item check
 
-Checks all fields to make sure this is a valid example.  If there is
+Checks all fields to make sure this is a valid exemption record.  If there is
 an error, returns the error, otherwise returns false.  Called by the insert
 and replace methods.
 
 an error, returns the error, otherwise returns false.  Called by the insert
 and replace methods.
 
@@ -112,6 +113,9 @@ sub check {
 #    || $self->ut_foreign_key('custnum', 'cust_main', 'custnum')
     || $self->ut_foreign_key('billpkgnum', 'cust_bill_pkg', 'billpkgnum')
     || $self->ut_foreign_key('taxnum', 'cust_main_county', 'taxnum')
 #    || $self->ut_foreign_key('custnum', 'cust_main', 'custnum')
     || $self->ut_foreign_key('billpkgnum', 'cust_bill_pkg', 'billpkgnum')
     || $self->ut_foreign_key('taxnum', 'cust_main_county', 'taxnum')
+    || $self->ut_foreign_keyn('creditbillpkgnum',
+                              'cust_credit_bill_pkg',
+                              'creditbillpkgnum')
     || $self->ut_number('year') #check better
     || $self->ut_number('month') #check better
     || $self->ut_money('amount')
     || $self->ut_number('year') #check better
     || $self->ut_number('month') #check better
     || $self->ut_money('amount')
@@ -119,6 +123,18 @@ sub check {
   ;
 }
 
   ;
 }
 
+=item cust_main_county
+
+Returns the associated tax definition if it still exists in the database.
+Otherwise returns false.
+
+=cut
+
+sub cust_main_county {
+  my $self = shift;
+  qsearchs( 'cust_main_county', { 'taxnum', $self->taxnum } );
+}
+
 =back
 
 =head1 BUGS
 =back
 
 =head1 BUGS