This commit was generated by cvs2svn to compensate for changes in r4407,
[freeside.git] / FS / FS / part_pkg / flat_delayed.pm
1 package FS::part_pkg::flat_delayed;
2
3 use strict;
4 use vars qw(@ISA %info);
5 #use FS::Record qw(qsearch qsearchs);
6 use FS::part_pkg::flat;
7
8 @ISA = qw(FS::part_pkg::flat);
9
10 %info = (
11   'name' => 'Free (or setup fee) for X days, then flat rate'.
12             ' (anniversary billing)',
13   'fields' =>  {
14     'setup_fee' => { 'name' => 'Setup fee for this package',
15                      'default' => 0,
16                    },
17     'free_days' => { 'name' => 'Initial free days',
18                      'default' => 0,
19                    },
20     'recur_fee' => { 'name' => 'Recurring fee for this package',
21                      'default' => 0,
22                     },
23     'unused_credit' => { 'name' => 'Credit the customer for the unused portion'.
24                                    ' of service at cancellation',
25                          'type' => 'checkbox',
26                        },
27   },
28   'fieldorder' => [ 'free_days', 'setup_fee', 'recur_fee', 'unused_credit' ],
29   #'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',
30   #'recur' => 'what.recur_fee.value',
31   'weight' => 50,
32 );
33
34 sub calc_setup {
35   my($self, $cust_pkg, $time ) = @_;
36
37   my $d = $cust_pkg->bill || $time;
38   $d += 86400 * $self->option('free_days');
39   $cust_pkg->bill($d);
40   
41   $self->option('setup_fee');
42 }
43
44 1;