[freeside-commits] freeside/FS/FS/part_event/Condition cust_bill_has_service.pm, NONE, 1.1
Jason Hall
jayce at wavetail.420.am
Wed Sep 26 12:27:25 PDT 2007
Update of /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition
In directory wavetail:/tmp/cvs-serv6841
Added Files:
cust_bill_has_service.pm
Log Message:
Initial import.
Condition tests to see if the Invoice bills for a particular service.
--- NEW FILE: cust_bill_has_service.pm ---
package FS::part_event::Condition::cust_bill_has_service;
use strict;
use FS::cust_bill;
use base qw( FS::part_event::Condition );
sub description {
'Invoice is billing for a certain service type';
}
sub eventtable_hashref {
{ 'cust_main' => 0,
'cust_bill' => 1,
'cust_pkg' => 0,
};
}
sub option_fields {
(
'has_service' => { 'label' => 'Has service',
'type' => 'select-part_svc',
},
);
}
sub condition {
#my($self, $cust_bill, %opt) = @_;
my($self, $cust_bill) = @_;
my $servicenum = $self->option('has_service');
grep { $servicenum == $_->svcnum }
map { $_->cust_pkg->cust_svc }
$cust_bill->cust_bill_pkg ;
}
sub condition_sql {
my( $class, $table ) = @_;
my $servicenum = $class->condition_sql_option('has_service');
my $sql = qq| 0 < ( SELECT COUNT(cs.svcpart)
FROM cust_bill_pkg cbp, cust_svc cs
WHERE cbp.invnum = cust_bill.invnum
AND cs.pkgnum = cbp.pkgnum
AND cs.svcpart = $servicenum
)
|;
return $sql;
}
1;
More information about the freeside-commits
mailing list