X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=fs_selfservice%2FFS-SelfService%2Fcgi%2Fchange_pay.html;h=e38ba762d7fc5574bdc2011d83d4cdecd534d9a6;hb=31f1e1bd302bd88d97d56b20dffad5c5f2388261;hp=e7a9969316318217a1e4a20b61e9ce0e799b683e;hpb=7f43bf155bc79e3c9bd5d88e53117595963c301e;p=freeside.git

diff --git a/fs_selfservice/FS-SelfService/cgi/change_pay.html b/fs_selfservice/FS-SelfService/cgi/change_pay.html
index e7a996931..e38ba762d 100644
--- a/fs_selfservice/FS-SelfService/cgi/change_pay.html
+++ b/fs_selfservice/FS-SelfService/cgi/change_pay.html
@@ -1,7 +1,5 @@
-<%= $url = "$selfurl?session=$session_id;action="; ''; %>
-<%= include('header') %>
+<%= include('header', 'Change payment information') %>
 
-<FONT SIZE=4>Change payment information</FONT><BR><BR>
 <%= if ( $error ) { 
   $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">Error: $error</FONT><BR><BR>!;
   }  ''; %>
@@ -14,7 +12,7 @@
   my $preauto = '<TR><TD COLSPAN=3><INPUT TYPE="checkbox" NAME="auto" VALUE="1"';
   my $postauto = '>Charge future payments to this card automatically</TD></TR>';
 
-  my $tail = qq(</TABLE><INPUT TYPE="hidden" NAME="session" VALUE="$session_id">). 
+  my $tail = qq(</TABLE>).
              qq(<INPUT TYPE="hidden" NAME="action" VALUE="process_change_pay">).
              qq(<BR>).
              qq(<INPUT TYPE="submit" NAME="process" ).
@@ -39,6 +37,11 @@
                       'PREP'   => qq/Prepaid Card/,
                       'PREPAY' => qq/Prepaid Card/,
                     );
+
+  ## Don't show CHEK or DCHK option if ACH is read only
+  delete( $payby_index{'CHEK'} ) unless !$ach_read_only;
+  delete( $payby_index{'DCHK'} ) unless !$ach_read_only;
+
   tie my %options, 'Tie::IxHash', ();
   foreach my $payby_option ( grep { exists( $payby_index{$_} ) } @paybys ) {
     $options{$payby_option} = $payby_index{$payby_option};
@@ -46,6 +49,20 @@
   $options{$payby} = $payby_index{$payby}
     unless exists($options{$payby});
 
+  #don't want to show multiple "Credit card" or "Check" options
+  my %paybyremove = (
+    'CARD' => 'DCRD',
+    'DCRD' => 'CARD',
+    'CHEK' => 'DCHK',
+    'DCHK' => 'CHEK',
+  );
+  delete( $options{ $paybyremove{$payby} } );
+  delete $options{'DCRD'} unless $payby eq 'DCRD' || ! exists $options{'CARD'};
+  delete $options{'DCHK'} unless $payby eq 'DCHK' || ! exists $options{'CHEK'};
+
+  ## setting payby to default to layer if only one.  should we always display first layer?
+  if (keys %options == 1) { @p = keys %options; $payby = $p[0]; }
+
   HTML::Widgets::SelectLayers->new(
     options => \%options,
     selected_layer => $payby,