1 package FS::part_event::Condition::svc_acct_overlimit;
6 use base qw( FS::part_event::Condition );
8 sub description { 'Service is over its usage limit' };
10 sub eventtable_hashref {
14 tie my %usage_types, 'Tie::IxHash', (
16 'upbytes' => 'Upload',
17 'downbytes' => 'Download',
18 'totalbytes'=> 'Total transfer',
24 type => 'checkbox-multiple',
25 options => [ keys %usage_types ],
26 option_labels => \%usage_types,
33 my($self, $svc_acct) = @_;
35 my $types = $self->option('usage_types') || {};
36 foreach my $column (keys %$types) {
37 # don't trigger if this type of usage isn't tracked on the service
38 next if $svc_acct->$column eq '';
40 return 1 if ( $svc_acct->$column <= 0 );
48 # not an exact condition_sql--ignores the usage_types option
51 "( svc_acct.$_ IS NOT NULL AND svc_acct.$_ <= 0 )"