1 package FS::reg_code_pkg;
2 use base qw(FS::Record);
8 FS::reg_code_pkg - Class linking registration codes (see L<FS::reg_code>) with package definitions (see L<FS::part_pkg>)
14 $record = new FS::reg_code_pkg \%hash;
15 $record = new FS::reg_code_pkg { 'column' => 'value' };
17 $error = $record->insert;
19 $error = $new_record->replace($old_record);
21 $error = $record->delete;
23 $error = $record->check;
27 An FS::reg_code_pkg object links a registration code to a package definition.
28 FS::table_name inherits from FS::Record. The following fields are currently
33 =item codepkgnum - primary key
35 =item codenum - registration code (see L<FS::reg_code>)
37 =item pkgpart - package definition (see L<FS::part_pkg>)
47 Creates a new registration code. To add the registration code to the database,
50 Note that this stores the hash reference, not a distinct copy of the hash it
51 points to. You can ask the object for a copy with the I<hash> method.
55 # the new method can be inherited from FS::Record, if a table method is defined
57 sub table { 'reg_code_pkg'; }
61 Adds this record to the database. If there is an error, returns the error,
62 otherwise returns false.
66 # the insert method can be inherited from FS::Record
70 Delete this record from the database.
74 # the delete method can be inherited from FS::Record
76 =item replace OLD_RECORD
78 Replaces the OLD_RECORD with this one in the database. If there is an error,
79 returns the error, otherwise returns false.
83 # the replace method can be inherited from FS::Record
87 Checks all fields to make sure this is a valid record. If there is
88 an error, returns the error, otherwise returns false. Called by the insert
93 # the check method should currently be supplied - FS::Record contains some
94 # data checking routines
100 $self->ut_numbern('codepkgnum')
101 || $self->ut_foreign_key('codenum', 'reg_code', 'codenum')
102 || $self->ut_foreign_key('pkgpart', 'part_pkg', 'pkgpart')
104 return $error if $error;
111 Returns the package definition (see L<FS::part_pkg>)
121 L<FS::reg_code_pkg>, L<FS::Record>, schema.html from the base documentation.