summaryrefslogtreecommitdiff
path: root/FS/FS/part_event/Condition/payby.pm
blob: d93156828073714d3852af81a15bdae13eb8ab6d (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
45
46
47
48
49
50
package FS::part_event::Condition::payby;

use strict;
use Tie::IxHash;
use FS::payby;

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

sub description {
  #'customer payment types: ';
  'Customer payment type';
}

#something like this
tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2longname;
sub option_fields {
  (
    'payby' => { 
                 label         => 'Customer payment type',
                 #type          => 'select-multiple',
                 type          => 'checkbox-multiple',
                 options       => [ keys %payby ],
                 option_labels => \%payby,
               },
  );
}

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

  my $cust_main = $self->cust_main($object);

  #uuh.. all right?  test this.
  my $hashref = $self->option('payby') || {};
  $hashref->{ $cust_main->payby };

}

#sub condition_sql {
#  my( $self, $table ) = @_;
#
#  #uuh... yeah... something like this.  test it for sure.
#
#  my @payby = keys %{ $self->option('payby') };
#
#  ' ( '. join(' OR ', map { "cust_main.payby = '$_'" } @payby ). ' ) ';
#
#}

1;