[freeside-commits] branch master updated. fb385e8010a75583e7994433e2733cb9c2d2c486
Carl J. Adams-Collier
cjac at 420.am
Tue Sep 16 16:50:29 PDT 2014
The branch, master has been updated
via fb385e8010a75583e7994433e2733cb9c2d2c486 (commit)
from edea94b6bd41a3fceac47267a3df3dc7fcf7c565 (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 fb385e8010a75583e7994433e2733cb9c2d2c486
Author: C.J. Adams-Collier <cjac at colliertech.org>
Date: Tue Sep 16 16:48:22 2014 -0700
FS RT #28105 - alter payment plan options at upgrade - multiply dollars by 1k, divide totals and caps by 1k
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 59bc051..005d69d 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -1771,7 +1771,7 @@ sub parse {
# Used by FS::Upgrade to migrate to a new database.
sub _upgrade_data { # class method
- my($class, %opts) = @_;
+ my($class, %opts) = @_;
warn "[FS::part_pkg] upgrading $class\n" if $DEBUG;
@@ -1791,6 +1791,56 @@ sub _upgrade_data { # class method
$part_pkg->replace;
}
+
+ # Convert RADIUS accounting usage metrics from megabytes to gigabytes
+ # (FS RT#28105)
+ my $upgrade = 'part_pkg_gigabyte_usage';
+ if (!FS::upgrade_journal->is_done($upgrade)) {
+ foreach my $part_pkg (qsearch('part_pkg',
+ { plan => 'sqlradacct_hour' })
+ ){
+
+ my $pkgpart = $part_pkg->pkgpart;
+
+ foreach my $opt (qsearch('part_pkg_option',
+ { 'optionname' => { op => 'LIKE',
+ value => 'recur_included_%',
+ },
+ pkgpart => $pkgpart,
+ })){
+
+ next if $opt->optionname eq 'recur_included_hours'; # unfortunately named field
+ next if $opt->optionvalue == 0;
+
+ $opt->optionvalue($opt->optionvalue / 1024);
+
+ my $error = $opt->replace;
+ die $error if $error;
+ }
+
+ foreach my $optionname( qw(
+ recur_hourly_%
+ recur_input_%
+ recur_output_%
+ recur_total_%
+ ) ){
+ foreach my $opt (qsearch('part_pkg_option',
+ { 'optionname' => { op => 'LIKE',
+ value => $optionname,
+ },
+ pkgpart => $pkgpart,
+ })){
+ $opt->optionvalue($opt->optionvalue * 1024);
+
+ my $error = $opt->replace;
+ die $error if $error;
+ }
+ }
+
+ }
+ FS::upgrade_journal->set_done($upgrade);
+ }
+
# the rest can be done asynchronously
}
-----------------------------------------------------------------------
Summary of changes:
FS/FS/part_pkg.pm | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 51 insertions(+), 1 deletion(-)
More information about the freeside-commits
mailing list