X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Fbulk_void;h=8f0c882a8032a4a6d4f6c406486afc4d96ea5378;hp=c75da5d16ddda7596b613f0301dcdc473a4fdb6c;hb=29d80a8582103ead0b5910391cabc45cb85fa836;hpb=69a70c66135ece60c08584cf3b931b4ff141c47a diff --git a/bin/bulk_void b/bin/bulk_void index c75da5d16..8f0c882a8 100755 --- a/bin/bulk_void +++ b/bin/bulk_void @@ -6,7 +6,7 @@ use vars qw( %opt ); use FS::Misc::Getopt; use FS::Record qw(qsearch qsearchs dbh); -getopts('s:e:cpiXr:t:'); +getopts('cpiXr:t:'); my $dbh = dbh; $FS::UID::AutoCommit = 0; @@ -26,17 +26,18 @@ sub usage() { "; } -if (!$opt{s} or !$opt{e} or !$opt{r}) { +if (!$opt{start} or !$opt{end} or !$opt{r}) { die usage; } print "DRY RUN--changes will not be committed.\n" unless $opt{X}; -my $date = " WHERE _date >= $opt{s} AND _date <= $opt{e}"; - my %search = (); $search{payby} = $opt{t} if $opt{t} && $opt{p}; +my $date = (keys %search ? ' AND ' : ' WHERE '). + " _date >= $opt{start} AND _date <= $opt{end}"; + my %tables = ( c => 'cust_credit', p => 'cust_pay',