[freeside-commits] freeside/FS/FS/cust_main Billing.pm,1.40,1.41
Mark Wells
mark at wavetail.420.am
Mon Aug 29 13:50:35 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS/cust_main
In directory wavetail.420.am:/tmp/cvs-serv31086/FS/FS/cust_main
Modified Files:
Billing.pm
Log Message:
start of svc_acct events, #13202
Index: Billing.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main/Billing.pm,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -w -d -r1.40 -r1.41
--- Billing.pm 5 Aug 2011 23:20:03 -0000 1.40
+++ Billing.pm 29 Aug 2011 20:50:33 -0000 1.41
@@ -1447,8 +1447,12 @@
my $mine =
'( '
. join ( ' OR ' , map {
+ my $cust_join = FS::part_event->eventtables_cust_join->{$_} || '';
+ my $custnum = FS::part_event->eventtables_custnum->{$_};
"( part_event.eventtable = " . dbh->quote($_)
- . " AND tablenum IN( SELECT " . dbdef->table($_)->primary_key . " from $_ where custnum = " . dbh->quote( $self->custnum ) . "))" ;
+ . " AND tablenum IN( SELECT " . dbdef->table($_)->primary_key
+ . " from $_ $cust_join"
+ . " where $custnum = " . dbh->quote( $self->custnum ) . "))" ;
} FS::part_event->eventtables)
. ') ';
@@ -1608,7 +1612,7 @@
#XXX lock event
#re-eval event conditions (a previous event could have changed things)
- unless ( $cust_event->test_conditions( 'time' => $time ) ) {
+ unless ( $cust_event->test_conditions ) {
#don't leave stray "new/locked" records around
my $error = $cust_event->delete;
return $error if $error;
@@ -1732,15 +1736,15 @@
@objects = @{ $opt{'objects'} };
- } else {
+ } elsif ( $eventtable eq 'cust_main' ) {
- #my @objects = $self->$eventtable(); # sub cust_main { @{ [ $self ] }; }
- if ( $eventtable eq 'cust_main' ) {
@objects = ( $self );
+
} else {
- my $cm_join =
- "LEFT JOIN cust_main USING ( custnum )";
+ my $cm_join = " LEFT JOIN cust_main USING ( custnum )";
+ # linkage not needed here because FS::cust_main->$eventtable will
+ # already supply it
#some false laziness w/Cron::bill bill_where
@@ -1764,13 +1768,13 @@
'addl_from' => $cm_join,
'extra_sql' => " AND $are_part_event",
);
- }
-
- }
+ } # if ( !$opt{objects} and $eventtable ne 'cust_main' )
my @e_cust_event = ();
- my $cross = "CROSS JOIN $eventtable";
+ my $linkage = FS::part_event->eventtables_cust_join->{$eventtable} || '';
+
+ my $cross = "CROSS JOIN $eventtable $linkage";
$cross .= ' LEFT JOIN cust_main USING ( custnum )'
unless $eventtable eq 'cust_main';
@@ -1818,7 +1822,9 @@
" possible events found for $eventtable ". $object->$pkey(). "\n";
}
- push @e_cust_event, map { $_->new_cust_event($object) } @part_event;
+ push @e_cust_event, map {
+ $_->new_cust_event($object, 'time' => $opt{'time'})
+ } @part_event;
}
@@ -1852,8 +1858,7 @@
my %unsat = ();
- @cust_event = grep $_->test_conditions( 'time' => $opt{'time'},
- 'stats_hashref' => \%unsat ),
+ @cust_event = grep $_->test_conditions( 'stats_hashref' => \%unsat ),
@cust_event;
warn " ". scalar(@cust_event). " cust events left satisfying conditions\n"
More information about the freeside-commits
mailing list