DO open a database connection in the parent process, this cached the $dbdef and speed...
[freeside.git] / FS / bin / freeside-apply-credits
1 #!/usr/bin/perl -Tw
2
3 use strict;
4 use vars qw( $user $cust_main @customers );
5 use FS::UID qw(adminsuidsetup);
6 use FS::Record qw(qsearch);
7 use FS::cust_main;
8
9 $user = shift or die &usage;
10 &adminsuidsetup( $user );
11
12 my @customers = qsearch('cust_main', {} );
13 die "No customers" unless (scalar(@customers) > 0);
14
15 foreach $cust_main (@customers) {
16   print "Applying credits for customer #". $cust_main->custnum;
17   $cust_main->apply_credits;
18 }
19
20
21