diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cust_main.restore-paymask | 6 | ||||
-rwxr-xr-x | bin/fakesmtpserver.pl | 11 | ||||
-rwxr-xr-x | bin/move_svc_broadband_speeds.pl | 66 |
3 files changed, 78 insertions, 5 deletions
diff --git a/bin/cust_main.restore-paymask b/bin/cust_main.restore-paymask index c6c8a75ec..14dddd1b5 100755 --- a/bin/cust_main.restore-paymask +++ b/bin/cust_main.restore-paymask @@ -15,10 +15,14 @@ foreach my $cust_main ( my $custnum = $cust_main->custnum; + my $paydate = $cust_main->paydate; + my $paymask = FS::Record->scalar_sql(qq[ - SELECT paymask FROM h_cust_main WHERE custnum = $custnum AND history_action = 'replace_old' AND paymask IS NOT NULL AND paymask != 'N/A (tokenized)' ORDER BY historynum desc LIMIT 1 + SELECT paymask FROM h_cust_main WHERE custnum = $custnum AND history_action = 'replace_old' AND paymask IS NOT NULL AND paymask != 'N/A (tokenized)' AND paydate = '$paydate' ORDER BY historynum desc LIMIT 1 ]); + next unless length($paymask); + #dbh->do( print qq[UPDATE cust_main SET paymask = '$paymask' WHERE custnum = $custnum;] diff --git a/bin/fakesmtpserver.pl b/bin/fakesmtpserver.pl index 1f2ca3f31..5da6cb5cb 100755 --- a/bin/fakesmtpserver.pl +++ b/bin/fakesmtpserver.pl @@ -10,6 +10,9 @@ it could be updated to fork on client connections. When an e-mail is delivered, the TO and FROM are printed to STDOUT. The TO, FROM and MSG are saved to a file in $message_save_dir +Open a saved .eml file with Mozilla Thunderbird (or other mail clients) +to review e-mail with all html/pdf attachments + =cut use strict; @@ -33,21 +36,21 @@ while(my $conn = $server->accept()) { $client->process || next; - open my $fh, '>', $message_save_dir.'/'.time().'.txt' + open my $fh, '>', $message_save_dir.'/'.time().'.eml' or die "error: $!"; for my $f (qw/TO FROM/) { if (ref $client->{$f} eq 'ARRAY') { print "$f: $_\n" for @{$client->{$f}}; - print $fh "$f: $_\n" for @{$client->{$f}}; + # print $fh "$f: $_\n" for @{$client->{$f}}; } else { print "$f: $client->{$f}\n"; - print $fh "$f: $client->{$f}\n"; + # print $fh "$f: $client->{$f}\n"; } } - print $fh "\n\n$client->{MSG}\n"; + print $fh "$client->{MSG}\n"; print "\n"; close $fh; } diff --git a/bin/move_svc_broadband_speeds.pl b/bin/move_svc_broadband_speeds.pl new file mode 100755 index 000000000..7d20ef68a --- /dev/null +++ b/bin/move_svc_broadband_speeds.pl @@ -0,0 +1,66 @@ +#!/usr/bin/perl + +use strict; +use FS::UID qw(adminsuidsetup); +use FS::Record qw(qsearchs qsearch); +use FS::svc_broadband; + +my $user = shift or die &usage; +my $dbh = adminsuidsetup($user); + +my $fcc_up_speed = "(select part_pkg_fcc_option.optionvalue from part_pkg_fcc_option where fccoptionname = 'broadband_upstream' and pkgpart = cust_pkg.pkgpart) AS fcc477_upstream"; +my $fcc_down_speed = "(select part_pkg_fcc_option.optionvalue from part_pkg_fcc_option where fccoptionname = 'broadband_downstream' and pkgpart = cust_pkg.pkgpart) AS fcc477_downstream"; + +foreach my $rec (qsearch({ + 'select' => 'svc_broadband.*, cust_svc.svcpart, cust_pkg.pkgpart, '.$fcc_up_speed.', '.$fcc_down_speed, + 'table' => 'svc_broadband', + 'addl_from' => 'LEFT JOIN cust_svc USING ( svcnum ) LEFT JOIN cust_pkg USING ( pkgnum )', +})) { + $rec->{Hash}->{speed_test_up} = $rec->{Hash}->{speed_up} ? $rec->{Hash}->{speed_up} : "null"; + $rec->{Hash}->{speed_test_down} = $rec->{Hash}->{speed_down} ? $rec->{Hash}->{speed_down} : "null"; + $rec->{Hash}->{speed_up} = $rec->{Hash}->{fcc477_upstream} ? $rec->{Hash}->{fcc477_upstream} * 1000 : "null"; + $rec->{Hash}->{speed_down} = $rec->{Hash}->{fcc477_downstream} ? $rec->{Hash}->{fcc477_downstream} * 1000 : "null"; + + my $sql = "UPDATE svc_broadband set + speed_up = $rec->{Hash}->{speed_up}, + speed_down = $rec->{Hash}->{speed_down}, + speed_test_up = $rec->{Hash}->{speed_test_up}, + speed_test_down = $rec->{Hash}->{speed_test_down} + WHERE svcnum = $rec->{Hash}->{svcnum}"; + + warn "Fixing broadband service speeds for service ".$rec->{Hash}->{svcnum}."-".$rec->{Hash}->{description}."\n"; + + my $sth = $dbh->prepare($sql) or die $dbh->errstr; + $sth->execute or die $sth->errstr; + +} + +$dbh->commit; + +warn "Completed fixing broadband service speeds!\n"; + +exit; + +=head1 NAME + +move_svc_broadband_speeds + +=head1 SYNOPSIS + + move_svc_broadband_speeds.pl [ user ] + +=head1 DESCRIPTION + +Moves value for speed_down to speed_test_down, speed_up to speed_test_up, +and sets speed_down, speed_up to matching fcc_477 speeds from package for +all svc_broadband services. + +user: freeside username + +=head1 BUGS + +=head1 SEE ALSO + +L<FS::svc_broadband> + +=cut
\ No newline at end of file |