diff options
author | jeff <jeff> | 2007-03-01 05:13:13 +0000 |
---|---|---|
committer | jeff <jeff> | 2007-03-01 05:13:13 +0000 |
commit | 16a91fd700e3c3e5ec051d2c3692275f9389aab4 (patch) | |
tree | 27ed264c600af0cccdd8b1ecdc9d89efc6e843a6 /FS/bin | |
parent | 9bf32910a845c3e720d9b511fd9c3b7b0f580fb4 (diff) |
dangling cust_credit_refund not allowed
Diffstat (limited to 'FS/bin')
-rwxr-xr-x | FS/bin/freeside-prune-applications | 63 | ||||
-rwxr-xr-x | FS/bin/freeside-upgrade | 8 |
2 files changed, 71 insertions, 0 deletions
diff --git a/FS/bin/freeside-prune-applications b/FS/bin/freeside-prune-applications new file mode 100755 index 000000000..b459da55e --- /dev/null +++ b/FS/bin/freeside-prune-applications @@ -0,0 +1,63 @@ +#!/usr/bin/perl -w + +use strict; +use vars qw($opt_d $opt_q $opt_v); # $opt_n instead of $opt_d? +use vars qw($DEBUG $DRY_RUN); +use Getopt::Std; +use FS::UID qw(adminsuidsetup checkeuid); +use FS::Misc qw(prune_applications); + +die "Not running uid freeside!" unless checkeuid(); + +getopts("dq"); + +$DEBUG = !$opt_q; +#$DEBUG = $opt_v; + +$DRY_RUN = $opt_d; + +my $user = shift or die &usage; +my $dbh = adminsuidsetup($user); + +my $hashref = {}; + +$hashref->{dry_run} = 1 if $DRY_RUN; +$hashref->{debug} = 1 if $DEBUG; + +print join "\n", prune_applications($hashref); +print "\n" if $DRY_RUN; + +$dbh->commit or die $dbh->errstr; + +### + +sub usage { + die "Usage:\n freeside-prune-applications [ -d ] [ -q | -v ] user\n"; +} + +=head1 NAME + +freeside-prune-applications - Removes stray applications of credit, payment to + bills, refunds, etc. + +=head1 SYNOPSIS + + freeside-prune-applications [ -d ] [ -q | -v ] + +=head1 DESCRIPTION + +Reads your existing database schema and updates it to match the current schema, +adding any columns or tables necessary. + + [ -d ]: Dry run; display affected records (to STDOUT) only, but do not + remove them. + + [ -q ]: Run quietly. This may become the default at some point. + + [ -v ]: Run verbosely, sending debugging information to STDERR. This is the + current default. + +=head1 SEE ALSO + +=cut + diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade index 5c646fec2..db58c117c 100755 --- a/FS/bin/freeside-upgrade +++ b/FS/bin/freeside-upgrade @@ -8,6 +8,7 @@ use DBIx::DBSchema 0.31; use FS::UID qw(adminsuidsetup checkeuid datasrc ); #getsecrets); use FS::CurrentUser; use FS::Schema qw( dbdef dbdef_dist reload_dbdef ); +use FS::Misc qw(prune_applications); die "Not running uid freeside!" unless checkeuid(); @@ -40,6 +41,13 @@ if ( $DRY_RUN ) { dbdef->update_schema( dbdef_dist, $dbh ); } +my $hashref = {}; +$hashref->{dry_run} = 1 if $DRY_RUN; +$hashref->{debug} = 1 if $DEBUG; +print join "\n", prune_applications($hashref); +print "\n" if $DRY_RUN; + + $dbh->commit or die $dbh->errstr; dbdef_create($dbh, $dbdef_file); |