rework suspension delays, RT#6956
[freeside.git] / FS / FS / part_event / Condition / pkg_dundate.pm
1 package FS::part_event::Condition::pkg_dundate;
2 use base qw( FS::part_event::Condition );
3
4 use strict;
5
6 sub description {
7   "Skip until package suspension delay date";
8 }
9
10 sub eventtable_hashref {
11   { 'cust_main' => 0,
12     'cust_bill' => 0,
13     'cust_pkg'  => 1,
14   };
15 }
16
17 sub condition {
18   my($self, $cust_pkg, %opt) = @_;
19
20   #my $cust_main = $self->cust_main($cust_pkg);
21
22   $cust_pkg->dundate <= $opt{time};
23
24 }
25
26 sub condition_sql {
27   my( $class, $table, %opt ) = @_;
28   return 'true' unless $table eq 'cust_pkg';
29   "COALESCE($table.dundate,0) <= ". $opt{'time'};
30 }
31
32 1;