fix qsearch usage in new condition (multiple payment options, RT#23741)
[freeside.git] / FS / FS / part_event / Condition / hasnt_cust_payby_auto.pm
1 package FS::part_event::Condition::hasnt_cust_payby_auto;
2 use base qw( FS::part_event::Condition );
3
4 use strict;
5 use FS::Record qw(qsearch);
6
7 sub description {
8   'Customer does not have automatic payment information';
9 }
10
11 sub condition {
12   my( $self, $object ) = @_;
13
14   my $cust_main = $self->cust_main($object);
15
16   ! scalar( qsearch({ 
17     'table'     => 'cust_payby',
18     'hashref'   => { 'custnum' => $cust_main->custnum,
19                    },
20     'extra_sql' => "AND payby IN ( 'CARD', 'CHEK' )",
21     'order_by'  => 'LIMIT 1',
22   }) );
23
24 }
25
26 1;