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:m", \%opt);
12 my $user = shift or die &usage;
15 use FS::Cron::bill qw(bill);
16 bill(%opt, 'check_freq'=>'1m' );
18 use FS::Cron::upload qw(upload);
26 foreach $_ ( $[ .. $#ARGV ) { #untaint @ARGV
27 #$ARGV[$_] =~ /^([\w\-\/]*)$/ || die "Illegal arguement \"$ARGV[$_]\"";
29 $ARGV[$_] =~ /^(.*)$/ || die "Illegal arguement \"$ARGV[$_]\"";
35 die "Usage:\n\n freeside-monthly [ -d 'date' ] user [ custnum custnum ... ]\n";
44 freeside-monthly - Run monthly billing and invoice collection events.
48 freeside-monthly [ -d 'date' ] [ -y days ] [ -p 'payby' ] [ -a agentnum ] [ -s ] [ -v ] user [ custnum custnum ... ]
52 Bills customers and runs invoice collection events, for the alternate monthly
53 event chain. If you have defined monthly event checks, should be run from
56 Bills customers. Searches for customers who are due for billing and calls
57 the bill and collect methods of a cust_main object. See L<FS::cust_main>.
59 -d: Pretend it's 'date'. Date is in any format Date::Parse is happy with,
62 -y: In addition to -d, which specifies an absolute date, the -y switch
63 specifies an offset, in days. For example, "-y 15" would increment the
64 "pretend date" 15 days from whatever was specified by the -d switch
65 (or now, if no -d switch was given).
67 -p: Only process customers with the specified payby (CARD, DCRD, CHEK, DCHK, BILL, COMP, LECB)
69 -a: Only process customers with the specified agentnum
71 -s: re-charge setup fees
75 -m: Experimental multi-process mode (delay upload jobs until billing jobs complete)
77 user: Typically "fs_daily"
79 custnum: if one or more customer numbers are specified, only bills those
80 customers. Otherwise, bills all customers.
84 In most cases, you would use freeside-daily only and not freeside-monthly.
85 freeside-monthly would only be used in cases where you have events that can
86 only be run once each month, for example, batching invoices to a third-party
93 L<freeside-daily>, L<FS::cust_main>, config.html from the base documentation