import torrus 1.0.9
[freeside.git] / FS / FS / part_pkg / base_delayed.pm
1 package FS::part_pkg::base_delayed;
2
3 use strict;
4 use vars qw(@ISA %info);
5 #use FS::Record qw(qsearch qsearchs);
6 use FS::part_pkg::base_rate;
7
8 @ISA = qw(FS::part_pkg::base_rate);
9
10 %info = (
11   'name' => 'Free (or setup fee) for X days, then base rate'.
12             ' (anniversary billing)',
13   'shortname' => 'Bulk (manual from "units" option), w/intro period',
14   'inherit_fields' => [ 'global_Mixin' ],
15   'fields' =>  {
16     'free_days' => { 'name' => 'Initial free days',
17                      'default' => 0,
18                    },
19     'recur_notify' => { 'name' => 'Number of days before recurring billing'.
20                                   ' commences to notify customer. (0 means'.
21                                   ' no warning)',
22                      'default' => 0,
23                     },
24   },
25   'fieldorder' => [ 'free_days', 'recur_notify',
26                   ],
27   #'setup' => '\'my $d = $cust_pkg->bill || $time; $d += 86400 * \' + what.free_days.value + \'; $cust_pkg->bill($d); $cust_pkg_mod_flag=1; \' + what.setup_fee.value',
28   #'recur' => 'what.recur_fee.value',
29   'weight' => 54, #&g!
30 );
31
32 sub calc_setup {
33   my($self, $cust_pkg, $time ) = @_;
34
35   my $d = $cust_pkg->bill || $time;
36   $d += 86400 * $self->option('free_days');
37   $cust_pkg->bill($d);
38   
39   $self->option('setup_fee');
40 }
41
42 1;