[freeside-commits] branch master updated. 17a3178440ad657665657896fa6ae6d94a8d4e61

Christopher Burger burgerc at freeside.biz
Tue Jun 5 05:50:43 PDT 2018


The branch, master has been updated
       via  17a3178440ad657665657896fa6ae6d94a8d4e61 (commit)
      from  e928101f860813b7485e79ea549e736f69c50948 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 17a3178440ad657665657896fa6ae6d94a8d4e61
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Tue Jun 5 08:50:17 2018 -0400

    RT# 77917 - fixed upgrade to work when all agents were selected.

diff --git a/FS/FS/part_event_condition_option.pm b/FS/FS/part_event_condition_option.pm
index 15a6a5553..f1d1b6a15 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');

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_event_condition_option.pm | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list