blob: d2b6efe0be0c26b95fde3ae501ffc4290f2e4470 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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::prune 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
|