diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-02-10 01:38:56 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-02-10 01:38:56 -0800 |
commit | a4d4d3df88b33a6db30b565921f6d62efb252351 (patch) | |
tree | 0ddfa8fe885dfe6776a0c074aed9e1e0735a7cd7 /FS/FS/part_event_condition.pm | |
parent | 6615733676adb431ae48c78ce24758fe571614c1 (diff) |
multiple payment options, RT#23741
Diffstat (limited to 'FS/FS/part_event_condition.pm')
-rw-r--r-- | FS/FS/part_event_condition.pm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/FS/FS/part_event_condition.pm b/FS/FS/part_event_condition.pm index ac2ee82..200049d 100644 --- a/FS/FS/part_event_condition.pm +++ b/FS/FS/part_event_condition.pm @@ -354,6 +354,45 @@ sub order_conditions_sql { } +sub _upgrade_data { #class method + my ($class, %opts) = @_; + + foreach my $part_event_condition ( + qsearch('part_event_condition', { 'conditionname' => 'payby' } ) + ) { + + my $payby = $part_event_condition->option('payby'); + + if ( scalar( keys %$payby ) == 1 ) { + + if ( $payby->{'CARD'} ) { + + $part_event_condition->conditionname('has_cust_payby_auto'); + + } elsif ( $payby->{'CHEK'} ) { + + $part_event_condition->conditionname('has_cust_payby_auto'); + + } + + } elsif ( $payby->{'BILL'} && ! $payby->{'CARD'} && ! $payby->{'CHEK'} ) { + + $part_event_condition->conditionname('hasnt_cust_payby_auto'); + + } else { + + die 'Unable to automatically convert payby condition for event #'. + $part_event_condition->eventpart. "\n"; + + } + + my $error = $part_event_condition->replace; + die $error if $error; + + } + +} + =back =head1 BUGS |