1 package FS::part_pkg_discount;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
11 FS::part_pkg_discount - Object methods for part_pkg_discount records
15 use FS::part_pkg_discount;
17 $record = new FS::part_pkg_discount \%hash;
18 $record = new FS::part_pkg_discount { '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_discount object represents a link from a package definition
31 to a discount. This permits discounts for lengthened terms. FS::part_pkg_discount inherits from
32 FS::Record. The following fields are currently supported:
57 Creates a new part_pkg_discount. To add the example to the database, see L<"insert">.
59 Note that this stores the hash reference, not a distinct copy of the hash it
60 points to. You can ask the object for a copy with the I<hash> method.
64 sub table { 'part_pkg_discount'; }
68 Adds this record to the database. If there is an error, returns the error,
69 otherwise returns false.
75 Delete this record from the database.
79 =item replace OLD_RECORD
81 Replaces the OLD_RECORD with this one in the database. If there is an error,
82 returns the error, otherwise returns false.
88 Checks all fields to make sure this is a valid example. If there is
89 an error, returns the error, otherwise returns false. Called by the insert
98 $self->ut_numbern('pkgdiscountnum')
99 || $self->ut_number('pkgpart')
100 || $self->ut_number('discountnum')
102 return $error if $error;
109 Returns the discount associated with this part_pkg_discount.
115 qsearchs('discount', { 'discountnum' => $self->discountnum });
124 L<FS::Record>, schema.html from the base documentation.