summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authormark <mark>2010-12-08 00:36:18 +0000
committermark <mark>2010-12-08 00:36:18 +0000
commitdf2bf964527e0b5596af471b1b7d84d14305b2a2 (patch)
tree8b813e236f19a37691cc3e33a4fd432e55ac66f2 /FS/FS
parent49929cc03fc06813446ed61fe25b8b6583ca91ce (diff)
fix incorrect bill dates from prorate, RT#10830
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/cust_pkg.pm18
1 files changed, 15 insertions, 3 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index a946de4da..e3f4777aa 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -3329,9 +3329,21 @@ sub bulk_change {
sub _upgrade_data { # class method
my ($class, %opts) = @_;
$class->_upgrade_otaker(%opts);
- my $sql =('UPDATE cust_pkg SET contract_end = NULL WHERE contract_end = -1');
- my $sth = dbh->prepare($sql);
- $sth->execute or die $sth->errstr;
+ my @statements = (
+ # RT#10139, bug resulting in contract_end being set when it shouldn't
+ 'UPDATE cust_pkg SET contract_end = NULL WHERE contract_end = -1',
+ # RT#10830, bad calculation of prorate date near end of year
+ # the date range for bill is December 2009, and we move it forward
+ # one year if it's before the previous bill date (which it should
+ # never be)
+ 'UPDATE cust_pkg SET bill = bill + (365*24*60*60) WHERE bill < last_bill
+ AND bill > 1259654400 AND bill < 1262332800 AND (SELECT plan FROM part_pkg
+ WHERE part_pkg.pkgpart = cust_pkg.pkgpart) = \'prorate\'',
+ );
+ foreach my $sql (@statements) {
+ my $sth = dbh->prepare($sql);
+ $sth->execute or die $sth->errstr;
+ }
}
=back