5 use FS::Record qw( qsearchs );
9 @ISA = qw( FS::Record );
13 FS::type_pkgs - Object methods for type_pkgs records
19 $record = new FS::type_pkgs \%hash;
20 $record = new FS::type_pkgs { 'column' => 'value' };
22 $error = $record->insert;
24 $error = $new_record->replace($old_record);
26 $error = $record->delete;
28 $error = $record->check;
32 An FS::type_pkgs record links an agent type (see L<FS::agent_type>) to a
33 billing item definition (see L<FS::part_pkg>). FS::type_pkgs inherits from
34 FS::Record. The following fields are currently supported:
38 =item typepkgnum - primary key
40 =item typenum - Agent type, see L<FS::agent_type>
42 =item pkgpart - Billing item definition, see L<FS::part_pkg>
52 Create a new record. To add the record to the database, see L<"insert">.
56 sub table { 'type_pkgs'; }
60 Adds this record to the database. If there is an error, returns the error,
61 otherwise returns false.
65 Deletes this record from the database. If there is an error, returns the
66 error, otherwise returns false.
68 =item replace OLD_RECORD
70 Replaces OLD_RECORD with this one in the database. If there is an error,
71 returns the error, otherwise returns false.
75 Checks all fields to make sure this is a valid record. If there is an error,
76 returns the error, otherwise returns false. Called by the insert and replace
85 $self->ut_numbern('typepkgnum')
86 || $self->ut_number('typenum')
87 || $self->ut_number('pkgpart')
89 return $error if $error;
91 return "Unknown typenum"
92 unless qsearchs( 'agent_type', { 'typenum' => $self->typenum } );
94 return "Unknown pkgpart"
95 unless qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } );
102 Returns the FS::part_pkg object associated with this record.
108 qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } );
119 L<FS::Record>, L<FS::agent_type>, L<FS::part_pkgs>, schema.html from the base