add -t flag to bulk void for payment type, RT#73413
[freeside.git] / bin / bulk_void
index b12b5a9..8f0c882 100755 (executable)
@@ -32,11 +32,12 @@ if (!$opt{start} or !$opt{end} or !$opt{r}) {
 
 print "DRY RUN--changes will not be committed.\n" unless $opt{X};
 
 
 print "DRY RUN--changes will not be committed.\n" unless $opt{X};
 
-my $date = " WHERE _date >= $opt{start} AND _date <= $opt{end}";
-
 my %search = ();
 $search{payby} = $opt{t} if $opt{t} && $opt{p};
 
 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',
 my %tables = (
   c => 'cust_credit',
   p => 'cust_pay',