add batch-enable_payby and realtime_disable_payby for better control over hybrid...
authorivan <ivan>
Thu, 16 Oct 2008 05:29:00 +0000 (05:29 +0000)
committerivan <ivan>
Thu, 16 Oct 2008 05:29:00 +0000 (05:29 +0000)
FS/FS/Conf.pm
httemplate/misc/payment.cgi
httemplate/search/cust_pay_batch.cgi
httemplate/view/cust_main/payment_history.html

index cbd0385..7eea4f7 100644 (file)
@@ -1552,8 +1552,8 @@ worry that config_items is freeside-specific and icky.
 
   {
     'key'         => 'paymentforcedtobatch',
-    'section'     => 'UI',
-    'description' => 'Causes per customer payment entry to be forced to a batch processor rather than performed realtime.',
+    'section'     => 'deprecated',
+    'description' => 'See batch-enable_payby and realtime-disable_payby.  Used to (for CHEK): Cause per customer payment entry to be forced to a batch processor rather than performed realtime.',
     'type'        => 'checkbox',
   },
 
@@ -2020,12 +2020,29 @@ worry that config_items is freeside-specific and icky.
 
   {
     'key'         => 'batch-enable',
-    'section'     => 'billing',
+    'section'     => 'deprecated', #make sure batch-enable_payby is set for
+                                   #everyone before removing
     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
     'type'        => 'checkbox',
   },
 
   {
+    'key'         => 'batch-enable_payby',
+    'section'     => 'billing',
+    'description' => 'Enable batch processing for the specified payment types.',
+    'type'        => 'selectmultiple',
+    'select_enum' => [qw( CARD CHEK )],
+  },
+
+  {
+    'key'         => 'realtime-disable_payby',
+    'section'     => 'billing',
+    'description' => 'Disable realtime processing for the specified payment types.',
+    'type'        => 'selectmultiple',
+    'select_enum' => [qw( CARD CHEK )],
+  },
+
+  {
     'key'         => 'batch-default_format',
     'section'     => 'billing',
     'description' => 'Default format for batches.',
index 7546a85..9aaa459 100644 (file)
     <INPUT TYPE="checkbox" CHECKED NAME="save" VALUE="1">
     Remember this information
   </TD>
-</TR><TR>
-% if ($conf->exists("batch-enable")) {
-  <TD COLSPAN=2>
-    <INPUT TYPE="checkbox" <% ( $conf->exists("paymentforcedtobatch") && $payby eq 'CHEK' ) ? 'CHECKED DISABLED' : '' %> NAME="batch" VALUE="1">
-    Add to current batch
-% if ($conf->exists("paymentforcedtobatch") && $payby eq 'CHEK' ) {
-    <INPUT TYPE="hidden" NAME="batch" VALUE="1">
-% }
-  </TD>
-</TR><TR>
+</TR>
+
+% if ( $conf->exists("batch-enable")
+%      || grep $payby eq $_, $conf->config('batch-enable_payby')
+%    ) {
+%
+%     if ( grep $payby eq $_, $conf->config('realtime-disable_payby') ) {
+
+          <INPUT TYPE="hidden" NAME="batch" VALUE="1">
+
+%     } else {
+
+          <TR>
+            <TD COLSPAN=2>
+              <INPUT TYPE="checkbox" NAME="batch" VALUE="1">
+              Add to current batch
+            </TD>
+          </TR>
+
+%     }
 % }
+
+<TR>
   <TD COLSPAN=2>
     <INPUT TYPE="checkbox"<% ( ( $payby eq 'CARD' && $cust_main->payby ne 'DCRD' ) || ( $payby eq 'CHEK' && $cust_main->payby eq 'CHEK' ) ) ? ' CHECKED' : '' %> NAME="auto" VALUE="1" onClick="if (this.checked) { document.OneTrueForm.save.checked=true; }">
     Charge future payments to this <% $type{$payby} %> automatically
   </TD>
 </TR>
+
 </TABLE>
+
 <BR>
 <INPUT TYPE="submit" NAME="process" VALUE="Process payment">
 </FORM>
index 60dca8c..1576963 100755 (executable)
@@ -63,7 +63,9 @@ die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Financial reports')
       || $FS::CurrentUser::CurrentUser->access_right('Process batches')
       || ( $cgi->param('custnum') 
-           && $conf->exists('batch-enable')
+           && (    $conf->exists('batch-enable')
+                || $conf->config('batch-enable_payby')
+              )
            #&& $FS::CurrentUser::CurrentUser->access_right('View customer batched payments')
          );
 
index bc01d68..c3a9019 100644 (file)
 
 %# batched payment links
 
-% if ( $conf->exists('batch-enable')
+% if ( ( $conf->exists('batch-enable') || $conf->config('batch-enable_payby') )
 %      && $curuser->access_right('View customer batched payments')
 %    ) { 
   View batched payments: