1 package FS::part_pkg::flat_introrate;
2 use base qw( FS::part_pkg::flat );
8 'name' => 'Introductory price for X months, then flat rate,'.
9 'relative to setup date (anniversary billing)',
10 'shortname' => 'Anniversary, with intro price',
11 'inherit_fields' => [ 'flat', 'usage_Mixin', 'global_Mixin' ],
13 'intro_fee' => { 'name' => 'Introductory recurring fee for this package',
17 { 'name' => 'Duration of the introductory period, in number of months',
21 'fieldorder' => [ qw(intro_duration intro_fee) ],
26 my($self, $cust_pkg, $time ) = @_;
28 warn "flat_introrate base_recur requires date!" if !$time;
29 my $now = $time ? $$time : time;
31 my ($duration) = ($self->option('intro_duration') =~ /^\s*(\d+)\s*$/);
32 unless (length($duration)) {
33 die "Invalid intro_duration: " . $self->option('intro_duration');
35 my $intro_end = $self->add_freq($cust_pkg->setup, $duration);
37 if ($now < $intro_end) {
38 return $self->option('intro_fee');
40 return $self->option('recur_fee');