summaryrefslogtreecommitdiff
path: root/bin/cust_pay-delete
blob: e266d0daacb5be9d34e319141d4afd53cfc6589a (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
#!/usr/bin/perl

use FS::UID qw( adminsuidsetup );
use FS::Record qw( qsearch );
use FS::cust_pay;

adminsuidsetup shift or die usage();

my $custnum = shift or die usage();

my $paid = shift or die usage();

my $min_paynum = shift or die usage();

my @cust_pay = qsearch({
  'table'   => 'cust_pay',
  'hashref' => { 'custnum' => $custnum,
                 'paid'    => $paid,
                 'paynum'  => { op=>'>=', value=>$min_paynum, },
                 'payinfo' => '',
               },
});

die "Delete ". scalar(@cust_pay). " payments?\n";

#foreach my $cust_pay (@cust_pay) {
#  my $error = $cust_pay->delete;
#  die $error if $error;
#}

sub usage {
  "Usage: cust_pay delete username custnum paid min_paynum\n";
}