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 $custom_record = $template_record->clone;
24 $error = $record->insert;
26 $error = $new_record->replace($old_record);
28 $error = $record->delete;
30 $error = $record->check;
34 An FS::part_pkg represents a billing item definition. FS::part_pkg inherits
35 from FS::Record. The following fields are currently supported:
39 =item pkgpart - primary key (assigned automatically for new billing item definitions)
41 =item pkg - Text name of this billing item definition (customer-viewable)
43 =item comment - Text name of this billing item definition (non-customer-viewable)
45 =item setup - Setup fee
47 =item freq - Frequency of recurring fee
49 =item recur - Recurring fee
53 setup and recur are evaluated as Safe perl expressions. You can use numbers
54 just as you would normally. More advanced semantics are not yet defined.
62 Creates a new billing item definition. To add the billing item definition to
63 the database, see L<"insert">.
68 my($proto,$hashref)=@_;
70 #now in FS::Record::new
72 #foreach $field (fields('part_pkg')) {
73 # $hashref->{$field}='' unless defined $hashref->{$field};
76 $proto->new('part_pkg',$hashref);
81 Creates a new billing item definition by duplicating an existing definition.
82 A new pkgpart is assigned and "(CUSTOM) " is prepended to the comment field.
83 To add the billing item definition to the database, see L<"insert">.
89 my %hash = $self->hash;
90 $hash{'pkgpart'} = '';
91 $hash{'comment'} = "(CUSTOM) ". $hash{'comment'}
92 unless $hash{'comment'} =~ /^\(CUSTOM\) /;
93 create FS::part_pkg ( \%hash ); # ?
98 Adds this billing item definition to the database. If there is an error,
99 returns the error, otherwise returns false.
112 Currently unimplemented.
117 return "Can't (yet?) delete package definitions.";
118 # maybe check & make sure the pkgpart isn't in cust_pkg or type_pkgs?
124 =item replace OLD_RECORD
126 Replaces OLD_RECORD with this one in the database. If there is an error,
127 returns the error, otherwise returns false.
133 return "(Old) Not a part_pkg record!" unless $old->table eq "part_pkg";
134 return "Can't change pkgpart!"
135 unless $old->getfield('pkgpart') eq $new->getfield('pkgpart');
142 Checks all fields to make sure this is a valid billing item definition. If
143 there is an error, returns the error, otherwise returns false. Called by the
144 insert and replace methods.
150 return "Not a part_pkg record!" unless $self->table eq "part_pkg";
152 $self->ut_numbern('pkgpart')
153 or $self->ut_text('pkg')
154 or $self->ut_text('comment')
155 or $self->ut_anything('setup')
156 or $self->ut_number('freq')
157 or $self->ut_anything('recur')
166 $Id: part_pkg.pm,v 1.3 1998-11-15 13:00:15 ivan Exp $
170 It doesn't properly override FS::Record yet.
172 The delete method is unimplemented.
174 setup and recur semantics are not yet defined (and are implemented in
175 FS::cust_bill. hmm.).
179 L<FS::Record>, L<FS::cust_pkg>, L<FS::type_pkgs>, L<FS::pkg_svc>, L<Safe>.
180 schema.html from the base documentation.
184 ivan@sisd.com 97-dec-5
186 pod ivan@sisd.com 98-sep-21
188 $Log: part_pkg.pm,v $
189 Revision 1.3 1998-11-15 13:00:15 ivan
190 bugfix in clone method, clone method doc clarification