Rate CDRs immediately, RT#15839
[freeside.git] / FS / FS / Conf.pm
index 4ff3aa7..473c7be 100644 (file)
@@ -47,16 +47,25 @@ but this may change in the future.
 
 =over 4
 
-=item new
+=item new [ HASHREF ]
 
 Create a new configuration object.
 
+HASHREF may contain options to set the configuration context.  Currently 
+accepts C<locale>, and C<localeonly> to disable fallback to the null locale.
+
 =cut
 
 sub new {
-  my($proto) = @_;
+  my($proto) = shift;
+  my $opts = shift || {};
   my($class) = ref($proto) || $proto;
-  my($self) = { 'base_dir' => $base_dir };
+  my $self = {
+    'base_dir'    => $base_dir,
+    'locale'      => $opts->{locale},
+    'localeonly'  => $opts->{localeonly}, # for config-view.cgi ONLY
+  };
+  warn "FS::Conf created with no locale fallback.\n" if $self->{localeonly};
   bless ($self, $class);
 }
 
@@ -108,14 +117,26 @@ sub _usecompat {
 sub _config {
   my($self,$name,$agentnum,$agentonly)=@_;
   my $hashref = { 'name' => $name };
-  $hashref->{agentnum} = $agentnum;
   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
-  my $cv = FS::Record::qsearchs('conf', $hashref);
-  if (!$agentonly && !$cv && defined($agentnum) && $agentnum) {
-    $hashref->{agentnum} = '';
-    $cv = FS::Record::qsearchs('conf', $hashref);
+  my $cv;
+  my @a = (
+    ($agentnum || ()),
+    ($agentonly && $agentnum ? () : '')
+  );
+  my @l = (
+    ($self->{locale} || ()),
+    ($self->{localeonly} && $self->{locale} ? () : '')
+  );
+  # try with the agentnum first, then fall back to no agentnum if allowed
+  foreach my $a (@a) {
+    $hashref->{agentnum} = $a;
+    foreach my $l (@l) {
+      $hashref->{locale} = $l;
+      $cv = FS::Record::qsearchs('conf', $hashref);
+      return $cv if $cv;
+    }
   }
-  return $cv;
+  return undef;
 }
 
 sub config {
@@ -268,10 +289,14 @@ sub set {
 
   warn "[FS::Conf] SET $name\n" if $DEBUG;
 
-  my $old = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum});
-  my $new = new FS::conf { $old ? $old->hash 
-                                : ('name' => $name, 'agentnum' => $agentnum)
-                         };
+  my $hashref = {
+    name => $name,
+    agentnum => $agentnum,
+    locale => $self->{locale}
+  };
+
+  my $old = FS::Record::qsearchs('conf', $hashref);
+  my $new = new FS::conf { $old ? $old->hash : %$hashref };
   $new->value($value);
 
   my $error;
@@ -312,7 +337,7 @@ sub delete {
   return $self->_usecompat('delete', @_) if use_confcompat;
 
   my($name, $agentnum) = @_;
-  if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}) ) {
+  if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum, locale => $self->{locale}}) ) {
     warn "[FS::Conf] DELETE $name\n" if $DEBUG;
 
     my $oldAutoCommit = $FS::UID::AutoCommit;
@@ -682,7 +707,14 @@ my %payment_gateway_options = (
     'description' => 'Generate a line item on an invoice even when a package is discounted 100%',
     'type'        => 'checkbox',
   },
-  
+
+  {
+    'key'         => 'discount-show_available',
+    'section'     => 'billing',
+    'description' => 'Show available prepayment discounts on invoices.',
+    'type'        => 'checkbox',
+  },
+
   {
     'key'         => 'invoice-barcode',
     'section'     => 'billing',
@@ -700,7 +732,7 @@ my %payment_gateway_options = (
   {
     'key'         => 'encryption',
     'section'     => 'billing',
-    'description' => 'Enable encryption of credit cards.',
+    'description' => 'Enable encryption of credit cards and echeck numbers',
     'type'        => 'checkbox',
   },
 
@@ -708,20 +740,21 @@ my %payment_gateway_options = (
     'key'         => 'encryptionmodule',
     'section'     => 'billing',
     'description' => 'Use which module for encryption?',
-    'type'        => 'text',
+    'type'        => 'select',
+    'select_enum' => [ '', 'Crypt::OpenSSL::RSA', ],
   },
 
   {
     'key'         => 'encryptionpublickey',
     'section'     => 'billing',
-    'description' => 'Your RSA Public Key - Required if Encryption is turned on.',
+    'description' => 'Encryption public key',
     'type'        => 'textarea',
   },
 
   {
     'key'         => 'encryptionprivatekey',
     'section'     => 'billing',
-    'description' => 'Your RSA Private Key - Including this will enable the "Bill Now" feature.  However if the system is compromised, a hacker can use this key to decode the stored credit card information.  This is generally not a good idea.',
+    'description' => 'Encryption private key',
     'type'        => 'textarea',
   },
 
@@ -820,6 +853,14 @@ my %payment_gateway_options = (
   },
 
   {
+    'key'         => 'business-onlinepayment-currency',
+    'section'     => 'billing',
+    'description' => 'Currency parameter for Business::OnlinePayment transactions.',
+    'type'        => 'select',
+    'select_enum' => [ '', qw( USD AUD CAD DKK EUR GBP ILS JPY NZD ) ],
+  },
+
+  {
     'key'         => 'countrydefault',
     'section'     => 'UI',
     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
@@ -1020,6 +1061,7 @@ my %payment_gateway_options = (
     'description' => 'Subject: header on email invoices.  Defaults to "Invoice".  The following substitutions are available: $name, $name_short, $invoice_number, and $invoice_date.',
     'type'        => 'text',
     'per_agent'   => 1,
+    'per_locale'  => 1,
   },
 
   {
@@ -1050,6 +1092,7 @@ my %payment_gateway_options = (
     'description' => 'Notes section for HTML invoices.  Defaults to the same data in invoice_latexnotes if not specified.',
     'type'        => 'textarea',
     'per_agent'   => 1,
+    'per_locale'  => 1,
   },
 
   {
@@ -1058,6 +1101,7 @@ my %payment_gateway_options = (
     'description' => 'Footer for HTML invoices.  Defaults to the same data in invoice_latexfooter if not specified.',
     'type'        => 'textarea',
     'per_agent'   => 1,
+    'per_locale'  => 1,
   },
 
   {
@@ -1066,6 +1110,7 @@ my %payment_gateway_options = (
     'description' => 'Summary initial page for HTML invoices.',
     'type'        => 'textarea',
     'per_agent'   => 1,
+    'per_locale'  => 1,
   },
 
   {
@@ -1073,6 +1118,7 @@ my %payment_gateway_options = (
     'section'     => 'invoicing',
     'description' => 'Return address for HTML invoices.  Defaults to the same data in invoice_latexreturnaddress if not specified.',
     'type'        => 'textarea',
+    'per_locale'  => 1,
   },
 
   {
@@ -1137,6 +1183,7 @@ and customer address. Include units.',
     'description' => 'Notes section for LaTeX typeset PostScript invoices.',
     'type'        => 'textarea',
     'per_agent'   => 1,
+    'per_locale'  => 1,
   },
 
   {
@@ -1145,6 +1192,7 @@ and customer address. Include units.',
     'description' => 'Footer for LaTeX typeset PostScript invoices.',
     'type'        => 'textarea',
     'per_agent'   => 1,
+    'per_locale'  => 1,
   },
 
   {
@@ -1153,6 +1201,7 @@ and customer address. Include units.',
     'description' => 'Summary initial page for LaTeX typeset PostScript invoices.',
     'type'        => 'textarea',
     'per_agent'   => 1,
+    'per_locale'  => 1,
   },
 
   {
@@ -1161,6 +1210,7 @@ and customer address. Include units.',
     'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.',
     'type'        => 'textarea',
     'per_agent'   => 1,
+    'per_locale'  => 1,
   },
 
   {
@@ -1239,6 +1289,7 @@ and customer address. Include units.',
     'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
     'type'        => 'textarea',
     'per_agent'   => 1,
+    'per_locale'  => 1,
   },
 
   {
@@ -1258,7 +1309,14 @@ and customer address. Include units.',
   {
     'key'         => 'invoice_print_pdf',
     'section'     => 'invoicing',
-    'description' => 'Store postal invoices for download in PDF format rather than printing them directly.',
+    'description' => 'For all invoice print operations, store postal invoices for download in PDF format rather than printing them directly.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'invoice_print_pdf-spoolagent',
+    'section'     => 'invoicing',
+    'description' => 'Store postal invoices PDF downloads in per-agent spools.',
     'type'        => 'checkbox',
   },
 
@@ -1810,7 +1868,12 @@ and customer address. Include units.',
     'section'     => 'UI',
     'description' => 'Default locale',
     'type'        => 'select',
-    'select_enum' => [ FS::Locales->locales ],
+    'options_sub' => sub {
+      map { $_ => FS::Locales->description($_) } FS::Locales->locales;
+    },
+    'option_sub'  => sub {
+      FS::Locales->description(shift)
+    },
   },
 
   {
@@ -2234,6 +2297,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'svc_broadband-radius',
+    'section'     => '',
+    'description' => 'Enable RADIUS groups for broadband services.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'svc_acct-alldomains',
     'section'     => '',
     'description' => 'Allow accounts to select any domain in the database.  Normally accounts can only select from the domain set in the service definition and those purchased by the customer.',
@@ -2403,7 +2473,38 @@ and customer address. Include units.',
     'type'        => 'select-part_svc',
     'multiple'    => 1,
   },
-  
+
+  {
+    'key'         => 'selfservice-svc_forward_svcpart',
+    'section'     => 'self-service',
+    'description' => 'Service for self-service forward editing.',
+    'type'        => 'select-part_svc',
+  },
+
+  {
+    'key'         => 'selfservice-password_reset_verification',
+    'section'     => 'self-service',
+    'description' => 'If enabled, specifies the type of verification required for self-service password resets.',
+    'type'        => 'select',
+    'select_hash' => [ '' => 'Password reset disabled',
+                       'paymask,amount,zip' => 'Verify with credit card (or bank account) last 4 digits, payment amount and zip code',
+                     ],
+  },
+
+  {
+    'key'         => 'selfservice-password_reset_msgnum',
+    'section'     => 'self-service',
+    'description' => 'Template to use for password reset emails.',
+    %msg_template_options,
+  },
+
+  {
+    'key'         => 'selfservice-hide_invoices-taxclass',
+    'section'     => 'self-service',
+    'description' => 'Hide invoices with only this package tax class from self-service and supress sending (emailing, printing, faxing) them.  Typically set to something like "Previous balance" and used when importing legacy invoices into legacy_cust_bill.',
+    'type'        => 'text',
+  },
+
   {
     'key'         => 'selfservice-recent-did-age',
     'section'     => 'self-service',
@@ -2549,14 +2650,28 @@ and customer address. Include units.',
 
   {
     'key'         => 'network_monitoring_system',
-    'section'     => '',
+    'section'     => 'network_monitoring',
     'description' => 'Networking monitoring system (NMS) integration.  <b>Torrus_Internal</b> uses the built-in Torrus ticketing system (see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Torrus_Installation">integrated networking monitoring system installation instructions</a>).',
     'type'        => 'select',
-    #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
     'select_enum' => [ '', qw(Torrus_Internal) ],
   },
 
   {
+    'key'         => 'nms-auto_add-svc_ips',
+    'section'     => 'network_monitoring',
+    'description' => 'Automatically add (and remove) IP addresses from these service tables to the network monitoring system.',
+    'type'        => 'selectmultiple',
+    'select_enum' => [ 'svc_acct', 'svc_broadband', 'svc_dsl' ],
+  },
+
+  {
+    'key'         => 'nms-auto_add-community',
+    'section'     => 'network_monitoring',
+    'description' => 'SNMP community string to use when automatically adding IP addresses from these services to the network monitoring system.',
+    'type'        => 'text',
+  },
+
+  {
     'key'         => 'ticket_system-default_queueid',
     'section'     => 'ticketing',
     'description' => 'Default queue used when creating new customer tickets.',
@@ -2855,7 +2970,7 @@ and customer address. Include units.',
   {
     'key'         => 'overlimit_groups',
     'section'     => '',
-    'description' => 'RADIUS group (or comma-separated groups) to assign to svc_acct which has exceeded its bandwidth or time limit.',
+    'description' => 'RADIUS group(s) to assign to svc_acct which has exceeded its bandwidth or time limit.',
     'type'        => 'select-sub',
     'per_agent'   => 1,
     'multiple'    => 1,
@@ -3115,7 +3230,8 @@ and customer address. Include units.',
     'description' => 'Fixed (unchangeable) format for electronic check batches.',
     'type'        => 'select',
     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP',
-                       'paymentech', 'ach-spiritone', 'RBC', 'td_eft1464'
+                       'paymentech', 'ach-spiritone', 'RBC', 'td_eft1464',
+                       'eft_canada'
                      ]
   },
 
@@ -3176,6 +3292,21 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'batchconfig-eft_canada',
+    'section'     => 'billing',
+    'description' => 'Configuration for EFT Canada batching, four lines: 1. SFTP username, 2. SFTP password, 3. Transaction code, 4. Number of days to delay process date.',
+    'type'        => 'textarea',
+    'per_agent'   => 1,
+  },
+
+  {
+    'key'         => 'batch-spoolagent',
+    'section'     => 'billing',
+    'description' => 'Store payment batches per-agent.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'payment_history-years',
     'section'     => 'UI',
     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
@@ -3254,6 +3385,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'cust_main-edit_calling_list_exempt',
+    'section'     => 'UI',
+    'description' => 'Display the "calling_list_exempt" checkbox on customer edit.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'support-key',
     'section'     => '',
     'description' => 'A support key enables access to commercial services delivered over the network, such as the payroll module, access to the internal ticket system, priority support and optional backups.',
@@ -3324,6 +3462,7 @@ and customer address. Include units.',
     'type'        => 'image',
     'per_agent'   => 1, #XXX just view/logo.cgi, which is for the global
                         #old-style editor anyway...?
+    'per_locale'  => 1,
   },
 
   {
@@ -3332,6 +3471,7 @@ and customer address. Include units.',
     'description' => 'Company logo for printed and PDF invoices, in EPS format.',
     'type'        => 'image',
     'per_agent'   => 1, #XXX as above, kinda
+    'per_locale'  => 1,
   },
 
   {
@@ -3503,9 +3643,9 @@ and customer address. Include units.',
     'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
     'type'        => 'select',
     'select_hash' => [
-                       ''      => 'Numeric only',
-                       '\d{7}' => 'Numeric only, exactly 7 digits',
-                       'ww?d+' => 'Numeric with one or two letter prefix',
+                       ''       => 'Numeric only',
+                       '\d{7}'  => 'Numeric only, exactly 7 digits',
+                       'ww?d+'  => 'Numeric with one or two letter prefix',
                      ],
   },
 
@@ -3612,6 +3752,21 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'geocode_module',
+    'section'     => '',
+    'description' => 'Module to geocode (retrieve a latitude and longitude for) addresses',
+    'type'        => 'select',
+    'select_enum' => [ 'Geo::Coder::Googlev3' ],
+  },
+
+  {
+    'key'         => 'geocode-require_nw_coordinates',
+    'section'     => 'UI',
+    'description' => 'Require latitude and longitude in the North Western quadrant, e.g. for North American co-ordinates, etc.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'disable_acl_changes',
     'section'     => '',
     'description' => 'Disable all ACL changes, for demos.',
@@ -3664,6 +3819,14 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'cust_main-custnum-display_prefix',
+    'section'     => 'UI',
+    'description' => 'Prefix the customer number with this number for display purposes (and zero fill to 8 digits).',
+    'type'        => 'text',
+    #and then probably agent-virt this to merge these instances
+  },
+
+  {
     'key'         => 'cust_main-default_areacode',
     'section'     => 'UI',
     'description' => 'Default area code for customers.',
@@ -3946,11 +4109,18 @@ and customer address. Include units.',
   {
     'key'         => 'signup-recommend_daytime',
     'section'     => 'self-service',
-    'description' => 'Encourage the entry of a daytime phone number  invoicing email address on signup.',
+    'description' => 'Encourage the entry of a daytime phone number on signup.',
     'type'        => 'checkbox',
   },
 
   {
+    'key'         => 'signup-duplicate_cc-warn_hours',
+    'section'     => 'self-service',
+    'description' => 'Issue a warning if the same credit card is used for multiple signups within this many hours.',
+    'type'        => 'text',
+  },
+
+  {
     'key'         => 'svc_phone-radius-default_password',
     'section'     => 'telephony',
     'description' => 'Default password when exporting svc_phone records to RADIUS',
@@ -3977,7 +4147,14 @@ and customer address. Include units.',
     'description' => 'Maximum length of the phone service "Name" field (svc_phone.phone_name).  Sometimes useful to limit this (to 15?) when exporting as Caller ID data.',
     'type'        => 'text',
   },
-  
+
+  {
+    'key'         => 'svc_phone-random_pin',
+    'section'     => 'telephony',
+    'description' => 'Number of random digits to generate in the "PIN" field, if empty.',
+    'type'        => 'text',
+  },
+
   {
     'key'         => 'svc_phone-lnp',
     'section'     => 'telephony',
@@ -4149,6 +4326,31 @@ and customer address. Include units.',
     'type'        => 'text',
   },
 
+  {
+    'key'         => 'svc_broadband-manage_link_text',
+    'section'     => 'UI',
+    'description' => 'Label for "Manage Device" link',
+    'type'        => 'text',
+  },
+
+  {
+    'key'         => 'svc_broadband-manage_link_loc',
+    'section'     => 'UI',
+    'description' => 'Location for "Manage Device" link',
+    'type'        => 'select',
+    'select_hash' => [
+      'bottom' => 'Near Unprovision link',
+      'right'  => 'With export-related links',
+    ],
+  },
+
+  {
+    'key'         => 'svc_broadband-manage_link-new_window',
+    'section'     => 'UI',
+    'description' => 'Open the "Manage Device" link in a new window',
+    'type'        => 'checkbox',
+  },
+
   #more fine-grained, service def-level control could be useful eventually?
   {
     'key'         => 'svc_broadband-allow_null_ip_addr',
@@ -4324,8 +4526,8 @@ and customer address. Include units.',
   {
     'key'         => 'cust_main-custom_link',
     'section'     => 'UI',
-    'description' => 'URL to use as source for the "Custom" tab in the View Customer page.  The custnum will be appended.',
-    'type'        => 'text',
+    'description' => 'URL to use as source for the "Custom" tab in the View Customer page.  The customer number will be appended, or you can insert "$custnum" to have it inserted elsewhere.  "$agentnum" will be replaced with the agent number, and "$usernum" will be replaced with the employee number.',
+    'type'        => 'textarea',
   },
 
   {
@@ -4402,6 +4604,13 @@ and customer address. Include units.',
     'description' => 'Enable DID activity summary on invoices, showing # DIDs activated/deactivated/ported-in/ported-out and total minutes usage, covering period since last invoice.',
     'type'        => 'checkbox',
   },
+
+  {
+    'key'         => 'svc_acct-usage_seconds',
+    'section'     => 'invoicing',
+    'description' => 'Enable calculation of RADIUS usage time for invoices.  You must modify your template to display this information.',
+    'type'        => 'checkbox',
+  },
   
   {
     'key'         => 'opensips_gwlist',
@@ -4438,6 +4647,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'cust_bill-latex_lineitem_maxlength',
+    'section'     => 'invoicing',
+    'description' => 'Truncate long line items to this number of characters on typeset invoices, to avoid losing things off the right margin.  Defaults to 50.  ',
+    'type'        => 'text',
+  },
+
+  {
     'key'         => 'cust_main-status_module',
     'section'     => 'UI',
     'description' => 'Which module to use for customer status display.  The "Classic" module (the default) considers accounts with cancelled recurring packages but un-cancelled one-time charges Inactive.  The "Recurring" module considers those customers Cancelled.  Similarly for customers with suspended recurring packages but one-time charges.', #other differences?
@@ -4470,14 +4686,14 @@ and customer address. Include units.',
   {
     'key'         => 'payment-history-report',
     'section'     => 'UI',
-    'description' => 'Show a link to the payment history report in the Reports menu. DO NOT ENABLE THIS.',
+    'description' => 'Show a link to the raw database payment history report in the Reports menu.  DO NOT ENABLE THIS for modern installations.',
     'type'        => 'checkbox',
   },
   
   {
     'key'         => 'svc_broadband-require-nw-coordinates',
-    'section'     => 'UI',
-    'description' => 'On svc_broadband add/edit, require latitude and longitude in the North Western quadrant, e.g. for North American co-ordinates, etc.',
+    'section'     => 'deprecated',
+    'description' => 'Deprecated; see geocode-require_nw_coordinates instead',
     'type'        => 'checkbox',
   },
   
@@ -4501,19 +4717,73 @@ and customer address. Include units.',
     'description' => 'An alternate ordering of fields for the New Customer and Edit Customer screens.',
     'type'        => 'checkbox',
   },
+
+  {
+    'key'         => 'cust_bill-enable_promised_date',
+    'section'     => 'UI',
+    'description' => 'Enable display/editing of the "promised payment date" field on invoices.',
+    'type'        => 'checkbox',
+  },
   
   {
-    'key'         => 'translate-auto-insert',
+    'key'         => 'available-locales',
     'section'     => '',
-    'description' => 'Auto-insert untranslated strings for selected non-en_US locales with their default/en_US values. DO NOT TURN THIS ON.',
+    'description' => 'Limit available locales (employee preferences, per-customer locale selection, etc.) to a particular set.',
     'type'        => 'select-sub',
     'multiple'    => 1,
-    'options_sub' => sub { map { $_ => '' } 
-                            grep { $_ ne 'en_US' } FS::Locales::locales;
-                                    },
-    'option_sub'  => sub { ''; },
+    'options_sub' => sub { 
+      map { $_ => FS::Locales->description($_) }
+      grep { $_ ne 'en_US' } 
+      FS::Locales->locales;
+    },
+    'option_sub'  => sub { FS::Locales->description(shift) },
+  },
+  
+  {
+    'key'         => 'translate-auto-insert',
+    'section'     => '',
+    'description' => 'Auto-insert untranslated strings for selected non-en_US locales with their default/en_US values.  Do not turn this on unless translating the interface into a new language.',
+    'type'        => 'select',
+    'multiple'    => 1,
+    'select_enum' => [ grep { $_ ne 'en_US' } FS::Locales::locales ],
   },
 
+  {
+    'key'         => 'svc_acct-tower_sector',
+    'section'     => '',
+    'description' => 'Track tower and sector for svc_acct (account) services.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'cdr-prerate',
+    'section'     => 'telephony',
+    'description' => 'Experimental feature to rate CDRs immediately, rather than waiting until invoice generation time.  Can reduce invoice generation time when processing lots of CDRs.  Currently works with "VoIP/telco CDR rating (standard)" price plans using "Phone numbers (svc_phone.phonenum)" CDR service matching, without any included minutes.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'cdr-prerate-cdrtypenums',
+    'section'     => 'telephony',
+    'description' => 'When using cdr-prerate to rate CDRs immediately, limit processing to these CDR types.',
+    'type'        => 'select-sub',
+    'multiple'    => 1,
+    'options_sub' => sub { require FS::Record;
+                           require FS::cdr_type;
+                           map { $_->cdrtypenum => $_->cdrtypename }
+                               FS::Record::qsearch( 'cdr_type', 
+                                                   {} #{ 'disabled' => '' }
+                                                 );
+                        },
+    'option_sub'  => sub { require FS::Record;
+                           require FS::cdr_type;
+                           my $cdr_type = FS::Record::qsearchs(
+                            'cdr_type', { 'cdrtypenum'=>shift } );
+                           $cdr_type ? $cdr_type->cdrtypename : '';
+                        },
+  },
+  
+  
   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },