address standardization part one, finally checked in from here
[freeside.git] / FS / FS / Conf.pm
index adf7413..3aa19b7 100644 (file)
@@ -1,6 +1,7 @@
 package FS::Conf;
 
 use vars qw($base_dir @config_items @base_items @card_types $DEBUG);
+use Carp;
 use IO::File;
 use File::Basename;
 use MIME::Base64;
@@ -84,7 +85,7 @@ global default if one is present.
 
 sub _usecompat {
   my ($self, $method) = (shift, shift);
-  warn "NO CONFIGURATION RECORDS FOUND -- USING COMPATIBILITY MODE"
+  carp "NO CONFIGURATION RECORDS FOUND -- USING COMPATIBILITY MODE"
     if use_confcompat;
   my $compat = new FS::Conf_compat17 ("$base_dir/conf." . datasrc);
   $compat->$method(@_);
@@ -149,12 +150,12 @@ sub exists {
   defined($self->_config($name, $agentnum));
 }
 
-#=item config_orbase KEY SUFFIX
-#
-#Returns the configuration value or values (depending on context) for 
-#KEY_SUFFIX, if it exists, otherwise for KEY
-#
-#=cut
+=item config_orbase KEY SUFFIX
+
+Returns the configuration value or values (depending on context) for 
+KEY_SUFFIX, if it exists, otherwise for KEY
+
+=cut
 
 # outmoded as soon as we shift to agentnum based config values
 # well, mostly.  still useful for e.g. late notices, etc. in that we want
@@ -171,6 +172,26 @@ sub config_orbase {
   }
 }
 
+=item key_orbase KEY SUFFIX
+
+If the config value KEY_SUFFIX exists, returns KEY_SUFFIX, otherwise returns
+KEY.  Useful for determining which exact configuration option is returned by
+config_orbase.
+
+=cut
+
+sub key_orbase {
+  my $self = shift;
+  #no compat for this...return $self->_usecompat('config_orbase', @_) if use_confcompat;
+
+  my( $name, $suffix ) = @_;
+  if ( $self->exists("${name}_$suffix") ) {
+    "${name}_$suffix";
+  } else {
+    $name;
+  }
+}
+
 =item invoice_templatenames
 
 Returns all possible invoice template names.
@@ -420,7 +441,7 @@ sub _orbase_items {
           map { new FS::ConfItem { 
                                    'key' => $_,
                                    'section' => $proto->section,
-                                   'description' => 'Alternate ' . $proto->description . '  See the <a href="../docs/billing.html">billing documentation</a> for details.',
+                                   'description' => 'Alternate ' . $proto->description . '  See the <a href="http://www.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
                                    'type' => $proto->type,
                                  };
               } &$listmaker($base);
@@ -489,8 +510,6 @@ worry that config_items is freeside-specific and icky.
 
 "Configuration" in the web interface (config/config.cgi).
 
-httemplate/docs/config.html
-
 =cut
 
 #Business::CreditCard
@@ -549,7 +568,7 @@ httemplate/docs/config.html
   {
     'key'         => 'alerter_template',
     'section'     => 'billing',
-    'description' => 'Template file for billing method expiration alerts.  See the <a href="../docs/billing.html#invoice_template">billing documentation</a> for details.',
+    'description' => 'Template file for billing method expiration alerts.  See the <a href="http://www.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Credit_cards_and_Electronic_checks">billing documentation</a> for details.',
     'type'        => 'textarea',
   },
 
@@ -617,6 +636,13 @@ httemplate/docs/config.html
   },
 
   {
+    'key'         => 'business-onlinepayment-email_customer',
+    'section'     => 'billing',
+    'description' => 'Controls the "email_customer" flag used by some Business::OnlinePayment processors to enable customer receipts.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'countrydefault',
     'section'     => 'UI',
     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
@@ -734,7 +760,7 @@ httemplate/docs/config.html
 
   {
     'key'         => 'home',
-    'section'     => 'required',
+    'section'     => 'shell',
     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
     'type'        => 'text',
   },
@@ -748,15 +774,15 @@ httemplate/docs/config.html
 
   {
     'key'         => 'invoice_template',
-    'section'     => 'required',
-    'description' => 'Required template file for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
+    'section'     => 'billing',
+    '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.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Plaintext_invoice_templates">billing documentation</a> for details.',
     'type'        => 'textarea',
   },
 
   {
     'key'         => 'invoice_html',
     'section'     => 'billing',
-    'description' => 'Optional HTML template for invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
+    'description' => 'Optional HTML template for invoices.  See the <a href="http://www.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:Administration#HTML_invoice_templates">billing documentation</a> for details.',
 
     'type'        => 'textarea',
   },
@@ -785,7 +811,7 @@ httemplate/docs/config.html
   {
     'key'         => 'invoice_latex',
     'section'     => 'billing',
-    'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="../docs/billing.html">billing documentation</a> for details.',
+    'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="http://www.sisd.com/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Typeset_.28LaTeX.29_invoice_templates">billing documentation</a> for details.',
     'type'        => 'textarea',
   },
 
@@ -837,7 +863,14 @@ httemplate/docs/config.html
     'section'     => 'billing',
     '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 30', 'Net 45', 'Net 60' ],
+    'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 10', 'Net 15', 'Net 20', 'Net 30', 'Net 45', 'Net 60' ],
+  },
+
+  { 
+    'key'         => 'invoice_sections',
+    'section'     => 'billing',
+    'description' => 'Split invoice into sections and label according to package class when enabled.',
+    'type'        => 'checkbox',
   },
 
   {
@@ -951,7 +984,7 @@ httemplate/docs/config.html
 
   {
     'key'         => 'shells',
-    'section'     => 'required',
+    'section'     => 'shell',
     'description' => 'Legal shells (think /etc/shells).  You probably want to `cut -d: -f7 /etc/passwd | sort | uniq\' initially so that importing doesn\'t fail with `Illegal shell\' errors, then remove any special entries afterwords.  A blank line specifies that an empty shell is permitted.',
     'type'        => 'textarea',
   },
@@ -966,7 +999,7 @@ httemplate/docs/config.html
   {
     'key'         => 'signupurl',
     'section'     => 'UI',
-    'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your <a href="../docs/signup.html">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.sisd.com/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',
     'type'        => 'text',
   },
 
@@ -1373,6 +1406,13 @@ httemplate/docs/config.html
   },
 
   {
+    'key'         => 'enable_taxproducts',
+    'section'     => 'billing',
+    'description' => 'Enable per-package mapping to new style tax classes',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'welcome_email',
     'section'     => '',
     'description' => 'Template file for welcome email.  Welcome emails are sent to the customer email invoice destination(s) each time a svc_acct record is created.  See the <a href="http://search.cpan.org/~mjd/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language.  The following variables are available<ul><li><code>$username</code> <li><code>$password</code> <li><code>$first</code> <li><code>$last</code> <li><code>$pkg</code></ul>',
@@ -1579,6 +1619,13 @@ httemplate/docs/config.html
   },
 
   {
+    'key'         => 'selfservice_server-phone_login',
+    'section'     => '',
+    'description' => 'Allow login to self-service with phone number and PIN.',
+    'type'        => 'checkbox',
+  },
+
+  {
     '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.',
@@ -1618,7 +1665,7 @@ httemplate/docs/config.html
   {
     'key'         => 'ticket_system',
     'section'     => '',
-    'description' => 'Ticketing system integration.  <b>RT_Internal</b> uses the built-in RT ticketing system (see the <a href="../docs/install-rt">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.sisd.com/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).',
     'type'        => 'select',
     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
     'select_enum' => [ '', qw(RT_Internal RT_External) ],
@@ -1652,6 +1699,13 @@ httemplate/docs/config.html
   },
 
   {
+    '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.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'ticket_system-custom_priority_field',
     'section'     => '',
     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
@@ -1695,9 +1749,23 @@ httemplate/docs/config.html
   },
 
   {
+    'key'         => 'company_address',
+    'section'     => 'required',
+    'description' => 'Your company address',
+    'type'        => 'textarea',
+  },
+
+  {
     'key'         => 'address2-search',
     'section'     => 'UI',
-    'description' => 'Enable a "Unit" search box which searches the second address field',
+    'description' => 'Enable a "Unit" search box which searches the second address field.  Useful for multi-tenant applications.  See also: cust_main-require_address2',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'cust_main-require_address2',
+    'section'     => 'UI',
+    'description' => 'Second address field is required (on service address only, if billing and service addresses differ).  Also enables "Unit" labeling of address2 on customer view and edit pages.  Useful for multi-tenant applications.  See also: address2-search',
     'type'        => 'checkbox',
   },
 
@@ -2006,6 +2074,14 @@ httemplate/docs/config.html
   },
 
   {
+    'key'         => 'selfservice-session_timeout',
+    'section'     => '',
+    'description' => 'Self-service session timeout.  Defaults to 1 hour.',
+    'type'        => 'select',
+    'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
+  },
+
+  {
     'key'         => 'disable_setup_suspended_pkgs',
     'section'     => 'billing',
     'description' => 'Disables charging of setup fees for suspended packages.',
@@ -2064,7 +2140,7 @@ httemplate/docs/config.html
   {
     'key'         => 'cust_main-require_invoicing_list_email',
     'section'     => '',
-    'description' => 'Require at least one invoicing email address for all customer records.',
+    'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
     'type'        => 'checkbox',
   },
 
@@ -2075,6 +2151,112 @@ httemplate/docs/config.html
     'type'        => 'checkbox',
   },
 
+  {
+    'key'         => 'cancel_credit_type',
+    'section'     => 'billing',
+    'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
+    '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'         => 'referral_credit_type',
+    'section'     => 'billing',
+    'description' => 'The group to use for new, automatically generated credit reasons resulting from referrals.',
+    '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'         => 'signup_credit_type',
+    'section'     => 'billing',
+    'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
+    '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',
+                       'ww?d+' => 'Numeric with one or two letter prefix',
+                     ],
+  },
+
+  {
+    'key'         => 'card_masking_method',
+    'section'     => 'UI',
+    'description' => 'Digits to display when masking credit cards.  Note that the first six digits are necessary to canonically identify the credit card type (Visa/MC, Amex, Discover, Maestro, etc.) in all cases.  The first four digits can identify the most common credit card types in most cases (Visa/MC, Amex, and Discover).  The first two digits can distinguish between Visa/MC and Amex.',
+    'type'        => 'select',
+    'select_hash' => [
+                       ''            => '123456xxxxxx1234',
+                       'first6last2' => '123456xxxxxxxx12',
+                       'first4last4' => '1234xxxxxxxx1234',
+                       'first4last2' => '1234xxxxxxxxxx12',
+                       'first2last4' => '12xxxxxxxxxx1234',
+                       'first2last2' => '12xxxxxxxxxxxx12',
+                       'first0last4' => 'xxxxxxxxxxxx1234',
+                       'first0last2' => 'xxxxxxxxxxxxxx12',
+                     ],
+  },
+
+  {
+    'key'         => 'usps_webtools-userid',
+    'section'     => 'UI',
+    'description' => 'Production UserID for USPS web tools.   Enables USPS address standardization.  See the <a href="http://www.usps.com/webtools/">USPS website</a>, register and agree not to use the tools for batch purposes.',
+    'type'        => 'text',
+  },
+
+  {
+    'key'         => 'usps_webtools-password',
+    'section'     => 'UI',
+    'description' => 'Production password for USPS web tools.   Enables USPS address standardization.  See <a href="http://www.usps.com/webtools/">USPS website</a>, register and agree not to use the tools for batch purposes.',
+    'type'        => 'text',
+  },
+
+  {
+    'key'         => 'cust_main-auto_standardize_address',
+    'section'     => 'UI',
+    'description' => 'When using USPS web tools, automatically standardize the address without asking.',
+    'type'        => 'checkbox',
+  },
+
 );
 
 1;