import torrus 1.0.9
[freeside.git] / FS / FS / part_event / Condition / pkg_freq.pm
1 package FS::part_event::Condition::pkg_freq;
2
3 use strict;
4 use FS::Misc;
5 use FS::cust_pkg;
6
7 use base qw( FS::part_event::Condition );
8
9 sub description { 'Package billing frequency'; }
10
11 sub option_fields {
12   my $freqs = FS::Misc::pkg_freqs();
13   (
14     'freq' => { 'label'      => 'Frequency',
15                 'type'       => 'select',
16                 'labels'     => $freqs,
17                 'options'    => [ keys(%$freqs) ],
18               },
19   );
20 }
21
22 sub eventtable_hashref {
23   { 'cust_main' => 0,
24     'cust_bill' => 0,
25     'cust_pkg'  => 1,
26   };
27 }
28
29 sub condition {
30   my($self, $cust_pkg) = @_;
31
32   $cust_pkg->part_pkg->freq eq $self->option('freq')
33 }
34
35 1;
36