summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeff <jeff>2009-04-03 16:57:17 +0000
committerjeff <jeff>2009-04-03 16:57:17 +0000
commita9393a0c1e6f1c6a5dc319238ae5fefb092604fc (patch)
tree89f677fdaf2736dc6f82b5235ac4e638030b0a34
parent8e9fad68fed8b7821fd7736b7947fb45983ff9c0 (diff)
add option for available rather than provisioned svc_phones as unit count
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm16
1 files changed, 15 insertions, 1 deletions
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 34b5571e6..2325e6975 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -157,6 +157,10 @@ tie my %temporalities, 'Tie::IxHash',
'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 @@ tie my %temporalities, 'Tie::IxHash',
411_rewrite
output_format summarize_usage usage_section
bill_every_call
+ count_available_phones
)
],
'weight' => 40,
@@ -639,7 +644,16 @@ sub base_recur {
# 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;