projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
svc_pbx.title uniqueness (kludgy) and force to alphanumeric+space and 19 char max...
[freeside.git]
/
FS
/
FS
/
Cron
/
bill.pm
diff --git
a/FS/FS/Cron/bill.pm
b/FS/FS/Cron/bill.pm
index
61b4735
..
62bb321
100644
(file)
--- a/
FS/FS/Cron/bill.pm
+++ b/
FS/FS/Cron/bill.pm
@@
-21,6
+21,7
@@
use FS::part_event_condition;
# -l: debugging level
# -m: Experimental multi-process mode uses the job queue for multi-process and/or multi-machine billing.
# -r: Multi-process mode dry run option
# -l: debugging level
# -m: Experimental multi-process mode uses the job queue for multi-process and/or multi-machine billing.
# -r: Multi-process mode dry run option
+# -g: Don't bill these pkgparts
sub bill {
my %opt = @_;
sub bill {
my %opt = @_;
@@
-33,12
+34,22
@@
sub bill {
$FS::cust_main::DEBUG = $debug;
#$FS::cust_event::DEBUG = $opt{'l'} if $opt{'l'};
$FS::cust_main::DEBUG = $debug;
#$FS::cust_event::DEBUG = $opt{'l'} if $opt{'l'};
+ my $conf = new FS::Conf;
+ if ( $conf->exists('disable_cron_billing') ) {
+ warn "disable_cron_billing set, skipping billing\n" if $debug;
+ return;
+ }
+
#we're at now now (and later).
$opt{'time'} = $opt{'d'} ? str2time($opt{'d'}) : $^T;
$opt{'time'} += $opt{'y'} * 86400 if $opt{'y'};
$opt{'invoice_time'} = $opt{'n'} ? $^T : $opt{'time'};
#we're at now now (and later).
$opt{'time'} = $opt{'d'} ? str2time($opt{'d'}) : $^T;
$opt{'time'} += $opt{'y'} * 86400 if $opt{'y'};
$opt{'invoice_time'} = $opt{'n'} ? $^T : $opt{'time'};
+ #hashref here doesn't work with -m
+ #my $not_pkgpart = $opt{g} ? { map { $_=>1 } split(/,\s*/, $opt{g}) }
+ # : {};
+
###
# get a list of custnums
###
###
# get a list of custnums
###
@@
-74,6
+85,7
@@
sub bill {
#(not, when using -m, freeside-queued)
'check_freq' => $check_freq,
'resetup' => ( $opt{'s'} ? $opt{'s'} : 0 ),
#(not, when using -m, freeside-queued)
'check_freq' => $check_freq,
'resetup' => ( $opt{'s'} ? $opt{'s'} : 0 ),
+ 'not_pkgpart' => $opt{'g'}, #$not_pkgpart,
);
if ( $opt{'m'} ) {
);
if ( $opt{'m'} ) {
@@
-149,9
+161,11
@@
sub bill_where {
push @search, "cust_main.payby = '". $opt{'p'}. "'"
if $opt{'p'};
push @search, "cust_main.payby = '". $opt{'p'}. "'"
if $opt{'p'};
- push @search, "cust_main.agentnum
= ". $opt{'a'}
+ push @search, "cust_main.agentnum
IN ( ". $opt{'a'}. " ) "
if $opt{'a'};
if $opt{'a'};
+ #it would be useful if i recognized $opt{g} / $not_pkgpart...
+
if ( @ARGV ) {
push @search, "( ".
join(' OR ', map "cust_main.custnum = $_", @ARGV ).
if ( @ARGV ) {
push @search, "( ".
join(' OR ', map "cust_main.custnum = $_", @ARGV ).
@@
-187,13
+201,14
@@
END
my $where = FS::part_event_condition->where_conditions_sql( $eventtable,
'time'=>$time,
);
my $where = FS::part_event_condition->where_conditions_sql( $eventtable,
'time'=>$time,
);
+ $where = $where ? "AND $where" : '';
my $are_part_event =
"EXISTS ( SELECT 1 FROM part_event $join
WHERE check_freq = '$check_freq'
AND eventtable = '$eventtable'
AND ( disabled = '' OR disabled IS NULL )
my $are_part_event =
"EXISTS ( SELECT 1 FROM part_event $join
WHERE check_freq = '$check_freq'
AND eventtable = '$eventtable'
AND ( disabled = '' OR disabled IS NULL )
-
AND
$where
+ $where
)
";
)
";