5 use FS::Record qw( qsearchs );
7 @ISA = qw( FS::Record );
11 FS::pkg_svc - Object methods for pkg_svc records
17 $record = new FS::pkg_svc \%hash;
18 $record = new FS::pkg_svc { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::pkg_svc record links a billing item definition (see L<FS::part_pkg>) to
31 a service definition (see L<FS::part_svc>). FS::pkg_svc inherits from
32 FS::Record. The following fields are currently supported:
36 =item pkgpart - Billing item definition (see L<FS::part_pkg>)
38 =item svcpart - Service definition (see L<FS::part_svc>)
40 =item quantity - Quantity of this service definition that this billing item
51 Create a new record. To add the record to the database, see L<"insert">.
55 sub table { 'pkg_svc'; }
59 Adds this record to the database. If there is an error, returns the error,
60 otherwise returns false.
64 Deletes this record from the database. If there is an error, returns the
65 error, otherwise returns false.
67 =item replace OLD_RECORD
69 Replaces OLD_RECORD with this one in the database. If there is an error,
70 returns the error, otherwise returns false.
75 my ( $new, $old ) = ( shift, shift );
77 return "Can't change pkgpart!" if $old->pkgpart != $new->pkgpart;
78 return "Can't change svcpart!" if $old->svcpart != $new->svcpart;
80 $new->SUPER::replace($old);
85 Checks all fields to make sure this is a valid record. If there is an error,
86 returns the error, otherwise returns false. Called by the insert and replace
96 $self->ut_number('pkgpart')
97 || $self->ut_number('svcpart')
98 || $self->ut_number('quantity')
100 return $error if $error;
102 return "Unknown pkgpart!"
103 unless qsearchs( 'part_pkg', { 'pkgpart' => $self->pkgpart } );
105 return "Unknown svcpart!"
106 unless qsearchs('part_svc', { 'svcpart' => $self->svcpart } );
115 $Id: pkg_svc.pm,v 1.3 1999-01-18 21:58:08 ivan Exp $
121 L<FS::Record>, L<FS::part_pkg>, L<FS::part_svc>, schema.html from the base
126 ivan@voicenet.com 97-jul-1
129 ivan@sisd.com 97-nov-13
131 pod ivan@sisd.com 98-sep-22
134 Revision 1.3 1999-01-18 21:58:08 ivan
135 esthetic: eq and ne were used in a few places instead of == and !=
137 Revision 1.2 1998/12/29 11:59:51 ivan
138 mostly properly OO, some work still to be done with svc_ stuff