summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2016-06-03 17:21:20 -0700
committerIvan Kohler <ivan@freeside.biz>2016-06-03 17:21:20 -0700
commitfdd0c874e13cb424ed924f4a2bf87a706a598ee4 (patch)
treee5628b1847eb1e6b29b9d78e1087b2c8c675f04c
parent0b01125393fc9e50eb77a17498046b6fca192a61 (diff)
fix "Customer has automatic payment information" condition when migrated from v3
-rw-r--r--FS/FS/part_event/Condition/has_cust_payby_auto.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/FS/FS/part_event/Condition/has_cust_payby_auto.pm b/FS/FS/part_event/Condition/has_cust_payby_auto.pm
index 9f914292f..42f6d3582 100644
--- a/FS/FS/part_event/Condition/has_cust_payby_auto.pm
+++ b/FS/FS/part_event/Condition/has_cust_payby_auto.pm
@@ -30,11 +30,24 @@ sub condition {
my $cust_main = $self->cust_main($object);
+ #handle multiple (HASH) type options migrated from a v3 payby.pm condition
+ # (and maybe we should be a select-multiple or checkbox-multiple too?)
+ my @payby = ();
+ my $payby = $self->option('payby');
+ if ( ref($payby) ) {
+ @payby = keys %$payby;
+ } elsif ( $payby ) {
+ @payby = ( $payby );
+ }
+
scalar( qsearch({
'table' => 'cust_payby',
'hashref' => { 'custnum' => $cust_main->custnum,
- 'payby' => $self->option('payby')
+ #'payby' => $self->option('payby')
},
+ 'extra_sql' => 'AND payby IN ( '.
+ join(',', map dbh->quote($_), @payby).
+ ' ) ',
'order_by' => 'LIMIT 1',
}) );