summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-07-21 15:35:33 -0700
committerMark Wells <mark@freeside.biz>2014-07-21 15:35:40 -0700
commit8fdc0ea36474cfb3d1389f41691c14598559cbe7 (patch)
tree1984c9268d53df1edb76cf40575499cfb3e0d2c4 /bin
parent08db5f6900bb754efb597a2967adde4dbd12e731 (diff)
477 report rewrite, #28020
Diffstat (limited to 'bin')
-rwxr-xr-xbin/convert-477-options32
1 files changed, 20 insertions, 12 deletions
diff --git a/bin/convert-477-options b/bin/convert-477-options
index a52c56cc1..48a526421 100755
--- a/bin/convert-477-options
+++ b/bin/convert-477-options
@@ -6,11 +6,11 @@ use FS::Record qw(qsearch qsearchs dbh);
use FS::part_pkg_report_option;
use Text::CSV;
-adminsuidsetup($user) or die "invalid user '$user'";
-$FS::UID::AutoCommit = 1;
-$FS::Record::nowarn_classload = 1;
+if (!$user) {
+ print "
+Usage: bin/convert-477-options <username>
-print "This script will convert your per-package FCC 477 report options
+This script will convert your per-package FCC 477 report options
from the classic style (part IA, IB, IIA...) to the 2014 style.
This is an approximate conversion, and you should review the
resulting package settings for accuracy. In particular:
@@ -19,11 +19,17 @@ resulting package settings for accuracy. In particular:
- Broadband technologies for ADSL and cable modem will be set
to 'other ADSL' and 'other cable modem'. You should set
them to the specific ADSL or cable encapsulation in use.
- - The 'consumer grade' vs. 'business grade' classification
- was introduced in 2014 and will not be set.
-
-Configuring packages...
+ - All packages will be set to 'business grade'. The 'consumer grade'
+ category did not exist in previous versions of the report.
";
+ exit(1);
+}
+
+adminsuidsetup($user) or die "invalid user '$user'";
+$FS::UID::AutoCommit = 1;
+$FS::Record::nowarn_classload = 1;
+
+print "Configuring packages...\n";
my @min_download_speed = ( 0.2, 0.768, 1.5, 3, 6, 10, 25, 100 );
my @min_upload_speed = ( 0.1, @min_download_speed );
@@ -74,7 +80,9 @@ sub report_option_to_fcc_option {
technology => $technology[$1]);
} elsif ($formkey =~ /^part2a_row_option_(\d+)/) {
#local phone options
- return (split(':', $phone_option[$1]));
+ return (media => 'Copper', # sensible default
+ split(':', $phone_option[$1])
+ );
} elsif ($formkey =~ /^part2b_row_option_(\d+)/) {
#VoIP options (are all media types)
return (split(':', $voip_option[$1]));
@@ -86,7 +94,7 @@ sub report_option_to_fcc_option {
for my $part_pkg (qsearch('part_pkg', { freq => {op => '!=', value => '0'}})) {
my $pkgpart = $part_pkg->pkgpart;
- print "#$pkgpart\n";
+ #print "#$pkgpart\n";
my %report_opts = $part_pkg->options;
my @fcc_opts;
foreach my $optionname (keys(%report_opts)) {
@@ -113,12 +121,12 @@ for my $part_pkg (qsearch('part_pkg', { freq => {op => '!=', value => '0'}})) {
}
my %fcc_opts = @fcc_opts;
- print map {"\t$_\t".$fcc_opts{$_}."\n"} keys %fcc_opts;
+ #print map {"\t$_\t".$fcc_opts{$_}."\n"} keys %fcc_opts;
my $error = $part_pkg->process_fcc_options(\%fcc_opts);
if ( $error ) {
die "$error\n";
}
- print "\n";
+ #print "\n";
}
print "Finished.\n";