removing legacy part_pkg fields
authorivan <ivan>
Wed, 14 Sep 2011 19:26:37 +0000 (19:26 +0000)
committerivan <ivan>
Wed, 14 Sep 2011 19:26:37 +0000 (19:26 +0000)
FS/FS/Schema.pm
FS/FS/part_pkg.pm

index 187887f..694498e 100644 (file)
@@ -576,6 +576,7 @@ sub tables_hashref {
         'seconds',     'int', 'NULL', '', '', '', 
         'weight',      'int', '', '', '', '', 
         'plan',       'varchar', 'NULL', $char_d, '', '', 
+        'plandata',   'text', 'NULL', '', '', '', 
         'reason',     'int', 'NULL', '', '', '', 
         'disabled',     'char', 'NULL', 1, '', '', 
       ],
@@ -1624,7 +1625,6 @@ sub tables_hashref {
         'setuptax',      'char', 'NULL', 1, '', '', 
         'recurtax',      'char', 'NULL', 1, '', '', 
         'plan',          'varchar', 'NULL', $char_d, '', '', 
-        'plandata',      'text', 'NULL', '', '', '', 
         'disabled',      'char', 'NULL', 1, '', '', 
         'custom',        'char', 'NULL', 1, '', '', 
         'taxclass',      'varchar', 'NULL', $char_d, '', '', 
index 70b896c..44db547 100644 (file)
@@ -1362,8 +1362,6 @@ sub _upgrade_data { # class method
   my @part_pkg = qsearch({
     'table'     => 'part_pkg',
     'extra_sql' => "WHERE ". join(' OR ',
-                     ( map "($_ IS NOT NULL AND $_ != '' )",
-                           qw( plandata setup recur ) ),
                      'plan IS NULL', "plan = '' ",
                    ),
   });
@@ -1374,43 +1372,7 @@ sub _upgrade_data { # class method
       $part_pkg->plan('flat');
     }
 
-    if ( length($part_pkg->option('setup_fee')) == 0 
-         && $part_pkg->setup =~ /^\s*([\d\.]+)\s*$/ ) {
-
-      my $opt = new FS::part_pkg_option {
-        'pkgpart'     => $part_pkg->pkgpart,
-        'optionname'  => 'setup_fee',
-        'optionvalue' => $1,
-      };
-      my $error = $opt->insert;
-      die $error if $error;
-
-
-      #} else {
-      #  die "Can't parse part_pkg.setup for fee; convert pkgnum ".
-      #      $part_pkg->pkgnum. " manually: ". $part_pkg->setup. "\n";
-    }
-    $part_pkg->setup('');
-
-    if ( length($part_pkg->option('recur_fee')) == 0
-         && $part_pkg->recur =~ /^\s*([\d\.]+)\s*$/ ) {
-
-        my $opt = new FS::part_pkg_option {
-          'pkgpart'     => $part_pkg->pkgpart,
-          'optionname'  => 'recur_fee',
-          'optionvalue' => $1,
-        };
-        my $error = $opt->insert;
-        die $error if $error;
-
-
-      #} else {
-      #  die "Can't parse part_pkg.setup for fee; convert pkgnum ".
-      #      $part_pkg->pkgnum. " manually: ". $part_pkg->setup. "\n";
-    }
-    $part_pkg->recur('');
-
-    $part_pkg->replace; #this should take care of plandata, right?
+    $part_pkg->replace;
 
   }