[freeside-commits] freeside/FS/FS/part_pkg voip_cdr.pm,1.62,1.63
Jeff Finucane,420,,
jeff at wavetail.420.am
Fri Apr 3 09:57:20 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv11715
Modified Files:
voip_cdr.pm
Log Message:
add option for available rather than provisioned svc_phones as unit count
Index: voip_cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_cdr.pm,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- voip_cdr.pm 2 Apr 2009 17:47:33 -0000 1.62
+++ voip_cdr.pm 3 Apr 2009 16:57:17 -0000 1.63
@@ -157,6 +157,10 @@
'type' => 'checkbox',
},
+ 'count_available_phones' => { 'name' => 'Consider for tax purposes the number of lines to be svc_phones that may be provisioned rather than those that actually are.',
+ 'type' => 'checkbox',
+ },
+
#XXX also have option for an external db
# 'cdr_location' => { 'name' => 'CDR database location'
# 'type' => 'select',
@@ -197,6 +201,7 @@
411_rewrite
output_format summarize_usage usage_section
bill_every_call
+ count_available_phones
)
],
'weight' => 40,
@@ -639,7 +644,16 @@
# to indicate it represents a line
sub calc_units {
my($self, $cust_pkg ) = @_;
- scalar(grep { $_->part_svc->svcdb eq 'svc_phone' } $cust_pkg->cust_svc);
+ my $count = 0;
+ if ( $self->option('count_available_phones', 1)) {
+ map { $count += ( $_->quantity || 0 ) }
+ grep { $_->part_svc->svcdb eq 'svc_phone' }
+ $cust_pkg->part_pkg->pkg_svc;
+ } else {
+ $count =
+ scalar(grep { $_->part_svc->svcdb eq 'svc_phone' } $cust_pkg->cust_svc);
+ }
+ $count;
}
1;
More information about the freeside-commits
mailing list