(no commit message)
[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   #uuh.. all right?  test this.
34   my $hashref = $self->option('payby') || {};
35   $hashref->{ $cust_main->payby };
36
37 }
38
39 #sub condition_sql {
40 #  my( $self, $table ) = @_;
41 #
42 #  #uuh... yeah... something like this.  test it for sure.
43 #
44 #  my @payby = keys %{ $self->option('payby') };
45 #
46 #  ' ( '. join(' OR ', map { "cust_main.payby = '$_'" } @payby ). ' ) ';
47 #
48 #}
49
50 1;