5 use FS::UID qw(adminsuidsetup);
7 &untaint_argv; #what it sounds like (eww)
8 #use vars qw($opt_d $opt_v $opt_p $opt_a $opt_s $opt_y);
10 getopts("p:a:d:vsy:", \%opt);
12 my $user = shift or die &usage;
15 use FS::Cron::bill qw(bill);
18 use FS::Cron::notify qw(notify_flat_delay);
19 notify_flat_delay(%opt);
21 use FS::Cron::vacuum qw(vacuum);
24 use FS::Cron::backup qw(backup_scp);
32 foreach $_ ( $[ .. $#ARGV ) { #untaint @ARGV
33 #$ARGV[$_] =~ /^([\w\-\/]*)$/ || die "Illegal arguement \"$ARGV[$_]\"";
35 $ARGV[$_] =~ /^(.*)$/ || die "Illegal arguement \"$ARGV[$_]\"";
41 die "Usage:\n\n freeside-daily [ -d 'date' ] user [ custnum custnum ... ]\n";
50 freeside-daily - Run daily billing and invoice collection events.
54 freeside-daily [ -d 'date' ] [ -y days ] [ -p 'payby' ] [ -a agentnum ] [ -s ] [ -v ] user [ custnum custnum ... ]
58 Bills customers and runs invoice collection events. Should be run from
61 Bills customers. Searches for customers who are due for billing and calls
62 the bill and collect methods of a cust_main object. See L<FS::cust_main>.
64 -d: Pretend it's 'date'. Date is in any format Date::Parse is happy with,
67 -y: In addition to -d, which specifies an absolute date, the -y switch
68 specifies an offset, in days. For example, "-y 15" would increment the
69 "pretend date" 15 days from whatever was specified by the -d switch
70 (or now, if no -d switch was given).
72 -p: Only process customers with the specified payby (I<CARD>, I<DCRD>, I<CHEK>, I<DCHK>, I<BILL>, I<COMP>, I<LECB>)
74 -a: Only process customers with the specified agentnum
76 -s: re-charge setup fees
80 user: From the mapsecrets file - see config.html from the base documentation
82 custnum: if one or more customer numbers are specified, only bills those
83 customers. Otherwise, bills all customers.
89 L<FS::cust_main>, config.html from the base documentation