}
}
+use FS::upgrade_journal;
+sub _upgrade_data { #class method
+ my ($class, %opts) = @_;
+
+ # migrate part_event_condition_option agentnum to part_event_condition_option_option agentnum
+ 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 {
+ $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');
+
+ }
+
+}
+
=back
=head1 SEE ALSO