5 use FS::UID qw(adminsuidsetup);
7 &untaint_argv; #what it sounds like (eww)
9 getopts("p:a:d:vsy:n", \%opt);
11 my $user = shift or die &usage;
14 use FS::Cron::bill qw(bill);
17 use FS::Cron::notify qw(notify_flat_delay);
18 notify_flat_delay(%opt);
20 use FS::Cron::vacuum qw(vacuum);
23 use FS::Cron::backup qw(backup_scp);
31 foreach $_ ( $[ .. $#ARGV ) { #untaint @ARGV
32 #$ARGV[$_] =~ /^([\w\-\/]*)$/ || die "Illegal arguement \"$ARGV[$_]\"";
34 $ARGV[$_] =~ /^(.*)$/ || die "Illegal arguement \"$ARGV[$_]\"";
40 die "Usage:\n\n freeside-daily [ -d 'date' ] user [ custnum custnum ... ]\n";
49 freeside-daily - Run daily billing and invoice collection events.
53 freeside-daily [ -d 'date' ] [ -y days ] [ -p 'payby' ] [ -a agentnum ] [ -s ] [ -v ] user [ custnum custnum ... ]
57 Bills customers and runs invoice collection events. Should be run from
60 Bills customers. Searches for customers who are due for billing and calls
61 the bill and collect methods of a cust_main object. See L<FS::cust_main>.
63 -d: Pretend it's 'date'. Date is in any format Date::Parse is happy with,
66 -y: In addition to -d, which specifies an absolute date, the -y switch
67 specifies an offset, in days. For example, "-y 15" would increment the
68 "pretend date" 15 days from whatever was specified by the -d switch
69 (or now, if no -d switch was given).
71 -n: When used with "-d" and/or "-y", specifies that invoices should be dated
72 with today's date, irregardless of the pretend date used to pre-generate
75 -p: Only process customers with the specified payby (I<CARD>, I<DCRD>, I<CHEK>, I<DCHK>, I<BILL>, I<COMP>, I<LECB>)
77 -a: Only process customers with the specified agentnum
79 -s: re-charge setup fees
83 user: From the mapsecrets file - see config.html from the base documentation
85 custnum: if one or more customer numbers are specified, only bills those
86 customers. Otherwise, bills all customers.
92 L<FS::cust_main>, config.html from the base documentation