DID activity summary improvements, RT10886
[freeside.git] / FS / FS / Conf.pm
index ce8bd29..8d1f875 100644 (file)
@@ -8,6 +8,7 @@ use MIME::Base64;
 use FS::ConfItem;
 use FS::ConfDefaults;
 use FS::Conf_compat17;
+use FS::Locales;
 use FS::payby;
 use FS::conf;
 use FS::Record qw(qsearch qsearchs);
@@ -312,7 +313,7 @@ sub delete {
 
   my($name, $agentnum) = @_;
   if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}) ) {
-    warn "[FS::Conf] DELETE $name\n";
+    warn "[FS::Conf] DELETE $name\n" if $DEBUG;
 
     my $oldAutoCommit = $FS::UID::AutoCommit;
     local $FS::UID::AutoCommit = 0;
@@ -395,6 +396,7 @@ sub verify_config_item {
 
   } else {
 
+    no warnings 'uninitialized';
     $error .= "$key fails binary comparison; "
       unless scalar($self->config_binary($key)) eq scalar($compat->config_binary($key));
 
@@ -464,7 +466,7 @@ sub _orbase_items {
                   'key'         => $_,
                   'base_key'    => $proto->key,
                   'section'     => $proto->section,
-                  'description' => 'Alternate ' . $proto->description . '  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
+                  'description' => 'Alternate ' . $proto->description . '  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
                   'type'        => $proto->type,
                 };
               } &$listmaker($base);
@@ -567,18 +569,42 @@ logo.eps
 
 my %msg_template_options = (
   'type'        => 'select-sub',
-  'options_sub' => sub { require FS::Record;
-                         require FS::agent;
-                         require FS::msg_template;
-                         map { $_->msgnum, $_->msgname } 
-                            qsearch('msg_template', { disabled => '' });
-                       },
-  'option_sub'  => sub { require FS::msg_template;
+  'options_sub' => sub { 
+    my @templates = qsearch({
+        'table' => 'msg_template', 
+        'hashref' => { 'disabled' => '' },
+        'extra_sql' => ' AND '. 
+          $FS::CurrentUser::CurrentUser->agentnums_sql(null => 1),
+        });
+    map { $_->msgnum, $_->msgname } @templates;
+  },
+  'option_sub'  => sub { 
                          my $msg_template = FS::msg_template->by_key(shift);
                          $msg_template ? $msg_template->msgname : ''
                        },
+  'per_agent' => 1,
 );
 
+my $_gateway_name = sub {
+  my $g = shift;
+  return '' if !$g;
+  ($g->gateway_username . '@' . $g->gateway_module);
+};
+
+my %payment_gateway_options = (
+  'type'        => 'select-sub',
+  'options_sub' => sub {
+    my @gateways = qsearch({
+        'table' => 'payment_gateway',
+        'hashref' => { 'disabled' => '' },
+      });
+    map { $_->gatewaynum, $_gateway_name->($_) } @gateways;
+  },
+  'option_sub'  => sub {
+    my $gateway = FS::payment_gateway->by_key(shift);
+    $_gateway_name->($gateway);
+  },
+);
 
 #Billing (81 items)
 #Invoicing (50 items)
@@ -597,6 +623,13 @@ my %msg_template_options = (
   },
 
   {
+    'key'         => 'log_sent_mail',
+    'section'     => 'notification',
+    'description' => 'Enable logging of template-generated email.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'alert_expiration',
     'section'     => 'notification',
     'description' => 'Enable alerts about billing method expiration (i.e. expiring credit cards).',
@@ -628,6 +661,41 @@ my %msg_template_options = (
     'description' => 'IP address to assign to new virtual hosts',
     'type'        => 'text',
   },
+  
+  {
+    'key'         => 'credits-auto-apply-disable',
+    'section'     => 'billing',
+    'description' => 'Disable the "Auto-Apply to invoices" UI option for new credits',
+    'type'        => 'checkbox',
+  },
+  
+  {
+    'key'         => 'credit-card-surcharge-percentage',
+    'section'     => 'billing',
+    'description' => 'Add a credit card surcharge to invoices, as a % of the invoice total. WARNING: this is usually prohibited by merchant account / other agreements and/or law, but is currently lawful in AU and UK.',
+    'type'        => 'text',
+  },
+
+  {
+    'key'         => 'discount-show-always',
+    'section'     => 'billing',
+    'description' => 'Generate a line item on an invoice even when a package is discounted 100%',
+    'type'        => 'checkbox',
+  },
+  
+  {
+    'key'         => 'invoice-barcode',
+    'section'     => 'billing',
+    'description' => 'Display a barcode on HTML and PDF invoices',
+    'type'        => 'checkbox',
+  },
+  
+  {
+    'key'         => 'cust_main-select-billday',
+    'section'     => 'billing',
+    'description' => 'When used with a specific billing event, allows the selection of the day of month on which to charge credit card / bank account automatically, on a per-customer basis',
+    'type'        => 'checkbox',
+  },
 
   {
     'key'         => 'encryption',
@@ -690,7 +758,14 @@ my %msg_template_options = (
     'type'        => 'text',
     'per_agent'   => 1,
   },
-
+  
+  {
+    'key'         => 'next-bill-ignore-time',
+    'section'     => 'billing',
+    'description' => 'Ignore the time portion of next bill dates when billing, matching anything from 00:00:00 to 23:59:59 on the billing day.',
+    'type'        => 'checkbox',
+  },
+  
   {
     'key'         => 'business-onlinepayment',
     'section'     => 'billing',
@@ -764,6 +839,17 @@ my %msg_template_options = (
   },
 
   {
+    'key'         => 'date_format_long',
+    'section'     => 'UI',
+    'description' => 'Verbose format for displaying dates',
+    'type'        => 'select',
+    'select_hash' => [
+                       '%b %o, %Y' => 'Mon DDth, YYYY',
+                       '%e %b %Y'  => 'DD Mon YYYY',
+                     ],
+  },
+
+  {
     'key'         => 'deletecustomers',
     'section'     => 'UI',
     'description' => 'Enable customer deletions.  Be very careful!  Deleting a customer will remove all traces that the customer ever existed!  It should probably only be used when auditing a legacy database.  Normally, you cancel all of a customers\' packages if they cancel service.',
@@ -946,14 +1032,14 @@ my %msg_template_options = (
   {
     'key'         => 'invoice_template',
     'section'     => 'invoicing',
-    'description' => 'Text template file for invoices.  Used if no invoice_html template is defined, and also seen by users using non-HTML capable mail clients.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Plaintext_invoice_templates">billing documentation</a> for details.',
+    'description' => 'Text template file for invoices.  Used if no invoice_html template is defined, and also seen by users using non-HTML capable mail clients.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Administration#Plaintext_invoice_templates">billing documentation</a> for details.',
     'type'        => 'textarea',
   },
 
   {
     'key'         => 'invoice_html',
     'section'     => 'invoicing',
-    'description' => 'Optional HTML template for invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#HTML_invoice_templates">billing documentation</a> for details.',
+    'description' => 'Optional HTML template for invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Administration#HTML_invoice_templates">billing documentation</a> for details.',
 
     'type'        => 'textarea',
   },
@@ -992,7 +1078,7 @@ my %msg_template_options = (
   {
     'key'         => 'invoice_latex',
     'section'     => 'invoicing',
-    'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Typeset_.28LaTeX.29_invoice_templates">billing documentation</a> for details.',
+    'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Administration#Typeset_.28LaTeX.29_invoice_templates">billing documentation</a> for details.',
     'type'        => 'textarea',
   },
 
@@ -1181,7 +1267,7 @@ and customer address. Include units.',
     'section'     => 'invoicing',
     'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
     'type'        => 'select',
-    'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 10', 'Net 15', 'Net 20', 'Net 30', 'Net 45', 'Net 60' ],
+    'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 3', 'Net 9', 'Net 10', 'Net 15', 'Net 20', 'Net 21', 'Net 30', 'Net 45', 'Net 60', 'Net 90' ],
   },
 
   { 
@@ -1213,6 +1299,13 @@ and customer address. Include units.',
   },
 
   { 
+    'key'         => 'phone_usage_class_summary',
+    'section'     => 'invoicing',
+    'description' => 'Summarize usage per DID by usage class and display all CDRs together regardless of usage class. Only valid when svc_phone_sections is enabled.',
+    'type'        => 'checkbox',
+  },
+
+  { 
     'key'         => 'svc_phone_sections',
     'section'     => 'invoicing',
     'description' => 'Create a section for each svc_phone when enabled.  Only valid when invoice_sections is enabled.',
@@ -1241,11 +1334,27 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'payment_receipt',
+    'section'     => 'notification',
+    'description' => 'Send payment receipts.',
+    'type'        => 'checkbox',
+    'per_agent'   => 1,
+  },
+
+  {
     'key'         => 'payment_receipt_msgnum',
     'section'     => 'notification',
     'description' => 'Template to use for payment receipts.',
     %msg_template_options,
   },
+  
+  {
+    'key'         => 'payment_receipt_from',
+    'section'     => 'notification',
+    'description' => 'From: address for payment receipts, if not specified in the template.',
+    'type'        => 'text',
+    'per_agent'   => 1,
+  },
 
   {
     'key'         => 'payment_receipt_email',
@@ -1263,6 +1372,7 @@ and customer address. Include units.',
                        'cust_pay'          => 'When payment is made.',
                        'cust_bill_pay_pkg' => 'When payment is applied.',
                      ],
+    'per_agent'   => 1,
   },
 
   {
@@ -1308,7 +1418,12 @@ and customer address. Include units.',
     'editlist_parts' => [ { type=>'text' },
                           { type=>'immutable', value=>'IN' },
                           { type=>'select',
-                            select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS TXT)} },
+                            select_enum => {
+                              map { $_=>$_ }
+                                  #@{ FS::domain_record->rectypes }
+                                  qw(A AAAA CNAME MX NS PTR SPF SRV TXT)
+                            },
+                          },
                           { type=> 'text' }, ],
   },
 
@@ -1361,7 +1476,20 @@ and customer address. Include units.',
     'key'         => 'referraldefault',
     'section'     => 'UI',
     'description' => 'Default referral, specified by refnum',
-    'type'        => 'text',
+    'type'        => 'select-sub',
+    'options_sub' => sub { require FS::Record;
+                           require FS::part_referral;
+                           map { $_->refnum => $_->referral }
+                               FS::Record::qsearch( 'part_referral', 
+                                                   { 'disabled' => '' }
+                                                 );
+                        },
+    'option_sub'  => sub { require FS::Record;
+                           require FS::part_referral;
+                           my $part_referral = FS::Record::qsearchs(
+                            'part_referral', { 'refnum'=>shift } );
+                           $part_referral ? $part_referral->referral : '';
+                        },
   },
 
 #  {
@@ -1422,7 +1550,7 @@ and customer address. Include units.',
   {
     'key'         => 'signupurl',
     'section'     => 'UI',
-    'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Self-Service_Installation">signup server CGI</a>, the customer view screen will display a customized link to the signup server with the appropriate customer as referral',
+    'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:Self-Service_Installation">signup server CGI</a>, the customer view screen will display a customized link to the signup server with the appropriate customer as referral',
     'type'        => 'text',
   },
 
@@ -1600,6 +1728,20 @@ and customer address. Include units.',
     'type'        => 'checkbox',
   },
 
+  { 
+    'key'         => 'username-slash',
+    'section'     => 'username',
+    'description' => 'Allow the slash character (/) in usernames.  When using, make sure to set "Home directory" to fixed and blank in all svc_acct service definitions.',
+    'type'        => 'checkbox',
+  },
+
+  { 
+    'key'         => 'username-equals',
+    'section'     => 'username',
+    'description' => 'Allow the equal sign character (=) in usernames.',
+    'type'        => 'checkbox',
+  },
+
   {
     'key'         => 'safe-part_bill_event',
     'section'     => 'UI',
@@ -1666,9 +1808,9 @@ and customer address. Include units.',
   {
     'key'         => 'locale',
     'section'     => 'UI',
-    'description' => 'Message locale',
+    'description' => 'Default locale',
     'type'        => 'select',
-    'select_enum' => [ qw(en_US) ],
+    'select_enum' => [ FS::Locales->locales ],
   },
 
   {
@@ -1680,6 +1822,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'selfservice-payment_gateway',
+    'section'     => 'self-service',
+    'description' => 'Force the use of this payment gateway for self-service.',
+    %payment_gateway_options,
+  },
+
+  {
     'key'         => 'selfservice-save_unchecked',
     'section'     => 'self-service',
     'description' => 'In self-service, uncheck "Remember information" checkboxes by default (normally, they are checked by default).',
@@ -1687,22 +1836,17 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'default_agentnum',
+    'section'     => 'UI',
+    'description' => 'Default agent for the backoffice',
+    'type'        => 'select-agent',
+  },
+
+  {
     'key'         => 'signup_server-default_agentnum',
     'section'     => 'self-service',
     'description' => 'Default agent for the signup server',
-    'type'        => 'select-sub',
-    'options_sub' => sub { require FS::Record;
-                           require FS::agent;
-                          map { $_->agentnum => $_->agent }
-                               FS::Record::qsearch('agent', { disabled=>'' } );
-                        },
-    'option_sub'  => sub { require FS::Record;
-                           require FS::agent;
-                          my $agent = FS::Record::qsearchs(
-                            'agent', { 'agentnum'=>shift }
-                          );
-                           $agent ? $agent->agent : '';
-                        },
+    'type'        => 'select-agent',
   },
 
   {
@@ -1762,8 +1906,16 @@ and customer address. Include units.',
     'select_hash' => [
                        'svc_acct'  => 'Account (svc_acct)',
                        'svc_phone' => 'Phone number (svc_phone)',
+                       'svc_pbx'   => 'PBX (svc_pbx)',
                      ],
   },
+  
+  {
+    'key'         => 'signup_server-prepaid-template-custnum',
+    'section'     => 'self-service',
+    'description' => 'When the signup server is used with prepaid cards and customer info is not required for signup, the contact/address info will be copied from this customer, if specified',
+    'type'        => 'text',
+  },
 
   {
     'key'         => 'selfservice_server-base_url',
@@ -1801,6 +1953,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'signup_server-third_party_as_card',
+    'section'     => 'self-service',
+    'description' => 'Allow customer payment type to be set to CARD even when using third-party credit card billing.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'selfservice-xmlrpc',
     'section'     => 'self-service',
     'description' => 'Run a standalone self-service XML-RPC server on the backend (on port 8080).',
@@ -1833,6 +1992,7 @@ and customer address. Include units.',
     'section'     => 'notification',
     'description' => 'Enable emailing of credit card and electronic check decline notices.',
     'type'        => 'checkbox',
+    'per_agent'   => 1,
   },
 
   {
@@ -1840,6 +2000,7 @@ and customer address. Include units.',
     'section'     => 'notification',
     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
     'type'        => 'textarea',
+    'per_agent'   => 1,
   },
 
   {
@@ -1868,6 +2029,7 @@ and customer address. Include units.',
     'section'     => 'notification',
     'description' => 'Enable emailing of cancellation notices.  Make sure to select the template in the cancel_msgnum option.',
     'type'        => 'checkbox',
+    'per_agent'   => 1,
   },
 
   {
@@ -1925,6 +2087,14 @@ and customer address. Include units.',
     'description' => 'Template to use for welcome messages when a svc_acct record is created.',
     %msg_template_options,
   },
+  
+  {
+    'key'         => 'svc_acct_welcome_exclude',
+    'section'     => 'notification',
+    'description' => 'A list of svc_acct services for which no welcome email is to be sent.',
+    'type'        => 'select-part_svc',
+    'multiple'    => 1,
+  },
 
   {
     'key'         => 'welcome_email',
@@ -2071,9 +2241,16 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'dump-localdest',
+    'section'     => '',
+    'description' => 'Destination for local database dumps (full path)',
+    'type'        => 'text',
+  },
+
+  {
     'key'         => 'dump-scpdest',
     'section'     => '',
-    'description' => 'destination for scp database dumps: user@host:/path',
+    'description' => 'Destination for scp database dumps: user@host:/path',
     'type'        => 'text',
   },
 
@@ -2220,6 +2397,87 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'selfservice_server-login_svcpart',
+    'section'     => 'self-service',
+    'description' => 'If specified, only allow the specified svcparts to login to self-service.',
+    'type'        => 'select-part_svc',
+    'multiple'    => 1,
+  },
+  
+  {
+    'key'         => 'selfservice-recent-did-age',
+    'section'     => 'self-service',
+    'description' => 'If specified, defines "recent", in number of seconds, for "Download recently allocated DIDs" in self-service.',
+    'type'        => 'text',
+  },
+
+  {
+    'key'         => 'selfservice_server-view-wholesale',
+    'section'     => 'self-service',
+    'description' => 'If enabled, use a wholesale package view in the self-service.',
+    'type'        => 'checkbox',
+  },
+  
+  {
+    'key'         => 'selfservice-agent_signup',
+    'section'     => 'self-service',
+    'description' => 'Allow agent signup via self-service.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'selfservice-agent_signup-agent_type',
+    'section'     => 'self-service',
+    'description' => 'Agent type when allowing agent signup via self-service.',
+    'type'        => 'select-sub',
+    'options_sub' => sub { require FS::Record;
+                           require FS::agent_type;
+                          map { $_->typenum => $_->atype }
+                               FS::Record::qsearch('agent_type', {} ); # disabled=>'' } );
+                        },
+    'option_sub'  => sub { require FS::Record;
+                           require FS::agent_type;
+                          my $agent = FS::Record::qsearchs(
+                            'agent_type', { 'typenum'=>shift }
+                          );
+                           $agent_type ? $agent_type->atype : '';
+                        },
+  },
+
+  {
+    'key'         => 'selfservice-agent_login',
+    'section'     => 'self-service',
+    'description' => 'Allow agent login via self-service.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'selfservice-self_suspend_reason',
+    'section'     => 'self-service',
+    'description' => 'Suspend reason when customers suspend their own packages. Set to nothing to disallow self-suspension.',
+    'type'        => 'select-sub',
+    'options_sub' => sub { require FS::Record;
+                           require FS::reason;
+                           my $type = qsearchs('reason_type', 
+                             { class => 'S' }) 
+                              or return ();
+                          map { $_->reasonnum => $_->reason }
+                               FS::Record::qsearch('reason', 
+                                 { reason_type => $type->typenum } 
+                               );
+                        },
+    'option_sub'  => sub { require FS::Record;
+                           require FS::reason;
+                          my $reason = FS::Record::qsearchs(
+                            'reason', { 'reasonnum' => shift }
+                          );
+                           $reason ? $reason->reason : '';
+                        },
+
+    'per_agent'   => 1,
+  },
+
+  {
     'key'         => 'card_refund-days',
     'section'     => 'billing',
     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
@@ -2252,7 +2510,15 @@ and customer address. Include units.',
   {
     'key'         => 'global_unique-pbx_title',
     'section'     => '',
-    'description' => 'Global phone number uniqueness control: enabled (usual setting - svc_pbx.title must be unique), or disabled turns off duplicate checking for this field.',
+    'description' => 'Global phone number uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
+    'type'        => 'select',
+    'select_enum' => [ 'enabled', 'disabled' ],
+  },
+
+  {
+    'key'         => 'global_unique-pbx_id',
+    'section'     => '',
+    'description' => 'Global PBX id uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
     'type'        => 'select',
     'select_enum' => [ 'enabled', 'disabled' ],
   },
@@ -2275,13 +2541,22 @@ and customer address. Include units.',
   {
     'key'         => 'ticket_system',
     'section'     => '',
-    'description' => 'Ticketing system integration.  <b>RT_Internal</b> uses the built-in RT ticketing system (see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:RT_Installation">integrated ticketing installation instructions</a>).   <b>RT_External</b> accesses an external RT installation in a separate database (local or remote).',
+    'description' => 'Ticketing system integration.  <b>RT_Internal</b> uses the built-in RT ticketing system (see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:2.1:Documentation:RT_Installation">integrated ticketing installation instructions</a>).   <b>RT_External</b> accesses an external RT installation in a separate database (local or remote).',
     'type'        => 'select',
     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
     'select_enum' => [ '', qw(RT_Internal RT_External) ],
   },
 
   {
+    'key'         => 'network_monitoring_system',
+    'section'     => '',
+    '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'         => 'ticket_system-default_queueid',
     'section'     => '',
     'description' => 'Default queue used when creating new customer tickets.',
@@ -2342,6 +2617,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'ticket_system-requestor',
+    'section'     => '',
+    'description' => 'Email address to use as the requestor for new tickets.  If blank, the customer\'s invoicing address(es) will be used.',
+    'type'        => 'text',
+  },
+
+  {
     'key'         => 'ticket_system-priority_reverse',
     'section'     => '',
     'description' => 'Enable this to consider lower numbered priorities more important.  A bad habit we picked up somewhere.  You probably want to avoid it and use the default.',
@@ -2370,6 +2652,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'ticket_system-escalation',
+    'section'     => '',
+    'description' => 'Enable priority escalation of tickets as part of daily batch processing.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'ticket_system-rt_external_datasrc',
     'section'     => '',
     'description' => 'With external RT integration, the DBI data source for the external RT installation, for example, <code>DBI:Pg:user=rt_user;password=rt_word;host=rt.example.com;dbname=rt</code>',
@@ -2401,6 +2690,14 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'company_phonenum',
+    'section'     => 'notification',
+    'description' => 'Your company phone number',
+    'type'        => 'text',
+    'per_agent'   => 1,
+  },
+
+  {
     'key'         => 'echeck-void',
     'section'     => 'deprecated',
     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable local-only voiding of echeck payments in addition to refunds against the payment gateway',
@@ -2424,7 +2721,7 @@ and customer address. Include units.',
   {
     'key'         => 'address1-search',
     'section'     => 'UI',
-    'description' => 'Enable the ability to search the address1 field from customer search.',
+    'description' => 'Enable the ability to search the address1 field from the quick customer search.  Not recommended in most cases as it tends to bring up too many search results - use explicit address searching from the advanced customer search instead.',
     'type'        => 'checkbox',
   },
 
@@ -2572,13 +2869,27 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'cust_pkg-group_by_location',
+    'section'     => 'UI',
+    'description' => "Group packages by location.",
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'cust_pkg-show_fcc_voice_grade_equivalent',
     'section'     => 'UI',
-    'description' => "Show a field on package definitions for assigning a DSO equivalency number suitable for use on FCC form 477.",
+    'description' => "Show a field on package definitions for assigning a DS0 equivalency number suitable for use on FCC form 477.",
     'type'        => 'checkbox',
   },
 
   {
+    'key'         => 'cust_pkg-large_pkg_size',
+    'section'     => 'UI',
+    'description' => "In customer view, summarize packages with more than this many services.  Set to zero to never summarize packages.",
+    'type'        => 'text',
+  },
+
+  {
     'key'         => 'svc_acct-edit_uid',
     'section'     => 'shell',
     'description' => 'Allow UID editing.',
@@ -2607,29 +2918,36 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'voip-cust_accountcode_cdr',
+    'section'     => 'telephony',
+    'description' => 'Enable the per-customer option for CDR breakdown by accountcode.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'voip-cust_cdr_spools',
-    'section'     => '',
+    'section'     => 'telephony',
     'description' => 'Enable the per-customer option for individual CDR spools.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'voip-cust_cdr_squelch',
-    'section'     => '',
+    'section'     => 'telephony',
     'description' => 'Enable the per-customer option for not printing CDR on invoices.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'voip-cdr_email',
-    'section'     => '',
-    'description' => 'Include the call details on emailed invoices even if the customer is configured for not printing them on the invoices.',
+    'section'     => 'telephony',
+    'description' => 'Include the call details on emailed invoices (and HTML invoices viewed in the backend), even if the customer is configured for not printing them on the invoices.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'voip-cust_email_csv_cdr',
-    'section'     => '',
+    'section'     => 'telephony',
     'description' => 'Enable the per-customer option for including CDR information as a CSV attachment on emailed invoices.',
     'type'        => 'checkbox',
   },
@@ -2665,7 +2983,7 @@ and customer address. Include units.',
   {
     'key'         => 'tax-pkg_address',
     'section'     => 'billing',
-    'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the package address instead (when present).  Note that this option is currently incompatible with vendor data taxation enabled by enable_taxproducts.',
+    'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the package address instead (when present).',
     'type'        => 'checkbox',
   },
 
@@ -2702,6 +3020,7 @@ and customer address. Include units.',
     'section'     => 'billing',
     'description' => 'This allows selection of a package to insert on invoices for customers with postal invoices selected.',
     'type'        => 'select-part_pkg',
+    'per_agent'   => 1,
   },
 
   {
@@ -2762,7 +3081,7 @@ 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'
+                       'paymentech', 'ach-spiritone', 'RBC', 'td_eft1464'
                      ]
   },
 
@@ -2809,6 +3128,20 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'batchconfig-td_eft1464',
+    'section'     => 'billing',
+    'description' => 'Configuration for TD Bank EFT1464 batching, seven lines: 1. Originator ID, 2. Datacenter Code, 3. Short name, 4. Long name, 5. Returned payment branch number, 6. Returned payment account, 7. Transaction code.',
+    'type'        => 'textarea',
+  },
+
+  {
+    'key'         => 'batch-manual_approval',
+    'section'     => 'billing',
+    'description' => 'Allow manual batch closure, which will approve all payments that do not yet have a status.  This is not advised, but is needed for payment processors that provide a report of rejected rather than approved payments.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'payment_history-years',
     'section'     => 'UI',
     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
@@ -3111,12 +3444,33 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'prepayment_discounts-credit_type',
+    'section'     => 'billing',
+    'description' => 'Enables the offering of prepayment discounts and establishes the credit reason type.',
+    'type'        => 'select-sub',
+    'options_sub' => sub { require FS::Record;
+                           require FS::reason_type;
+                           map { $_->typenum => $_->type }
+                               FS::Record::qsearch('reason_type', { class=>'R' } );
+                         },
+    'option_sub'  => sub { require FS::Record;
+                           require FS::reason_type;
+                           my $reason_type = FS::Record::qsearchs(
+                             'reason_type', { 'typenum' => shift }
+                           );
+                           $reason_type ? $reason_type->type : '';
+                         },
+
+  },
+
+  {
     'key'         => 'cust_main-agent_custid-format',
     'section'     => '',
     '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',
                      ],
   },
@@ -3160,6 +3514,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'previous_balance-show_credit',
+    'section'     => 'invoicing',
+    'description' => 'Show the customer\'s credit balance on invoices when applicable.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'balance_due_below_line',
     'section'     => 'invoicing',
     'description' => 'Place the balance due message below a line.  Only meaningful when when invoice_sections is false.',
@@ -3199,7 +3560,7 @@ and customer address. Include units.',
     'section'     => 'UI',
     'description' => 'The year to use in census tract lookups',
     'type'        => 'select',
-    'select_enum' => [ qw( 2009 2008 2007 2006 ) ],
+    'select_enum' => [ qw( 2010 2009 2008 ) ],
   },
 
   {
@@ -3245,6 +3606,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'cust_main-title-display_custnum',
+    'section'     => 'UI',
+    'description' => 'Add the display_custom (agent_custid or custnum) to the title on customer view pages.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'cust_bill-default_agent_invid',
     'section'     => 'UI',
     'description' => 'Display the agent_invid field when available instead of the invnum field.',
@@ -3269,6 +3637,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'order_pkg-no_start_date',
+    'section'     => 'UI',
+    'description' => 'Don\'t set a default start date for new packages.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'mcp_svcpart',
     'section'     => '',
     'description' => 'Master Control Program svcpart.  Leave this blank.',
@@ -3495,6 +3870,13 @@ and customer address. Include units.',
     'type'        => 'image',
     'per_agent'   => 1,
   },
+  
+  {
+    'key'         => 'selfservice-view_usage_nodomain',
+    'section'     => 'self-service',
+    'description' => 'Show usernames without their domains in "View my usage" in the self-service interface.',
+    'type'        => 'checkbox',
+  },
 
   {
     'key'         => 'selfservice-bulk_format',
@@ -3536,31 +3918,38 @@ and customer address. Include units.',
 
   {
     'key'         => 'svc_phone-radius-default_password',
-    'section'     => '',
+    'section'     => 'telephony',
     'description' => 'Default password when exporting svc_phone records to RADIUS',
     'type'        => 'text',
   },
 
   {
     'key'         => 'svc_phone-allow_alpha_phonenum',
-    'section'     => '',
+    'section'     => 'telephony',
     'description' => 'Allow letters in phone numbers.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'svc_phone-domain',
-    'section'     => '',
+    'section'     => 'telephony',
     'description' => 'Track an optional domain association with each phone service.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'svc_phone-phone_name-max_length',
-    'section'     => '',
+    'section'     => 'telephony',
     '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-lnp',
+    'section'     => 'telephony',
+    'description' => 'Enables Number Portability features for svc_phone',
+    'type'        => 'checkbox',
+  },
 
   {
     'key'         => 'default_phone_countrycode',
@@ -3571,7 +3960,7 @@ and customer address. Include units.',
 
   {
     'key'         => 'cdr-charged_party-field',
-    'section'     => '',
+    'section'     => 'telephony',
     'description' => 'Set the charged_party field of CDRs to this field.',
     'type'        => 'select-sub',
     'options_sub' => sub { my $fields = FS::cdr->table_info->{'fields'};
@@ -3587,14 +3976,14 @@ and customer address. Include units.',
   #probably deprecate in favor of cdr-charged_party-field above
   {
     'key'         => 'cdr-charged_party-accountcode',
-    'section'     => '',
+    'section'     => 'telephony',
     'description' => 'Set the charged_party field of CDRs to the accountcode.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'cdr-charged_party-accountcode-trim_leading_0s',
-    'section'     => '',
+    'section'     => 'telephony',
     'description' => 'When setting the charged_party field of CDRs to the accountcode, trim any leading zeros.',
     'type'        => 'checkbox',
   },
@@ -3615,19 +4004,26 @@ and customer address. Include units.',
 
   {
     'key'         => 'cdr-charged_party_rewrite',
-    'section'     => '',
+    'section'     => 'telephony',
     'description' => 'Do charged party rewriting in the freeside-cdrrewrited daemon; useful if CDRs are being dropped off directly in the database and require special charged_party processing such as cdr-charged_party-accountcode or cdr-charged_party-truncate*.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'cdr-taqua-da_rewrite',
-    'section'     => '',
+    'section'     => 'telephony',
     'description' => 'For the Taqua CDR format, a comma-separated list of directory assistance 800 numbers.  Any CDRs with these numbers as "BilledNumber" will be rewritten to the "CallingPartyNumber" (and CallType "12") on import.',
     'type'        => 'text',
   },
 
   {
+    'key'         => 'cdr-taqua-accountcode_rewrite',
+    'section'     => 'telephony',
+    'description' => 'For the Taqua CDR format, pull accountcodes from secondary CDRs with matching sessionNumber.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'cust_pkg-show_autosuspend',
     'section'     => 'UI',
     'description' => 'Show package auto-suspend dates.  Use with caution for now; can slow down customer view for large insallations.',
@@ -3636,7 +4032,7 @@ and customer address. Include units.',
 
   {
     'key'         => 'cdr-asterisk_forward_rewrite',
-    'section'     => '',
+    'section'     => 'telephony',
     'description' => 'Enable special processing for CDRs representing forwarded calls: For CDRs that have a dcontext that starts with "Local/" but does not match dst, set charged_party to dst, parse a new dst from dstchannel, and set amaflags to "2" ("BILL"/"BILLING").',
     'type'        => 'checkbox',
   },
@@ -3891,6 +4287,191 @@ and customer address. Include units.',
     'type'        => 'checkbox',
   },
 
+  {
+    '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',
+  },
+
+  {
+    'key'         => 'cust_main-custom_title',
+    'section'     => 'UI',
+    'description' => 'Title for the "Custom" tab in the View Customer page.',
+    'type'        => 'text',
+  },
+
+  {
+    'key'         => 'part_pkg-default_suspend_bill',
+    'section'     => 'billing',
+    'description' => 'Default the "Continue recurring billing while suspended" flag to on for new package definitions.',
+    'type'        => 'checkbox',
+  },
+  
+  {
+    'key'         => 'qual-alt_address_format',
+    'section'     => 'UI',
+    'description' => 'Enable the alternate address format (location type, number, and kind) for qualifications.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'prospect_main-alt_address_format',
+    'section'     => 'UI',
+    'description' => 'Enable the alternate address format (location type, number, and kind) for prospects.  Recommended if qual-alt_address_format is set and the main use of propects is for qualifications.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'prospect_main-location_required',
+    'section'     => 'UI',
+    'description' => 'Require an address for prospects.  Recommended if the main use of propects is for qualifications.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'note-classes',
+    'section'     => 'UI',
+    'description' => 'Use customer note classes',
+    'type'        => 'select',
+    'select_hash' => [
+                       0 => 'Disabled',
+                      1 => 'Enabled',
+                      2 => 'Enabled, with tabs',
+                    ],
+  },
+
+  {
+    'key'         => 'svc_acct-cf_privatekey-message',
+    'section'     => '',
+    'description' => 'For internal use: HTML displayed when cf_privatekey field is set.',
+    'type'        => 'textarea',
+  },
+
+  {
+    'key'         => 'menu-prepend_links',
+    'section'     => 'UI',
+    'description' => 'Links to prepend to the main menu, one per line, with format "URL Link Label (optional ALT popup)".',
+    'type'        => 'textarea',
+  },
+
+  {
+    'key'         => 'cust_main-external_links',
+    'section'     => 'UI',
+    'description' => 'External links available in customer view, one per line, with format "URL Link Label (optional ALT popup)".  The URL will have custnum appended.',
+    'type'        => 'textarea',
+  },
+  
+  {
+    'key'         => 'svc_phone-did-summary',
+    'section'     => 'invoicing',
+    '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'         => 'opensips_gwlist',
+    'section'     => 'telephony',
+    'description' => 'For svc_phone OpenSIPS dr_rules export, gwlist column value, per-agent',
+    'type'        => 'text',
+    'per_agent'   => 1,
+    'agentonly'   => 1,
+  },
+
+  {
+    'key'         => 'opensips_description',
+    'section'     => 'telephony',
+    'description' => 'For svc_phone OpenSIPS dr_rules export, description column value, per-agent',
+    'type'        => 'text',
+    'per_agent'   => 1,
+    'agentonly'   => 1,
+  },
+  
+  {
+    'key'         => 'opensips_route',
+    'section'     => 'telephony',
+    'description' => 'For svc_phone OpenSIPS dr_rules export, routeid column value, per-agent',
+    'type'        => 'text',
+    'per_agent'   => 1,
+    'agentonly'   => 1,
+  },
+
+  {
+    'key'         => 'cust_bill-no_recipients-error',
+    'section'     => 'invoicing',
+    'description' => 'For customers with no invoice recipients, throw a job queue error rather than the default behavior of emailing the invoice to the invoice_from address.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    '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?
+    'type'        => 'select',
+    'select_enum' => [ 'Classic', 'Recurring' ],
+  },
+
+  { 
+    'key'         => 'username-pound',
+    'section'     => 'username',
+    'description' => 'Allow the pound character (#) in usernames.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'ie-compatibility_mode',
+    'section'     => 'UI',
+    'description' => "Compatibility mode META tag for Internet Explorer, used on the customer view page.  Not necessary in normal operation unless custom content (notes, cust_main-custom_link) is included on customer view that is incompatibile with newer IE verisons.",
+    'type'        => 'select',
+    'select_enum' => [ '', '7', 'EmulateIE7', '8', 'EmulateIE8' ],
+  },
+
+  {
+    'key'         => 'disable_payauto_default',
+    'section'     => 'UI',
+    'description' => 'Disable the "Charge future payments to this (card|check) automatically" checkbox from defaulting to checked.',
+    'type'        => 'checkbox',
+  },
+  
+  {
+    'key'         => 'payment-history-report',
+    'section'     => 'UI',
+    'description' => 'Show a link to the payment history report in the Reports menu. DO NOT ENABLE THIS.',
+    '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.',
+    'type'        => 'checkbox',
+  },
+  
+  {
+    'key'         => 'cust-email-high-visibility',
+    'section'     => 'UI',
+    'description' => 'Move the invoicing e-mail address field to the top of the billing address section and highlight it.',
+    'type'        => 'checkbox',
+  },
+  
+  {
+    'key'         => 'cust-edit-alt-field-order',
+    'section'     => 'UI',
+    'description' => 'An alternate ordering of fields for the New Customer and Edit Customer screens.',
+    'type'        => 'checkbox',
+  },
+  
+  {
+    '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.',
+    'type'        => 'select-sub',
+    'multiple'    => 1,
+    'options_sub' => sub { map { $_ => '' } 
+                            grep { $_ ne 'en_US' } FS::Locales::locales;
+                                    },
+    'option_sub'  => sub { ''; },
+  },
 
   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },