5 use FS::Record qw( qsearchs );
9 @ISA = qw( FS::Record );
13 FS::pkg_svc - Object methods for pkg_svc records
19 $record = new FS::pkg_svc \%hash;
20 $record = new FS::pkg_svc { 'column' => 'value' };
22 $error = $record->insert;
24 $error = $new_record->replace($old_record);
26 $error = $record->delete;
28 $error = $record->check;
30 $part_pkg = $record->part_pkg;
32 $part_svc = $record->part_svc;
36 An FS::pkg_svc record links a billing item definition (see L<FS::part_pkg>) to
37 a service definition (see L<FS::part_svc>). FS::pkg_svc inherits from
38 FS::Record. The following fields are currently supported:
42 =item pkgpart - Billing item definition (see L<FS::part_pkg>)
44 =item svcpart - Service definition (see L<FS::part_svc>)
46 =item quantity - Quantity of this service definition that this billing item
57 Create a new record. To add the record to the database, see L<"insert">.
61 sub table { 'pkg_svc'; }
65 Adds this record to the database. If there is an error, returns the error,
66 otherwise returns false.
70 Deletes this record from the database. If there is an error, returns the
71 error, otherwise returns false.
73 =item replace OLD_RECORD
75 Replaces OLD_RECORD with this one in the database. If there is an error,
76 returns the error, otherwise returns false.
81 my ( $new, $old ) = ( shift, shift );
83 return "Can't change pkgpart!" if $old->pkgpart != $new->pkgpart;
84 return "Can't change svcpart!" if $old->svcpart != $new->svcpart;
86 $new->SUPER::replace($old);
91 Checks all fields to make sure this is a valid record. If there is an error,
92 returns the error, otherwise returns false. Called by the insert and replace
102 $self->ut_number('pkgpart')
103 || $self->ut_number('svcpart')
104 || $self->ut_number('quantity')
106 return $error if $error;
108 return "Unknown pkgpart!" unless $self->part_pkg;
109 return "Unknown svcpart!" unless $self->part_svc;
116 Returns the FS::part_pkg object (see L<FS::part_pkg>).
122 qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } );
127 Returns the FS::part_svc object (see L<FS::part_svc>).
133 qsearchs( 'part_svc', { 'svcpart' => $self->svcpart } );
140 $Id: pkg_svc.pm,v 1.1 1999-08-04 09:03:53 ivan Exp $
146 L<FS::Record>, L<FS::part_pkg>, L<FS::part_svc>, schema.html from the base