Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / FS / FS / part_pkg / voip_cdr.pm
index 4200f33..f23b7a7 100644 (file)
@@ -263,7 +263,7 @@ tie my %detail_formats, 'Tie::IxHash',
                           'type' => 'checkbox',
                         },
 
-    'usage_mandate' => { 'name' => 'Always put usage details in separate section',
+    'usage_mandate' => { 'name' => 'Always put usage details in separate section.  The section is defined in the next option.',
                           'type' => 'checkbox',
                        },
     #eofalse
@@ -340,8 +340,8 @@ tie my %detail_formats, 'Tie::IxHash',
                        411_rewrite
                        output_format 
                        selfservice_format selfservice_inbound_format
-                       usage_mandate summarize_usage usage_section
-                       bill_every_call bill_inactive_svcs
+                       usage_mandate usage_section summarize_usage 
+                       usage_nozero bill_every_call bill_inactive_svcs
                        count_available_phones suspend_bill 
                      )
                   ],
@@ -611,9 +611,12 @@ sub calc_units {
   my($self, $cust_pkg ) = @_;
   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;
+    foreach my $pkg_svc ($cust_pkg->part_pkg->pkg_svc) {
+      if ($pkg_svc->part_svc->svcdb eq 'svc_phone') { # svc_pbx?
+        $count += $pkg_svc->quantity || 0;
+      }
+    }
+    $count *= $cust_pkg->quantity;
   } else {
     $count = 
       scalar(grep { $_->part_svc->svcdb eq 'svc_phone' } $cust_pkg->cust_svc);