4 use vars qw(@ISA @EXPORT_OK);
6 use FS::Record qw(fields hfields qsearchs);
8 @ISA = qw(FS::Record Exporter);
9 @EXPORT_OK = qw(hfields);
13 FS::pkg_svc - Object methods for pkg_svc records
19 $record = create FS::pkg_svc \%hash;
20 $record = create FS::pkg_svc { 'column' => 'value' };
22 $error = $record->insert;
24 $error = $new_record->replace($old_record);
26 $error = $record->delete;
28 $error = $record->check;
32 An FS::pkg_svc record links a billing item definition (see L<FS::part_pkg>) to
33 a service definition (see L<FS::part_svc>). FS::pkg_svc inherits from
34 FS::Record. The following fields are currently supported:
38 =item pkgpart - Billing item definition (see L<FS::part_pkg>)
40 =item svcpart - Service definition (see L<FS::part_svc>)
42 =item quantity - Quantity of this service definition that this billing item
53 Create a new record. To add the record to the database, see L<"insert">.
58 my($proto,$hashref)=@_;
60 #now in FS::Record::new
62 #foreach $field (fields('pkg_svc')) {
63 # $hashref->{$field}='' unless defined $hashref->{$field};
66 $proto->new('pkg_svc',$hashref);
72 Adds this record to the database. If there is an error, returns the error,
73 otherwise returns false.
86 Deletes this record from the database. If there is an error, returns the
87 error, otherwise returns false.
97 =item replace OLD_RECORD
99 Replaces OLD_RECORD with this one in the database. If there is an error,
100 returns the error, otherwise returns false.
106 return "(Old) Not a pkg_svc record!" unless $old->table eq "pkg_svc";
107 return "Can't change pkgpart!"
108 if $old->getfield('pkgpart') ne $new->getfield('pkgpart');
109 return "Can't change svcpart!"
110 if $old->getfield('svcpart') ne $new->getfield('svcpart');
118 Checks all fields to make sure this is a valid record. If there is an error,
119 returns the error, otherwise returns false. Called by the insert and replace
126 return "Not a pkg_svc record!" unless $self->table eq "pkg_svc";
127 my($recref) = $self->hashref;
130 return $error if $error =
131 $self->ut_number('pkgpart')
132 || $self->ut_number('svcpart')
133 || $self->ut_number('quantity')
136 return "Unknown pkgpart!"
137 unless qsearchs('part_pkg',{'pkgpart'=> $self->getfield('pkgpart')});
139 return "Unknown svcpart!"
140 unless qsearchs('part_svc',{'svcpart'=> $self->getfield('svcpart')});
149 It doesn't properly override FS::Record yet.
153 L<FS::Record>, L<FS::part_pkg>, L<FS::part_svc>, schema.html from the base
158 ivan@voicenet.com 97-jul-1
161 ivan@sisd.com 97-nov-13
163 pod ivan@sisd.com 98-sep-22