1 package FS::agent_pkg_class;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
9 FS::agent_pkg_class - Object methods for agent_pkg_class records
13 use FS::agent_pkg_class;
15 $record = new FS::agent_pkg_class \%hash;
16 $record = new FS::agent_pkg_class { 'column' => 'value' };
18 $error = $record->insert;
20 $error = $new_record->replace($old_record);
22 $error = $record->delete;
24 $error = $record->check;
28 An FS::agent_pkg_class object represents an commission for a specific agent
29 and package class. FS::agent_pkg_class inherits from FS::Record. The
30 following fields are currently supported:
34 =item agentpkgclassnum
46 =item commission_percent
59 Creates a new record. To add the record to the database, see L<"insert">.
61 Note that this stores the hash reference, not a distinct copy of the hash it
62 points to. You can ask the object for a copy with the I<hash> method.
66 sub table { 'agent_pkg_class'; }
70 Adds this record to the database. If there is an error, returns the error,
71 otherwise returns false.
75 Delete this record from the database.
77 =item replace OLD_RECORD
79 Replaces the OLD_RECORD with this one in the database. If there is an error,
80 returns the error, otherwise returns false.
84 Checks all fields to make sure this is a valid record. If there is
85 an error, returns the error, otherwise returns false. Called by the insert
93 $self->commission_percent(0) unless length($self->commission_percent);
96 $self->ut_numbern('agentpkgclassnum')
97 || $self->ut_foreign_key('agentnum', 'agent', 'agentnum')
98 || $self->ut_foreign_keyn('classnum', 'pkg_class', 'classnum')
99 || $self->ut_float('commission_percent')
101 return $error if $error;
112 L<FS::Record>, schema.html from the base documentation.