4 use vars qw(@ISA @EXPORT_OK);
6 use FS::Record qw(fields hfields);
8 @ISA = qw(FS::Record Exporter);
9 @EXPORT_OK = qw(hfields fields);
13 FS::part_pkg - Object methods for part_pkg objects
19 $record = create FS::part_pkg \%hash
20 $record = create FS::part_pkg { 'column' => 'value' };
22 $error = $record->insert;
24 $error = $new_record->replace($old_record);
26 $error = $record->delete;
28 $error = $record->check;
32 An FS::part_pkg represents a billing item definition. FS::part_pkg inherits
33 from FS::Record. The following fields are currently supported:
37 =item pkgpart - primary key (assigned automatically for new billing item definitions)
39 =item pkg - Text name of this billing item definition (customer-viewable)
41 =item comment - Text name of this billing item definition (non-customer-viewable)
43 =item setup - Setup fee
45 =item freq - Frequency of recurring fee
47 =item recur - Recurring fee
51 setup and recur are evaluated as Safe perl expressions. You can use numbers
52 just as you would normally. More advanced semantics are not yet defined.
60 Creates a new billing item definition. To add the billing item definition to
61 the database, see L<"insert">.
66 my($proto,$hashref)=@_;
68 #now in FS::Record::new
70 #foreach $field (fields('part_pkg')) {
71 # $hashref->{$field}='' unless defined $hashref->{$field};
74 $proto->new('part_pkg',$hashref);
79 Adds this billing item definition to the database. If there is an error,
80 returns the error, otherwise returns false.
93 Currently unimplemented.
98 return "Can't (yet?) delete package definitions.";
99 # maybe check & make sure the pkgpart isn't in cust_pkg or type_pkgs?
105 =item replace OLD_RECORD
107 Replaces OLD_RECORD with this one in the database. If there is an error,
108 returns the error, otherwise returns false.
114 return "(Old) Not a part_pkg record!" unless $old->table eq "part_pkg";
115 return "Can't change pkgpart!"
116 unless $old->getfield('pkgpart') eq $new->getfield('pkgpart');
123 Checks all fields to make sure this is a valid billing item definition. If
124 there is an error, returns the error, otherwise returns false. Called by the
125 insert and replace methods.
131 return "Not a part_pkg record!" unless $self->table eq "part_pkg";
133 $self->ut_numbern('pkgpart')
134 or $self->ut_text('pkg')
135 or $self->ut_text('comment')
136 or $self->ut_anything('setup')
137 or $self->ut_number('freq')
138 or $self->ut_anything('recur')
147 It doesn't properly override FS::Record yet.
149 The delete method is unimplemented.
151 setup and recur semantics are not yet defined (and are implemented in
152 FS::cust_bill. hmm.).
156 L<FS::Record>, L<FS::cust_pkg>, L<FS::type_pkgs>, L<FS::pkg_svc>, L<Safe>.
157 schema.html from the base documentation.
161 ivan@sisd.com 97-dec-5
163 pod ivan@sisd.com 98-sep-21