summaryrefslogtreecommitdiff
path: root/FS/FS/part_event/Condition/pkg_status.pm
blob: 3fb374e9a388ebdfcadca6bc60ad5be8edd5bed4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package FS::part_event::Condition::pkg_status;

use strict;

use base qw( FS::part_event::Condition );
use FS::Record qw( qsearch );

sub description {
  'Package Status';
}

sub eventtable_hashref {
    { 'cust_main' => 0,
      'cust_bill' => 0,
      'cust_pkg'  => 1,
    };
}

#something like this
sub option_fields {
  (
    'status'  => { 'label'    => 'Package Status',
                   'type'     => 'select-cust_pkg-status',
                   'multiple' => 1,
                 },
  );
}

sub condition {
  my( $self, $cust_pkg ) = @_;

  #XXX test
  my $hashref = $self->option('status') || {};
  $hashref->{ $cust_pkg->status };
}

sub condition_sql {
  my( $self, $table ) = @_;

  '('.FS::cust_pkg->status_sql . ') IN '.
  $self->condition_sql_option_option('status');
}

1;