default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / FS / FS / part_event / Condition / agent.pm
1 package FS::part_event::Condition::agent;
2
3 use strict;
4
5 use base qw( FS::part_event::Condition );
6
7 # see the FS::part_event::Condition manpage for full documentation on each
8 # of the required and optional methods.
9
10 sub description {
11   'Agent';
12 }
13
14 sub option_fields {
15   (
16     'agentnum'   => { label=>'Agent', type=>'select-agent', multiple => '1' },
17   );
18 }
19
20 sub condition {
21   my($self, $object, %opt) = @_;
22
23   my $cust_main = $self->cust_main($object);
24
25   my $hashref = $self->option('agentnum') || {};
26   grep $hashref->{ $_->agentnum }, $cust_main->agent;
27
28 }
29
30 sub condition_sql {
31   my( $class, $table, %opt ) = @_;
32
33   "cust_main.agentnum IN " . $class->condition_sql_option_option_integer('agentnum', $opt{'driver_name'});
34 }
35
36 1;