svc_pbx devices, for RT#24968
[freeside.git] / FS / FS / svc_pbx.pm
index 4182a13..d35b3a2 100644 (file)
@@ -1,7 +1,8 @@
 package FS::svc_pbx;
+use base qw( FS::o2m_Common FS::device_Common FS::svc_External_Common );
 
 use strict;
-use base qw( FS::svc_External_Common );
+use Tie::IxHash;
 use FS::Record qw( qsearch qsearchs dbh );
 use FS::PagedSearch qw( psearch );
 use FS::Conf;
@@ -80,6 +81,15 @@ points to.  You can ask the object for a copy with the I<hash> method.
 sub table { 'svc_pbx'; }
 
 sub table_info {
+
+  tie my %fields, 'Tie::IxHash',
+    'svcnum' => 'PBX',
+    'id'     => 'PBX/Tenant ID',
+    'title'  => 'Name',
+    'max_extensions' => 'Maximum number of User Extensions',
+    'max_simultaneous' => 'Maximum number of simultaneous users',
+  ;
+
   {
     'name' => 'PBX',
     'name_plural' => 'PBXs',
@@ -88,12 +98,7 @@ sub table_info {
     'sorts' => 'svcnum', # optional sort field (or arrayref of sort fields, main first)
     'display_weight' => 70,
     'cancel_weight'  => 90,
-    'fields' => {
-      'id'    => 'ID',
-      'title' => 'Name',
-      'max_extensions' => 'Maximum number of User Extensions',
-      'max_simultaneous' => 'Maximum number of simultaneous users',
-    },
+    'fields' => \%fields,
   };
 }
 
@@ -292,7 +297,9 @@ to allow title to indicate a range of IP addresses.
 
 =item begin, end: Start and end of date range, as unix timestamp.
 
-=item cdrtypenum: Only return CDRs with this type number.
+=item cdrtypenum: Only return CDRs with this type.
+
+=item calltypenum: Only return CDRs with this call type.
 
 =back
 
@@ -310,6 +317,9 @@ sub psearch_cdrs {
   if ($options{'cdrtypenum'}) {
     $hash{'cdrtypenum'} = $options{'cdrtypenum'};
   }
+  if ($options{'calltypenum'}) {
+    $hash{'calltypenum'} = $options{'calltypenum'};
+  }
 
   my $for_update = $options{'for_update'} ? 'FOR UPDATE' : '';