changes to support eWay third-party payment, #10208
[freeside.git] / FS / FS / Conf.pm
index 1d946a5..5fb5a27 100644 (file)
@@ -568,18 +568,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)
@@ -1246,6 +1270,7 @@ and customer address. Include units.',
     'section'     => 'notification',
     'description' => 'Send payment receipts.',
     'type'        => 'checkbox',
+    'per_agent'   => 1,
   },
 
   {
@@ -1271,6 +1296,7 @@ and customer address. Include units.',
                        'cust_pay'          => 'When payment is made.',
                        'cust_bill_pay_pkg' => 'When payment is applied.',
                      ],
+    'per_agent'   => 1,
   },
 
   {
@@ -1720,6 +1746,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).',
@@ -1874,6 +1907,7 @@ and customer address. Include units.',
     'section'     => 'notification',
     'description' => 'Enable emailing of credit card and electronic check decline notices.',
     'type'        => 'checkbox',
+    'per_agent'   => 1,
   },
 
   {
@@ -1881,6 +1915,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,
   },
 
   {
@@ -1909,6 +1944,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,
   },
 
   {
@@ -2261,6 +2297,28 @@ 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.',
@@ -2294,6 +2352,32 @@ and customer address. Include units.',
   },
 
   {
+    '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.',
@@ -2654,6 +2738,13 @@ 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.",
@@ -2904,6 +2995,13 @@ and customer address. Include units.',
     '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 very dangerous.',
+#    'type'        => 'checkbox',
+#  },
+#
   {
     'key'         => 'payment_history-years',
     'section'     => 'UI',
@@ -4041,6 +4139,46 @@ and customer address. Include units.',
     '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) on 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 => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },