X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg_option.pm;h=2858ba788be2e136157f2777e49919b2e7a6e1bc;hp=c2f609e1b8de42fa49dde27001e2d87e5f70e2eb;hb=a36e0f8a0f69349dafaa16d1d2d57dfb6e5dbc85;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1 diff --git a/FS/FS/part_pkg_option.pm b/FS/FS/part_pkg_option.pm index c2f609e1b..2858ba788 100644 --- a/FS/FS/part_pkg_option.pm +++ b/FS/FS/part_pkg_option.pm @@ -1,12 +1,10 @@ package FS::part_pkg_option; +use base qw(FS::Record); use strict; -use vars qw( @ISA ); -use FS::Record qw( qsearch qsearchs ); +use FS::Record qw( dbh ); # qw( qsearch qsearchs dbh ); use FS::part_pkg; -@ISA = qw(FS::Record); - =head1 NAME FS::part_pkg_option - Object methods for part_pkg_option records @@ -117,6 +115,34 @@ sub check { =back +=cut + +# +# Used by FS::Upgrade to migrate to a new database. +# +# + +sub _upgrade_data { # class method + my ($class, %opts) = @_; + + my $sql = "UPDATE part_pkg_option SET optionname = 'recur_fee'". + " WHERE optionname = 'recur_flat'"; + my $sth = dbh->prepare($sql) or die dbh->errstr; + $sth->execute or die $sth->errstr; + + $sql = "UPDATE part_pkg_option SET optionname = 'recur_method',". + "optionvalue = 'prorate' WHERE optionname = 'enable_prorate'"; + $sth = dbh->prepare($sql) or die dbh->errstr; + $sth->execute or die $sth->errstr; + + $sql = "UPDATE part_pkg_option SET optionvalue = NULL WHERE ". + "optionname = 'contract_end_months' AND optionvalue = '(none)'"; + $sth = dbh->prepare($sql) or die dbh->errstr; + $sth->execute or die $sth->errstr; + ''; + +} + =head1 BUGS Possibly.