summaryrefslogtreecommitdiff
path: root/FS/FS/part_event/Condition/pkg_freq.pm
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/part_event/Condition/pkg_freq.pm')
-rw-r--r--FS/FS/part_event/Condition/pkg_freq.pm36
1 files changed, 36 insertions, 0 deletions
diff --git a/FS/FS/part_event/Condition/pkg_freq.pm b/FS/FS/part_event/Condition/pkg_freq.pm
new file mode 100644
index 0000000..1fb8484
--- /dev/null
+++ b/FS/FS/part_event/Condition/pkg_freq.pm
@@ -0,0 +1,36 @@
+package FS::part_event::Condition::pkg_freq;
+
+use strict;
+use FS::Misc;
+use FS::cust_pkg;
+
+use base qw( FS::part_event::Condition );
+
+sub description { 'Package billing frequency'; }
+
+sub option_fields {
+ my $freqs = FS::Misc::pkg_freqs();
+ (
+ 'freq' => { 'label' => 'Frequency',
+ 'type' => 'select',
+ 'labels' => $freqs,
+ 'options' => [ keys(%$freqs) ],
+ },
+ );
+}
+
+sub eventtable_hashref {
+ { 'cust_main' => 0,
+ 'cust_bill' => 0,
+ 'cust_pkg' => 1,
+ };
+}
+
+sub condition {
+ my($self, $cust_pkg) = @_;
+
+ $cust_pkg->part_pkg->freq eq $self->option('freq')
+}
+
+1;
+