1 package FS::part_event::Condition::cust_pay_payby;
4 use base qw( FS::part_event::Condition );
6 use FS::Record qw( qsearchs );
9 sub description { 'Type of most recent payment'; }
11 tie my %payby, 'Tie::IxHash', FS::payby->payment_payby2payname;
16 label => 'Payment type',
17 type => 'checkbox-multiple',
18 options => [ keys %payby ],
19 option_labels => \%payby,
25 my($self, $object) = @_;
27 my $cust_main = $self->cust_main($object);
29 my $cust_pay = qsearchs({ 'table' => 'cust_pay',
30 'hashref' => { 'custnum'=>$cust_main->custnum },
31 'order_by' => 'ORDER BY _date DESC LIMIT 1',
35 my $payby = $self->option('payby') || {};
36 $payby->{ $cust_pay->payby };