diff options
author | Christopher Burger <burgerc@freeside.biz> | 2018-06-05 08:50:17 -0400 |
---|---|---|
committer | Christopher Burger <burgerc@freeside.biz> | 2018-06-05 08:51:56 -0400 |
commit | 744bf508495023922d88a53fcd07467e3e01c2f1 (patch) | |
tree | 8951821922278ef10685d99e5286ce4289b39811 /FS/FS/part_event_condition_option.pm | |
parent | 792172634b829220555f2e5aa2bb0c3e947b4cee (diff) |
RT# 77917 - fixed upgrade to work when all agents were selected.
Diffstat (limited to 'FS/FS/part_event_condition_option.pm')
-rw-r--r-- | FS/FS/part_event_condition_option.pm | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/FS/FS/part_event_condition_option.pm b/FS/FS/part_event_condition_option.pm index 15a6a55..f1d1b6a 100644 --- a/FS/FS/part_event_condition_option.pm +++ b/FS/FS/part_event_condition_option.pm @@ -146,14 +146,23 @@ sub _upgrade_data { #class method unless ( FS::upgrade_journal->is_done('agentnum_to_hash') ) { foreach my $condition_option (qsearch('part_event_condition_option', { optionname => 'agentnum', })) { + my %options; my $optionvalue = $condition_option->get("optionvalue"); if ($optionvalue eq 'HASH' ) { next; } + elsif ($optionvalue eq '') { + foreach my $agent (qsearch('agent', {})) { + $options{$agent->agentnum} = '1'; + } + + } else { - my $options = {"$optionvalue" => '1',}; - $condition_option->optionvalue(ref($options)); - my $error = $condition_option->replace($options); - die $error if $error; + $options{$optionvalue} = '1'; } + + $condition_option->optionvalue(ref(\%options)); + my $error = $condition_option->replace(\%options); + die $error if $error; + } FS::upgrade_journal->set_done('agentnum_to_hash'); |