1 package FS::part_event::Condition::has_cust_payby_auto;
2 use base qw( FS::part_event::Condition );
7 use FS::Record qw( qsearch dbh );
10 'Customer has automatic payment information';
13 tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2shortname;
14 delete $payby{'DCRD'};
15 delete $payby{'DCHK'};
20 label => 'Has automatic payment info',
22 options => [ keys %payby ],
23 option_labels => \%payby,
29 my( $self, $object ) = @_;
31 my $cust_main = $self->cust_main($object);
33 #handle multiple (HASH) type options migrated from a v3 payby.pm condition
34 # (and maybe we should be a select-multiple or checkbox-multiple too?)
36 my $payby = $self->option('payby');
38 @payby = keys %$payby;
44 'table' => 'cust_payby',
45 'hashref' => { 'custnum' => $cust_main->custnum,
46 #'payby' => $self->option('payby')
48 'extra_sql' => 'AND payby IN ( '.
49 join(',', map dbh->quote($_), @payby).
51 'order_by' => 'LIMIT 1',