From 7bc780834a604a2e678d028f875fd4b546412cfb Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 11 Mar 2009 08:46:21 +0000 Subject: quick list of area codes and a kludge to print DA numbers for all of them --- bin/print-directory_assist | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 bin/print-directory_assist (limited to 'bin') diff --git a/bin/print-directory_assist b/bin/print-directory_assist new file mode 100755 index 000000000..210a16c60 --- /dev/null +++ b/bin/print-directory_assist @@ -0,0 +1,12 @@ +#!/usr/bin/perl -w + +use strict; + +my $acs = `cut -c1-3 ../etc/areacodes.txt`; + +my $plus = ''; +foreach my $npa ( split(/\n/, $acs ) ) { + warn $npa; + $plus .= $npa. '5551212 '; +} +print "$plus\n"; -- cgit v1.2.1 From 3cc8babac7a9a1ae9f6b20979a7787a94761a6ec Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 11 Mar 2009 08:57:01 +0000 Subject: comma --- bin/print-directory_assist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/print-directory_assist b/bin/print-directory_assist index 210a16c60..4c5e4a861 100755 --- a/bin/print-directory_assist +++ b/bin/print-directory_assist @@ -7,6 +7,6 @@ my $acs = `cut -c1-3 ../etc/areacodes.txt`; my $plus = ''; foreach my $npa ( split(/\n/, $acs ) ) { warn $npa; - $plus .= $npa. '5551212 '; + $plus .= $npa. '5551212,'; } print "$plus\n"; -- cgit v1.2.1 From 29c1d4f0ed46a2ff02353fdc6c0caf3553462f6e Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 15 Mar 2009 22:44:17 +0000 Subject: adding quick usage resetting tool --- bin/svc_acct-recalculate_usage | 110 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 bin/svc_acct-recalculate_usage (limited to 'bin') diff --git a/bin/svc_acct-recalculate_usage b/bin/svc_acct-recalculate_usage new file mode 100644 index 000000000..1b3955b21 --- /dev/null +++ b/bin/svc_acct-recalculate_usage @@ -0,0 +1,110 @@ +#!/usr/bin/perl -w + +use strict; +use vars qw($opt_s $opt_u $opt_p $opt_k); +use Getopt::Std; +use FS::UID qw(adminsuidsetup); +use FS::Record qw(qsearch qsearchs); +use FS::svc_acct; +use FS::cust_svc; + +my %field2sub = ( + 'seconds' => sub { + my($svc_acct, $cust_pkg) = @_; + $svc_acct->seconds_since_sqlradacct( $cust_pkg->last_bill, time ); + }, + 'upbytes' => sub { + my($svc_acct, $cust_pkg) = @_; + $svc_acct->attribute_since_sqlradacct( + $cust_pkg->last_bill, time, 'AcctInputOctets' ); + }, + 'downbytes' => sub { + my($svc_acct, $cust_pkg) = @_; + $svc_acct->attribute_since_sqlradacct( + $cust_pkg->last_bill, time, 'AcctOutputOctets' ); + }, + 'totalbytes' => sub { + my($svc_acct, $cust_pkg) = @_; + $svc_acct->attribute_since_sqlradacct( + $cust_pkg->last_bill, time, 'AcctInputOctets' ) + + + $svc_acct->attribute_since_sqlradacct( + $cust_pkg->last_bill, time, 'AcctOutputOctets' ) + ; + }, +); + +my $user = shift or die &usage; +adminsuidsetup $user; + +my $field = shift; +die "can only reset seconds, upbytes, downbytes or totalbytes" + unless $field2sub{$field}; + +my $value = shift; + +#false laziness w/freeside-reexport +getopts('s:u:p:k:'); + +my @svc_x = (); +if ( $opt_s ) { + my $cust_svc = qsearchs('cust_svc', { svcnum=>$opt_s } ) + or die "svcnum $opt_s not found\n"; + push @svc_x, $cust_svc->svc_x; +} elsif ( $opt_u ) { + my $svc_x = qsearchs('svc_acct', { username=>$opt_u } ) + or die "username $opt_u not found\n"; + push @svc_x, $svc_x; +} elsif ( $opt_p ) { + push @svc_x, map { $_->svc_x } qsearch('cust_svc', { svcpart=>$opt_p } ); + die "no services with svcpart $opt_p found\n" unless @svc_x; +} elsif ( $opt_k ) { + push @svc_x, + map { $_->svc_x } + qsearch({ + table => 'cust_svc', + addl_from => 'LEFT JOIN cust_pkg USING ( pkgnum )', + extra_sql => "WHERE pkgpart = $opt_k", + }); + die "no services with pkgpart $opt_k found\n" unless @svc_x; +} + +warn "setting $field to $value before usage\n"; +foreach my $svc_x ( @svc_x ) { + my $cust_pkg = $svc_x->cust_svc->cust_pkg; + my $cust_usage = $value - &{ $field2sub{$field} }( $svc_x, $cust_pkg ); +# warn "resetting ". $svc_x->svcnum.':'.$svc_x->username. " to $cust_usage\n"; + warn "$field for ". $svc_x->svcnum.':'.$svc_x->username. " reached limit\n" + if $cust_usage <= 0; + $svc_x->$field($cust_usage); + + my $error = $svc_x->replace; + die $error if $error; +} + +sub usage { + die "Usage:\n\n svc_acct-recalculate_usage user [ -s svcnum | -u username | -p svcpart ]\n"; +} + +=head1 NAME + +svc-acct-recalculate_usage - Command line tool to recalculate usage for existing services + +=head1 SYNOPSIS + + svc_acct-recalculate_usage user usagefield initialvalue [ -s svcnum | -u username | -p svcpart ] + + #recalculate a 1gb totalbytes limit for pkgpart 2 + svc_acct-recalculate_usage ivan totalbytes 1073741824 -k 2 + +=head1 DESCRIPTION + +Re-calculates the specified usage field for the specified service(s) (selected +by svcnum, username or svcpart). + +=head1 SEE ALSO + +L, L, L + +=cut + -- cgit v1.2.1 From 72d61f5de9e35ec0a01b62eff696ebbbb830846c Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 16 Mar 2009 15:52:17 +0000 Subject: a tool for migrating package elements to services --- bin/make-pkg-fruit | 172 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100755 bin/make-pkg-fruit (limited to 'bin') diff --git a/bin/make-pkg-fruit b/bin/make-pkg-fruit new file mode 100755 index 000000000..61d707f4a --- /dev/null +++ b/bin/make-pkg-fruit @@ -0,0 +1,172 @@ +#!/usr/bin/perl -w + +use strict; +use FS::UID qw( adminsuidsetup ); +use FS::Record qw( qsearch qsearchs ); +use FS::part_export; +use FS::export_svc; +use FS::pkg_svc; +use FS::part_svc; +use FS::part_pkg; +use FS::cust_svc; +use FS::svc_Common; +use FS::svc_broadband; +use FS::part_svc_router; + +my $exporttype = 'prizm'; +my $pkg_property = 'pkg'; +my $svc_property = 'performance_profile'; + +my $user = shift or die &usage; + +$FS::svc_Common::noexport_hack = 1; +$FS::cust_svc::ignore_quantity = 1; +$FS::UID::AutoCommit = 0; + +my $DEBUG = 0; + +my $dbh = adminsuidsetup($user); + +my @exportnum = map { $_->exportnum } + qsearch( 'part_export', { 'exporttype' => $exporttype } ); + +die "no $exporttype exports found\n" unless scalar(@exportnum); + +my %pkg_svc_map = (); + +my @old_svcpart = (); +push @old_svcpart, map { $_->svcpart } + qsearch ( 'export_svc', { 'exportnum' => $_ } ) + foreach @exportnum; + +die "no svcparts found\n" unless scalar(@old_svcpart); + +foreach (@old_svcpart) { + foreach my $pkg_svc ( qsearch( 'pkg_svc', + { 'svcpart' => $_, + 'quantity' => { 'op' => '>', + 'value' => '0', + }, + } + ) + ) + { + warn "updating package ". $pkg_svc->pkgpart. "\n" if $DEBUG; + my $pkg_from = $pkg_svc->part_pkg->$pkg_property; + unless ( $pkg_svc_map{ $pkg_from }{ $pkg_svc->svcpart } ) { + my $old_part_svc = $pkg_svc->part_svc; + my $part_svc = new FS::part_svc( { $old_part_svc->hash } ); + $part_svc->svcpart(''); + + my $svcdb = $part_svc->svcdb; + foreach ( $old_part_svc->all_part_svc_column ) { + my $formatter = FS::part_svc->svc_table_fields($svcdb)->{$_}->{format} + || sub { shift }; + + $part_svc->setfield( $svcdb.'__'.$_->columnname.'_flag', $_->columnflag); + $part_svc->setfield( $svcdb.'__'.$_->columnname, + &$formatter($_->columnvalue) + ); + } + + my $formatter = + FS::part_svc->svc_table_fields($svcdb)->{$svc_property}->{format} + || sub { shift }; + $part_svc->setfield( $svcdb.'__'.$svc_property.'_flag', 'F'); + $part_svc->setfield( $svcdb.'__'.$svc_property, + &$formatter($pkg_svc->part_pkg->$pkg_property) + ); + my $error = $part_svc->insert( [], + { map { $_->exportnum => 1 } + $old_part_svc->part_export + }, + ); + die "error inserting service: $error\n" if $error; + + # this part is specific to svc_broadband + foreach (qsearch( 'part_svc_router', { 'svcpart' => $pkg_svc->svcpart } )) + { + my $part_svc_router = new FS::part_svc_router( { $_->hash } ); + $part_svc_router->svcrouternum( '' ); + $part_svc_router->svcpart( $part_svc->svcpart ); + my $error = $part_svc_router->insert; + die "error associating service with router: $error\n" if $error; + } + + $pkg_svc_map{ $pkg_from }{ $pkg_svc->svcpart } = $part_svc->svcpart; + + } + + my $new_pkg_svc = new FS::pkg_svc( { $pkg_svc->hash } ); + $new_pkg_svc->svcpart( $pkg_svc_map{ $pkg_from }{ $pkg_svc->svcpart } ); + my $error = $pkg_svc->delete; + die "error removing old service from package: $error\n" if $error; + $error = $new_pkg_svc->insert; + die "error adding new service to package: $error\n" if $error; + + } +} +warn "done with packages\n" if $DEBUG; + +foreach my $svcpart ( @old_svcpart ) { + foreach my $cust_svc ( qsearch( 'cust_svc', { 'svcpart' => $svcpart } ) ) { + my $svc_x = $cust_svc->svc_x; + my $cust_pkg = $cust_svc->cust_pkg; + die "can't handle unattached service ". $cust_svc->svcnum unless $cust_pkg; + my $pkg_from = $cust_pkg->part_pkg->$pkg_property; + $svc_x->setfield( $svc_property, $pkg_from ); + $svc_x->setfield( 'svcpart', $pkg_svc_map{ $pkg_from }{ $svcpart } ); + my $error = $svc_x->replace; + die "error replacing service ". $svc_x->svcnum. ": $error\n" if $error; + + $cust_svc->svcpart( $pkg_svc_map{ $pkg_from }{ $svcpart } ); + $error = $cust_svc->replace; + die "error replacing customer service ". $cust_svc->svcnum. ": $error\n" + if $error; + } + + my $part_svc = qsearchs( 'part_svc', { 'svcpart' => $svcpart } ); + die "can't find old part_svc!" unless $part_svc; + + my $new_part_svc = new FS::part_svc( { $part_svc->hash } ); + $new_part_svc->disabled('Y'); + my $svcdb = $part_svc->svcdb; + foreach ( $part_svc->all_part_svc_column ) { + my $formatter = FS::part_svc->svc_table_fields($svcdb)->{$_}->{format} + || sub { shift }; + + $part_svc->setfield( $svcdb.'__'.$_->columnname.'_flag', $_->columnflag); + $part_svc->setfield( $svcdb.'__'.$_->columnname, + &$formatter($_->columnvalue) + ); + } + my $error = $new_part_svc->replace($part_svc, '1.3-COMPAT'); + die "error disabling service: $error\n" if $error; +} + +$dbh->commit or die $dbh->errstr; +$dbh->disconnect or die $dbh->errstr; + + +sub usage { + die "Usage:\n\n make-pkg-fruit user\n"; +} + +=head1 NAME + +make-pkg-fruit - Tool to migrate package properties to services + +=head1 SYNOPSIS + + make-pkg-fruit + +=head1 DESCRIPTION + +Multiplies out services with package properties and migrates package +definitions and customer services to the new services. Read the source. + +=head1 SEE ALSO + +=cut + +1; -- cgit v1.2.1 From 4e7273f1dee05cf62089ce43960313674b66fbcd Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 20 Mar 2009 02:14:17 +0000 Subject: adding quick remote ping & alert script, RT#4610 --- bin/ping | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 bin/ping (limited to 'bin') diff --git a/bin/ping b/bin/ping new file mode 100755 index 000000000..605a2047e --- /dev/null +++ b/bin/ping @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +use Net::Ping; +use Net::SSH qw( ssh_cmd ); +use Email::Send; + +my @other_hosts = ( 'freeside.biz', 'saturn5.com' ); + +my( $machine, @emails ) = @ARGV; +die "no notification email given" unless @emails; + +my $ping = new Net::Ping; # 'icmp'; #requires root + +my $pong = ''; +# can't tcp ping... $ping->ping($machine) and +$pong = eval { ssh_cmd('freeside@'.$machine, 'echo pong') }; +#(command ignored if authorized_keys setup w/command=) + +if ( $@ || $pong !~ /pong/ ) { #houston, we may have a problem + + #warn "can't reach $machine, checking @other_hosts\n"; + + #let's do a sanity check, can we see some other hosts? + exit unless grep $ping->ping($_), @other_hosts; + + #uh-oh, this is bad. + + #warn "checking to see if we've alerted on this recently\n"; + + #but we don't want to be too noisy, have we alerted on this in the last 24h? + my $file = "/tmp/alert-$machine"; + exit if -e $file && -M $file < 1; + + open(FILE, ">>$file"); + print FILE "emailing\n"; + close FILE; + + #warn "emailing alerts\n"; + + foreach my $email ( @emails ) { + + my $message = <<"__MESSAGE__"; +From: support\@freeside.biz +To: $email +Subject: ALERT - $machine + +ALERT: $machine appears to be down. + +__MESSAGE__ + + my $sender = Email::Send->new({mailer => 'SMTP'}); + $sender->mailer_args([Host => 'mail.freeside.biz']); + $sender->send($message); + + } + +} + -- cgit v1.2.1 From 48d92203f94f5592f1face92e3f1c74acf306a11 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 24 Mar 2009 09:42:13 +0000 Subject: quick tool for RT#3843 --- bin/countdeclines | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 bin/countdeclines (limited to 'bin') diff --git a/bin/countdeclines b/bin/countdeclines new file mode 100755 index 000000000..bbc392560 --- /dev/null +++ b/bin/countdeclines @@ -0,0 +1,22 @@ +#!/usr/bin/perl + +use Date::Parse; + +my $e = 'PlugnPay error: 97: Declined for CVV failure'; +my @y = (2008,2009); + +my $p = 0; + +foreach my $y (@y) { + foreach my $m (1..12) { + my $d = "$m/1/$y"; + my $t = str2time($d); + + #print "$pd-$d: SELECT count(*) from cust_bill_event where statustext = '$e' and _date >= $p and _date < $t;\n" + print "SELECT count(*) from cust_bill_event where statustext = '$e' and _date >= $p and _date < $t;\n" + if $p; + + $p = $t; + $pd = $d; + } +} -- cgit v1.2.1 From 8a79ead8b600494b214d7492dab043d5dfc96587 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 11 Apr 2009 21:42:52 +0000 Subject: migrate send_email, suspend_if_balance and credit events, RT#3905 --- bin/freeside-migrate-events | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'bin') diff --git a/bin/freeside-migrate-events b/bin/freeside-migrate-events index 76643b886..4b46393eb 100644 --- a/bin/freeside-migrate-events +++ b/bin/freeside-migrate-events @@ -16,20 +16,20 @@ my %plan2action = ( 'fee' => 'fee', 'fee_percent' => 'NOTYET', #XXX need fee_percent action 'suspend' => 'suspend', - 'suspend-if-balance' => 'NOTYET', #XXX "if balance" becomes a balance condition + 'suspend-if-balance' => 'suspend', #"if balance" becomes the balance cond 'suspend-if-pkgpart' => 'suspend_if_pkgpart', 'suspend-unless-pkgpart' => 'suspend_unless_pkgpart', 'cancel' => 'cancel', 'addpost' => 'addpost', 'comp' => 'NOTYET', #XXX or N/A or something - 'credit' => 'NOTYET', + 'credit' => 'writeoff', 'realtime-card' => 'cust_bill_realtime_card', 'realtime-check' => 'cust_bill_realtime_check', 'realtime-lec' => 'cust_bill_realtime_lec', 'batch-card' => 'cust_bill_batch', #?'retriable' => 'send' => 'cust_bill_send', - 'send_email' => 'NOTYET', + 'send_email' => 'cust_bill_email', 'send_alternate' => 'cust_bill_send_alternate', 'send_if_newest' => 'cust_bill_send_if_newest', 'send_agent' => 'cust_bill_send_agent', @@ -64,7 +64,15 @@ foreach my $part_bill_event ( my %plandata = map { /^(\w+) (.*)$/; ($1, $2); } split(/\n/, $part_bill_event->plandata); - #XXX may need to fudge some plandata2option names!!! + #XXX may need to fudge some other plandata2option names + + my $balanceover = 0; + my $honor_dundate = 0; + + if ( $part_bill_event->plan eq 'suspend-if-balance' ) { + $balanceover = delete $plandata{'balanceover'}; + $honor_dundate = ( (delete $plandata{'balance_honor_dundate'}) =~ /1/ ); + } my $part_event = new FS::part_event { 'event' => $part_bill_event->event, @@ -86,12 +94,12 @@ foreach my $part_bill_event ( }; $error = $once->insert; die $error if $error; - + my $balance = new FS::part_event_condition { 'eventpart' => $part_event->eventpart, 'conditionname' => 'balance' }; - $error = $balance->insert( 'balance' => 0 ); + $error = $balance->insert( 'balance' => $balanceover ); die $error if $error; my $cust_bill_owed = new FS::part_event_condition { @@ -118,6 +126,15 @@ foreach my $part_bill_event ( die $error if $error; } + + if ( $honor_dundate ) { + my $dundate = new FS::part_event_condition { + 'eventpart' => $part_event->eventpart, + 'conditionname' => 'dundate' + }; + $error = $dundate->insert(); + die $error if $error; + } #my $derror = $part_bill_event->delete; #die "error removing part_bill_event: $derror\n" if $derror; -- cgit v1.2.1 From 246c311ac0ca7c41c571cfbc434bafd7c5d2768c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 17 Apr 2009 23:30:57 +0000 Subject: something to wipe the CVV from very large databases --- bin/fs-migrate-cust_tax_exempt | 2 +- bin/h_cust_main-wipe_paycvv | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 bin/h_cust_main-wipe_paycvv (limited to 'bin') diff --git a/bin/fs-migrate-cust_tax_exempt b/bin/fs-migrate-cust_tax_exempt index ede80b08e..35c74ffab 100755 --- a/bin/fs-migrate-cust_tax_exempt +++ b/bin/fs-migrate-cust_tax_exempt @@ -23,7 +23,7 @@ my $fuz = 7; #seconds #site-specific rewrites my %rewrite = ( #cust_tax_exempt.exemptnum => { 'field' => 'newvalue', ... }, - '23' => { month=>10, year=>2005, invnum=>1640 }, +# '23' => { month=>10, year=>2005, invnum=>1640 }, #etc. ); diff --git a/bin/h_cust_main-wipe_paycvv b/bin/h_cust_main-wipe_paycvv new file mode 100755 index 000000000..d34c15f34 --- /dev/null +++ b/bin/h_cust_main-wipe_paycvv @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use strict; +use FS::UID qw(adminsuidsetup dbh); +use FS::Record; #buh? + +my $user = shift or die 'usage'; +adminsuidsetup $user; + +while (1) { + + my $sql = ' UPDATE h_cust_main SET paycvv = NULL + WHERE historynum IN ( SELECT historynum FROM h_cust_main + WHERE paycvv IS NOT NULL LIMIT 8192 )'; +# WHERE paycvv IS NOT NULL LIMIT 1 )'; + + my $sth = dbh->prepare($sql) or die dbh->errstr; + + print '.'; $|=1; + + my $rv = $sth->execute; + + dbh->commit or die dbh->errstr; + + last if $rv == 0; + +} + +print "\n"; + -- cgit v1.2.1 From b86387055e7d7dcd7cfe6d0620bfec7c4acb7583 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 19 Apr 2009 23:52:36 +0000 Subject: warning about this not terminating --- bin/h_cust_main-wipe_paycvv | 1 + 1 file changed, 1 insertion(+) (limited to 'bin') diff --git a/bin/h_cust_main-wipe_paycvv b/bin/h_cust_main-wipe_paycvv index d34c15f34..59c9d0819 100755 --- a/bin/h_cust_main-wipe_paycvv +++ b/bin/h_cust_main-wipe_paycvv @@ -22,6 +22,7 @@ while (1) { dbh->commit or die dbh->errstr; + #hmm... doesn't work well, sometimes runs forever, wtf last if $rv == 0; } -- cgit v1.2.1 From 591abf0ef3819c892a61a71042b285b4215ebb1a Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 19 Apr 2009 23:55:48 +0000 Subject: no, it was only cause their db is somehow corrupt --- bin/h_cust_main-wipe_paycvv | 1 - 1 file changed, 1 deletion(-) (limited to 'bin') diff --git a/bin/h_cust_main-wipe_paycvv b/bin/h_cust_main-wipe_paycvv index 59c9d0819..d34c15f34 100755 --- a/bin/h_cust_main-wipe_paycvv +++ b/bin/h_cust_main-wipe_paycvv @@ -22,7 +22,6 @@ while (1) { dbh->commit or die dbh->errstr; - #hmm... doesn't work well, sometimes runs forever, wtf last if $rv == 0; } -- cgit v1.2.1 From ae8f98d14eb70d671e808d41167ae6afb2ee7053 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 3 May 2009 00:40:50 +0000 Subject: confdiff --- bin/confdiff | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 bin/confdiff (limited to 'bin') diff --git a/bin/confdiff b/bin/confdiff new file mode 100755 index 000000000..5b6af859e --- /dev/null +++ b/bin/confdiff @@ -0,0 +1,27 @@ +#!/usr/bin/perl + +use FS::UID qw(adminsuidsetup); +use FS::Conf; + +adminsuidsetup('ivan'); + +my $conf = new FS::Conf; + +my $file2 = pop @ARGV; +my $file1 = pop @ARGV; + +open(FILE1, ">/tmp/$file1") or die "can't open /tmp/$file1: $!"; +print FILE1 $conf->config($file1); +print FILE1 "\n"; +close FILE1 or die $!; + +open(FILE2, ">/tmp/$file2") or die "can't open /tmp/$file2: $!"; +print FILE2 $conf->config($file2); +print FILE2 "\n"; +close FILE2 or die $!; + +my @opt = @ARGV; + +system('diff', @opt, "/tmp/$file1", "/tmp/$file2"); + +#unlink("/tmp/$file1', "/tmp/$file2"); -- cgit v1.2.1 From 4c13f5c6bb96b79087bdbc2f3a424dac02e9f998 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 4 May 2009 18:33:48 +0000 Subject: this is a quick hack to rebill customers when a cdr didn't happen --- bin/cust_main_special.pm | 776 +++++++++++++++++++++++++++++++++++++++++++++++ bin/rebill | 132 ++++++++ 2 files changed, 908 insertions(+) create mode 100644 bin/cust_main_special.pm create mode 100755 bin/rebill (limited to 'bin') diff --git a/bin/cust_main_special.pm b/bin/cust_main_special.pm new file mode 100644 index 000000000..1f3203e1d --- /dev/null +++ b/bin/cust_main_special.pm @@ -0,0 +1,776 @@ +package cust_main_special; + +require 5.006; +use strict; +use vars qw( @ISA $DEBUG $me $conf ); +use Safe; +use Carp; +use Data::Dumper; +use Date::Format; +use FS::UID qw( dbh ); +use FS::Record qw( qsearchs qsearch ); +use FS::payby; +use FS::cust_pkg; +use FS::cust_bill; +use FS::cust_bill_pkg; +use FS::cust_bill_pkg_display; +use FS::cust_bill_pkg_tax_location; +use FS::cust_main_county; +use FS::cust_location; +use FS::tax_rate; +use FS::cust_tax_location; +use FS::part_pkg_taxrate; +use FS::queue; +use FS::part_pkg; + +@ISA = qw ( FS::cust_main ); + +$DEBUG = 0; +$me = '[emergency billing program]'; + +$conf = new FS::Conf; + +=head1 METHODS + +=over 4 + +=item bill_and_collect + +Cancels and suspends any packages due, generates bills, applies payments and +cred + +Warns on errors (Does not currently: If there is an error, returns the error, otherwise returns false.) + +Options are passed as name-value pairs. Currently available options are: + +=over 4 + +=item time + +Bills the customer as if it were that time. Specified as a UNIX timestamp; see L). Also see L and L for conversion functions. For example: + + use Date::Parse; + ... + $cust_main->bill( 'time' => str2time('April 20th, 2001') ); + +=item invoice_time + +Used in conjunction with the I