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.
88 my %hash = $self->hash;
89 $hash{'comment'} = "(CUSTOM) ". $hash{'comment'}
90 unless $hash{'comment'} =~ /^\(CUSTOM\) /;
91 create ( { $self->hash } );
96 Adds this billing item definition to the database. If there is an error,
97 returns the error, otherwise returns false.
110 Currently unimplemented.
115 return "Can't (yet?) delete package definitions.";
116 # maybe check & make sure the pkgpart isn't in cust_pkg or type_pkgs?
122 =item replace OLD_RECORD
124 Replaces OLD_RECORD with this one in the database. If there is an error,
125 returns the error, otherwise returns false.
131 return "(Old) Not a part_pkg record!" unless $old->table eq "part_pkg";
132 return "Can't change pkgpart!"
133 unless $old->getfield('pkgpart') eq $new->getfield('pkgpart');
140 Checks all fields to make sure this is a valid billing item definition. If
141 there is an error, returns the error, otherwise returns false. Called by the
142 insert and replace methods.
148 return "Not a part_pkg record!" unless $self->table eq "part_pkg";
150 $self->ut_numbern('pkgpart')
151 or $self->ut_text('pkg')
152 or $self->ut_text('comment')
153 or $self->ut_anything('setup')
154 or $self->ut_number('freq')
155 or $self->ut_anything('recur')
164 $Id: part_pkg.pm,v 1.2 1998-11-15 09:08:15 ivan Exp $
168 It doesn't properly override FS::Record yet.
170 The delete method is unimplemented.
172 setup and recur semantics are not yet defined (and are implemented in
173 FS::cust_bill. hmm.).
177 L<FS::Record>, L<FS::cust_pkg>, L<FS::type_pkgs>, L<FS::pkg_svc>, L<Safe>.
178 schema.html from the base documentation.
182 ivan@sisd.com 97-dec-5
184 pod ivan@sisd.com 98-sep-21
186 $Log: part_pkg.pm,v $
187 Revision 1.2 1998-11-15 09:08:15 ivan
188 added clone method to support per-customer pricing