1 package FS::agent_pkg_class;
2 use base qw( FS::Record );
5 #use FS::Record qw( qsearch qsearchs );
11 FS::agent_pkg_class - Object methods for agent_pkg_class records
15 use FS::agent_pkg_class;
17 $record = new FS::agent_pkg_class \%hash;
18 $record = new FS::agent_pkg_class { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::agent_pkg_class object represents a commission for a specific agent
31 and package class. FS::agent_pkg_class inherits from FS::Record. The
32 following fields are currently supported:
36 =item agentpkgclassnum
48 =item commission_percent
61 Creates a new record. To add the record 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 { 'agent_pkg_class'; }
72 Adds this record to the database. If there is an error, returns the error,
73 otherwise returns false.
77 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.
86 Checks all fields to make sure this is a valid record. If there is
87 an error, returns the error, otherwise returns false. Called by the insert
95 $self->commission_percent(0) unless length($self->commission_percent);
98 $self->ut_numbern('agentpkgclassnum')
99 || $self->ut_foreign_key('agentnum', 'agent', 'agentnum')
100 || $self->ut_foreign_keyn('classnum', 'pkg_class', 'classnum')
101 || $self->ut_float('commission_percent')
103 return $error if $error;
114 L<FS::agent>, L<FS::pkg_class>, L<FS::Record>.