summaryrefslogtreecommitdiff
path: root/FS/bin/freeside-apply-credits
blob: eb5c1f489f35891fcbc43a5b898c706608d1baab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl -Tw

use strict;
use lib "/usr/lib/perl5/site_perl/5.005/FSTest2";
use vars qw( $user $cust_main @customers );
use FS::UID qw(adminsuidsetup);
use FS::Record qw(qsearch);
use FS::cust_main;

$user = shift or die &usage;
&adminsuidsetup( $user );

my @customers = qsearch('cust_main', {} );
die "No customers" unless (scalar(@customers) > 0);

foreach $cust_main (@customers) {
  print "Applying credits for customer #". $cust_main->custnum;
  $cust_main->apply_credits;
}