RT# 79737 - Added ability to us a cc surcharge of a flat fee.
[freeside.git] / FS / FS / Conf.pm
index ea1d391..5c6c411 100644 (file)
@@ -10,6 +10,7 @@ use IO::File;
 use File::Basename;
 use MIME::Base64;
 use Locale::Currency;
+use Email::Address;
 use FS::ConfItem;
 use FS::ConfDefaults;
 use FS::Locales;
@@ -542,10 +543,11 @@ defined, company_name), appropriately combined based on their current values.
 sub invoice_from_full {
   my ($self, $agentnum) = @_;
 
-  (    $self->config('invoice_from_name', $agentnum)
-    || $self->config('company_name', $agentnum)
-  ).
-  ' <'. $self->config('invoice_from', $agentnum ). '>';
+  my $name =  $self->config('invoice_from_name', $agentnum)
+           || $self->config('company_name', $agentnum);
+
+  Email::Address->new( $name => $self->config('invoice_from', $agentnum ) )
+    ->format;
 }
 
 =back
@@ -621,8 +623,8 @@ logo.eps
   '',
   'Payable upon receipt',
   'Net 0', 'Net 3', 'Net 5', 'Net 7', 'Net 9', 'Net 10', 'Net 14', 
-  'Net 15', 'Net 18', 'Net 20', 'Net 21', 'Net 25', 'Net 30', 'Net 45', 
-  'Net 60', 'Net 90'
+  'Net 15', 'Net 18', 'Net 20', 'Net 21', 'Net 25', 'End of Month', 'Net 30',
+  'Net 45', 'Net 60', 'Net 90'
 );
 
 my %msg_template_options = (
@@ -669,6 +671,7 @@ my %batch_gateway_options = (
     );
     map { $_->gatewaynum, $_->label } @gateways;
   },
+  'per_agent' => 1,
 );
 
 my %invoice_mode_options = (
@@ -770,16 +773,17 @@ my $validate_email = sub { $_[0] =~
   },
   
   {
-    'key'         => 'no_saved_cardnumbers',
+    'key'         => 'credit-card-surcharge-percentage',
     'section'     => 'credit_cards',
-    'description' => 'Do not allow credit card numbers to be written to the database.  Prevents realtime processing unless payment gateway supports tokenization.',
-    'type'        => 'checkbox',
+    'description' => 'Add a credit card surcharge to invoices, as a % of the invoice total.  WARNING: Although recently permitted to US merchants in general, specific consumer protection laws may prohibit or restrict this practice in California, Colorado, Connecticut, Florda, Kansas, Maine, Massachusetts, New York, Oklahome, and Texas.  Surcharging is also generally prohibited in most countries outside the US, AU and UK.  When allowed, typically not permitted to be above 4%.',
+    'type'        => 'text',
+    'per_agent'   => 1,
   },
 
   {
-    'key'         => 'credit-card-surcharge-percentage',
+    'key'         => 'credit-card-surcharge-flatfee',
     'section'     => 'credit_cards',
-    'description' => 'Add a credit card surcharge to invoices, as a % of the invoice total.  WARNING: Although recently permitted to US merchants in general, specific consumer protection laws may prohibit or restrict this practice in California, Colorado, Connecticut, Florda, Kansas, Maine, Massachusetts, New York, Oklahome, and Texas.  Surcharging is also generally prohibited in most countries outside the US, AU and UK.  When allowed, typically not permitted to be above 4%.',
+    'description' => 'Add a credit card surcharge to invoices, as a flat fee.',
     'type'        => 'text',
     'per_agent'   => 1,
   },
@@ -902,6 +906,14 @@ my $validate_email = sub { $_[0] =~
   },
 
   {
+    'key'         => 'email-to-voice_domain',
+    'section'     => 'email_to_voice_services',
+    'description' => 'The domain name that phone numbers will be attached to for sending email to voice emails via a 3rd party email to voice service.  You will get this domain from your email to voice service provider.  This is utilized on the email customer page or when using the email to voice billing event action.  There you will be able to select the phone number for the email to voice service.',
+    '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.',
@@ -1211,6 +1223,7 @@ my $validate_email = sub { $_[0] =~
     'section'     => 'invoicing',
     'description' => 'Indicates that html and latex invoices should be in summary style and make use of invoice_latexsummary.',
     'type'        => 'checkbox',
+    'per_agent'   => 1,
   },
 
   {
@@ -1512,6 +1525,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'quotation_disable_after_days',
+    'section'     => 'quotations',
+    'description' => 'The number of days, if set, after which a non-converted quotation will be automatically disabled.',
+    'type'        => 'text'
+  },
+
+  {
     'key'         => 'invoice_print_pdf',
     'section'     => 'printing',
     'description' => 'For all invoice print operations, store postal invoices for download in PDF format rather than printing them directly.',
@@ -1535,7 +1555,7 @@ and customer address. Include units.',
   { 
     'key'         => 'invoice_default_terms',
     'section'     => 'invoicing',
-    'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
+    'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.  WARNING: If you do not want to change the terms on existing invoices, do not change this after going live.',
     'type'        => 'select',
     'per_agent'   => 1,
     'select_enum' => \@invoice_terms,
@@ -1549,11 +1569,37 @@ and customer address. Include units.',
   },
 
   { 
+    'key'         => 'invoice_omit_due_date',
+    'section'     => 'invoice_balances',
+    'description' => 'Omit the "Please pay by (date)" from invoices.',
+    'type'        => 'checkbox',
+    'per_agent'   => 1,
+  },
+
+  { 
+    'key'         => 'invoice_pay_by_msg',
+    'section'     => 'invoice_balances',
+    'description' => 'Test of the "Please pay by (date)" message.  Include [_1] to indicate the date, for example: "Please pay by [_1]"',
+    'type'        => 'text',
+    'per_agent'   => 1,
+  },
+
+  { 
     'key'         => 'invoice_sections',
     'section'     => 'invoicing',
-    'description' => 'Split invoice into sections and label according to package category when enabled.',
+    'description' => 'Split invoice into sections and label according to either package category or location when enabled.',
     'type'        => 'checkbox',
     'per_agent'   => 1,
+    'config_bool' => 1,
+  },
+
+  {
+    'key'         => 'invoice_sections_multilocation',
+    'section'     => 'invoicing',
+    'description' => 'Enable invoice_sections for for any bill with at least this many locations on the bill.',
+    'type'        => 'text',
+    'per_agent'   => 1,
+    'validate'    => sub { shift =~ /^\d+$/ ? undef : 'Please enter a number' },
   },
 
   { 
@@ -1572,6 +1618,15 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'invoice_sections_with_taxes',
+    'section'     => 'invoicing',
+    'description' => 'Include taxes within each section of mutli-section invoices.',
+    'type'        => 'checkbox',
+    'per_agent'   => 1,
+    'agent_bool'  => 1,
+  },
+
+  {
     'key'         => 'summary_subtotals_method',
     'section'     => 'invoicing',
     'description' => 'How to group line items when calculating summary subtotals.  By default, it will be the same method used for grouping invoice sections.',
@@ -1590,28 +1645,28 @@ and customer address. Include units.',
 
   {
     'key'         => 'usage_class_summary',
-    'section'     => 'telephony',
+    'section'     => 'telephony_invoicing',
     'description' => 'On invoices, summarize total usage by usage class in a separate section',
     'type'        => 'checkbox',
   },
 
   { 
     'key'         => 'usage_class_as_a_section',
-    'section'     => 'telephony',
+    'section'     => 'telephony_invoicing',
     'description' => 'On invoices, split usage into sections and label according to usage class name when enabled.  Only valid when invoice_sections is enabled.',
     'type'        => 'checkbox',
   },
 
   { 
     'key'         => 'phone_usage_class_summary',
-    'section'     => 'telephony',
+    'section'     => 'telephony_invoicing',
     'description' => 'On invoices, 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'     => 'telephony',
+    'section'     => 'telephony_invoicing',
     'description' => 'On invoices, create a section for each svc_phone when enabled.  Only valid when invoice_sections is enabled.',
     'type'        => 'checkbox',
   },
@@ -1625,7 +1680,7 @@ and customer address. Include units.',
 
   { 
     'key'         => 'separate_usage',
-    'section'     => 'telephony',
+    'section'     => 'telephony_invoicing',
     'description' => 'On invoices, split the rated call usage into a separate line from the recurring charges.',
     'type'        => 'checkbox',
   },
@@ -1652,6 +1707,13 @@ and customer address. Include units.',
     'description' => 'Template to use for manual payment receipts.',
     %msg_template_options,
   },
+
+  {
+    'key'         => 'payment_receipt_msgnum_auto',
+    'section'     => 'notification',
+    'description' => 'Automatic payments will cause a post-payment to use a message template for automatic payment receipts rather than a post payment statement.',
+    %msg_template_options,
+  },
   
   {
     'key'         => 'payment_receipt_from',
@@ -2411,6 +2473,21 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'cancel_msgnum-referring_cust-pkg_class',
+    'section'     => 'cancellation',
+    'description' => 'Enable cancellation messages to the referring customer for these package classes.',
+    'type'        => 'select-pkg_class',
+    'multiple'    => 1,
+  },
+
+  {
+    'key'         => 'cancel_msgnum-referring_cust',
+    'section'     => 'cancellation',
+    'description' => 'Template to use for cancellation emails sent to the referring customer.',
+    %msg_template_options,
+  },
+
+  {
     'key'         => 'require_cardname',
     'section'     => 'credit_cards',
     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
@@ -2436,7 +2513,7 @@ and customer address. Include units.',
     'section'     => 'taxation',
     'description' => 'Tax data vendor you are using.',
     'type'        => 'select',
-    'select_enum' => [ '', 'cch', 'billsoft', 'avalara', 'suretax' ],
+    'select_enum' => [ '', 'cch', 'billsoft', 'avalara', 'suretax', 'compliance_solutions' ],
   },
 
   {
@@ -2456,11 +2533,18 @@ and customer address. Include units.',
   {
     'key'         => 'billsoft-company_code',
     'section'     => 'taxation',
-    'description' => 'Billsoft tax service company code (3 letters)',
+    'description' => 'Billsoft (AvaTax for Communications) tax service company code (3 letters)',
     'type'        => 'text',
   },
 
   {
+    'key'         => 'billsoft-taxconfig',
+    'section'     => 'taxation',
+    'description' => 'Billsoft tax configuration flags. Four lines: Facilities, Franchise, Regulated, Business Class. See the Avalara documentation for instructions on setting these flags.',
+    'type'        => 'textarea',
+  },
+
+  {
     'key'         => 'avalara-taxconfig',
     'section'     => 'taxation',
     'description' => 'Avalara tax service configuration. Four lines: company code, account number, license key, test mode (1 to enable).',
@@ -2502,6 +2586,20 @@ and customer address. Include units.',
     'per_agent'   => 1,
   },
 
+  {
+    'key'         => 'compliance_solutions-access_code',
+    'section'     => 'taxation',
+    'description' => 'Access code for <a href="http://csilongwood.com/">Compliance Solutions</a> tax rating service',
+    'type'        => 'text',
+  },
+  {
+    'key'         => 'compliance_solutions-regulatory_code',
+    'section'     => 'taxation',
+    'description' => 'Compliance Solutions regulatory status.',
+    'type'        => 'select',
+    'select_enum' => [ '', 'ILEC', 'IXC', 'CLEC', 'VOIP', 'ISP', 'Wireless' ],
+    'per_agent'   => 1,
+  },
 
   {
     'key'         => 'welcome_msgnum',
@@ -2690,13 +2788,6 @@ and customer address. Include units.',
   },
 
   {
-    'key'         => 'manual_process-single_invoice_amount',
-    'section'     => 'payments',
-    'description' => 'When entering manual credit card and ACH payments, amount will not autofill if the customer has more than one open invoice',
-    'type'        => 'checkbox',
-  },
-
-  {
     'key'         => 'manual_process-pkgpart',
     'section'     => 'payments',
     'description' => 'Package to add to each manual credit card and ACH payment entered by employees from the backend.  WARNING: Although recently permitted to US merchants in general, specific consumer protection laws may prohibit or restrict this practice in California, Colorado, Connecticut, Florda, Kansas, Maine, Massachusetts, New York, Oklahome, and Texas. Surcharging is also generally prohibited in most countries outside the US, AU and UK.',
@@ -2893,6 +2984,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'selfservice-password_reset_hours',
+    'section'     => 'self-service',
+    'description' => 'Numbers of hours an email password reset is valid.  Defaults to 24.',
+    'type'        => 'text',
+  },
+
+  {
     'key'         => 'selfservice-password_reset_msgnum',
     'section'     => 'self-service',
     'description' => 'Template to use for password reset emails.',
@@ -3562,35 +3660,28 @@ and customer address. Include units.',
 
   {
     'key'         => 'voip-cust_accountcode_cdr',
-    'section'     => 'telephony',
+    'section'     => 'telephony_invoicing',
     'description' => 'Enable the per-customer option for CDR breakdown by accountcode.',
     'type'        => 'checkbox',
   },
 
   {
-    'key'         => 'voip-cust_cdr_spools',
-    'section'     => 'telephony',
-    'description' => 'Enable the per-customer option for individual CDR spools.',
-    'type'        => 'checkbox',
-  },
-
-  {
     'key'         => 'voip-cust_cdr_squelch',
-    'section'     => 'telephony',
+    'section'     => 'telephony_invoicing',
     'description' => 'Enable the per-customer option for not printing CDR on invoices.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'voip-cdr_email',
-    'section'     => 'telephony',
+    'section'     => 'telephony_invoicing',
     'description' => 'Include the call details inline on emailed invoices (and HTML invoices viewed in the backend), even if the customer is configured for not printing them on the invoices.  Useful for including these details in electronic delivery but omitting them when printing.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'voip-cdr_email_attach',
-    'section'     => 'telephony',
+    'section'     => 'telephony_invoicing',
     'description' => 'Enable the per-customer option for including CDR information as an attachment on emailed invoices.',
     'type'        => 'select',
     'select_hash' => [ ''    => 'Disabled',
@@ -4247,6 +4338,7 @@ and customer address. Include units.',
                        ''       => 'Numeric only',
                        '\d{7}'  => 'Numeric only, exactly 7 digits',
                        'ww?d+'  => 'Numeric with one or two letter prefix',
+                       'd+-w'   => 'Numeric with a dash and one letter suffix',
                      ],
   },
 
@@ -4424,7 +4516,7 @@ and customer address. Include units.',
     'section'     => 'addresses',
     'description' => 'The year to use in census tract lookups.  NOTE: you need to select 2012 or 2013 for Year 2010 Census tract codes.  A selection of 2011 provides Year 2000 Census tract codes.  Use the freeside-censustract-update tool if exisitng customers need to be changed.',
     'type'        => 'select',
-    'select_enum' => [ qw( 2013 2012 2011 ) ],
+    'select_enum' => [ qw( 2017 2016 2015 ) ],
   },
 
   {
@@ -4782,6 +4874,7 @@ and customer address. Include units.',
                        'Change billing address',
                        'Change service address',
                        'Change payment information',
+                       'Change packages',
                        'Change password(s)',
                        'Logout',
                      ],
@@ -5717,6 +5810,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'selfservice-ACH_info_readonly',
+    'section'     => 'self-service',
+    'description' => 'make ACH on self service portal read only',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'selfservice-announcement',
     'section'     => 'self-service',
     'description' => 'HTML announcement to display to all authenticated users on account overview page',
@@ -5725,8 +5825,8 @@ and customer address. Include units.',
 
   {
     'key'         => 'logout-timeout',
-    'section'     => 'UI',
-    'description' => 'If set, automatically log users out of the backoffice after this many minutes.',
+    'section'     => 'deprecated',
+    'description' => 'Deprecated.  Used to automatically log users out of the backoffice after this many minutes.  Set session timeouts in employee groups instead.',
     'type'       => 'text',
   },
   
@@ -5876,6 +5976,14 @@ and customer address. Include units.',
     'type'        => 'text',
   },
 
+  {
+    'key'         => 'selfservice-db_profile',
+    'section'     => 'development',
+    'description' => 'Enable collection and logging of database profiling information for self-service servers.  This has significant overhead, do not leave enabled in production beyond that necessary to collect profiling data.',
+    'type'        => 'checkbox',
+  },
+
+
   # for internal use only; test databases should declare this option and
   # everyone else should pretend it doesn't exist
   #{
@@ -5888,4 +5996,3 @@ and customer address. Include units.',
 );
 
 1;
-