1 package FS::part_pkg_taxproduct;
4 use vars qw( @ISA $delete_kludge );
5 use FS::Record qw( qsearch );
12 FS::part_pkg_taxproduct - Object methods for part_pkg_taxproduct records
16 use FS::part_pkg_taxproduct;
18 $record = new FS::part_pkg_taxproduct \%hash;
19 $record = new FS::part_pkg_taxproduct { 'column' => 'value' };
21 $error = $record->insert;
23 $error = $new_record->replace($old_record);
25 $error = $record->delete;
27 $error = $record->check;
31 An FS::part_pkg_taxproduct object represents a tax product.
32 FS::part_pkg_taxproduct inherits from FS::Record. The following fields are
47 Tax product id from the vendor
51 A human readable description of the id in taxproduct
61 Creates a new tax product. To add the tax product to the database, see L<"insert">.
63 Note that this stores the hash reference, not a distinct copy of the hash it
64 points to. You can ask the object for a copy with the I<hash> method.
68 sub table { 'part_pkg_taxproduct'; }
72 Adds this record to the database. If there is an error, returns the error,
73 otherwise returns false.
79 Delete this record from the database.
86 return "Can't delete a tax product which has attached package tax rates!"
87 if qsearch( 'part_pkg_taxrate', { 'taxproductnum' => $self->taxproductnum } );
89 unless ( $delete_kludge ) {
90 return "Can't delete a tax product which has attached packages!"
91 if qsearch( 'part_pkg', { 'taxproductnum' => $self->taxproductnum } );
94 $self->SUPER::delete(@_);
97 =item replace OLD_RECORD
99 Replaces the OLD_RECORD with this one in the database. If there is an error,
100 returns the error, otherwise returns false.
106 Checks all fields to make sure this is a valid tax product. If there is
107 an error, returns the error, otherwise returns false. Called by the insert
116 $self->ut_numbern('taxproductnum')
117 || $self->ut_textn('data_vendor')
118 || $self->ut_text('taxproduct')
119 || $self->ut_textn('description')
121 return $error if $error;
134 L<FS::Record>, schema.html from the base documentation.