1 package FS::part_pkg_link;
5 use FS::Record qw( qsearchs );
12 FS::part_pkg_link - Object methods for part_pkg_link records
16 use FS::part_pkg_link;
18 $record = new FS::part_pkg_link \%hash;
19 $record = new FS::part_pkg_link { 'column' => 'value' };
21 $error = $record->insert;
23 $error = $new_record->replace($old_record);
25 $error = $record->delete;
27 $error = $record->check;
31 An FS::part_pkg_link object represents an link from one package definition to
32 another. FS::part_pkg_link inherits from FS::Record. The following fields are
43 Source package (see L<FS::part_pkg>)
47 Destination package (see L<FS::part_pkg>)
51 Link type - currently, "bill" (source package bills a line item from target
52 package), or "svc" (source package includes services from target package).
56 Flag indicating that this subpackage should be felt, but not seen as an invoice
57 line item when set to 'Y'
67 Creates a new link. To add the link to the database, see L<"insert">.
69 Note that this stores the hash reference, not a distinct copy of the hash it
70 points to. You can ask the object for a copy with the I<hash> method.
74 # the new method can be inherited from FS::Record, if a table method is defined
76 sub table { 'part_pkg_link'; }
80 Adds this record to the database. If there is an error, returns the error,
81 otherwise returns false.
85 # the insert method can be inherited from FS::Record
89 Delete this record from the database.
93 # the delete method can be inherited from FS::Record
95 =item replace OLD_RECORD
97 Replaces the OLD_RECORD with this one in the database. If there is an error,
98 returns the error, otherwise returns false.
102 # the replace method can be inherited from FS::Record
106 Checks all fields to make sure this is a valid link. If there is
107 an error, returns the error, otherwise returns false. Called by the insert
112 # the check method should currently be supplied - FS::Record contains some
113 # data checking routines
119 $self->ut_numbern('pkglinknum')
120 || $self->ut_foreign_key('src_pkgpart', 'part_pkg', 'pkgpart')
121 || $self->ut_foreign_key('dst_pkgpart', 'part_pkg', 'pkgpart')
122 || $self->ut_enum('link_type', [ 'bill', 'svc' ] )
123 || $self->ut_enum('hidden', [ '', 'Y' ] )
125 return $error if $error;
132 Returns the source part_pkg object (see L<FS::part_pkg>).
138 qsearchs('part_pkg', { 'pkgpart' => $self->src_pkgpart } );
143 Returns the source part_pkg object (see L<FS::part_pkg>).
149 qsearchs('part_pkg', { 'pkgpart' => $self->dst_pkgpart } );
158 L<FS::Record>, schema.html from the base documentation.