1 package FS::part_pkg_taxproduct;
5 use FS::Record qw( qsearch );
11 FS::part_pkg_taxproduct - Object methods for part_pkg_taxproduct records
15 use FS::part_pkg_taxproduct;
17 $record = new FS::part_pkg_taxproduct \%hash;
18 $record = new FS::part_pkg_taxproduct { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::part_pkg_taxproduct object represents a tax product.
31 FS::part_pkg_taxproduct inherits from FS::Record. The following fields are
46 Tax product id from the vendor
50 A human readable description of the id in taxproduct
60 Creates a new tax product. To add the tax product to the database, see L<"insert">.
62 Note that this stores the hash reference, not a distinct copy of the hash it
63 points to. You can ask the object for a copy with the I<hash> method.
67 sub table { 'part_pkg_taxproduct'; }
71 Adds this record to the database. If there is an error, returns the error,
72 otherwise returns false.
78 Delete this record from the database.
85 return "Can't delete a tax product which has attached package tax rates!"
86 if qsearch( 'part_pkg_taxrate', { 'taxproductnum' => $self->taxproductnum } );
88 return "Can't delete a tax product which has attached packages!"
89 if qsearch( 'part_pkg', { 'taxproductnum' => $self->taxproductnum } );
91 $self->SUPER::delete(@_);
94 =item replace OLD_RECORD
96 Replaces the OLD_RECORD with this one in the database. If there is an error,
97 returns the error, otherwise returns false.
103 Checks all fields to make sure this is a valid tax product. If there is
104 an error, returns the error, otherwise returns false. Called by the insert
113 $self->ut_numbern('taxproductnum')
114 || $self->ut_textn('data_vendor')
115 || $self->ut_text('taxproduct')
116 || $self->ut_textn('description')
118 return $error if $error;
131 L<FS::Record>, schema.html from the base documentation.