add -t flag to bulk void for payment type, RT#73413
authorIvan Kohler <ivan@freeside.biz>
Wed, 16 Nov 2016 17:38:57 +0000 (09:38 -0800)
committerIvan Kohler <ivan@freeside.biz>
Wed, 16 Nov 2016 17:38:57 +0000 (09:38 -0800)
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};
 
-my $date = " WHERE _date >= $opt{start} AND _date <= $opt{end}";
-
 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',