This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / FS / FS / part_event / Condition / payby.pm
1 package FS::part_event::Condition::payby;
2
3 use strict;
4 use Tie::IxHash;
5 use FS::payby;
6
7 use base qw( FS::part_event::Condition );
8
9 sub description {
10   #'customer payment types: ';
11   'Customer payment type';
12 }
13
14 #something like this
15 tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2longname;
16 sub option_fields {
17   (
18     'payby' => { 
19                  label         => 'Customer payment type',
20                  #type          => 'select-multiple',
21                  type          => 'checkbox-multiple',
22                  options       => [ keys %payby ],
23                  option_labels => \%payby,
24                },
25   );
26 }
27
28 sub condition {
29   my( $self, $object ) = @_;
30
31   my $cust_main = $self->cust_main($object);
32
33   my $hashref = $self->option('payby') || {};
34   $hashref->{ $cust_main->payby };
35
36 }
37
38 sub condition_sql {
39   my( $self, $table ) = @_;
40
41   'cust_main.payby IN '. $self->condition_sql_option_option('payby');
42 }
43
44 1;