RT# 79902 - fixed so change payment information link will still work when upgraded...
authorChristopher Burger <burgerc@freeside.biz>
Tue, 30 Oct 2018 15:07:15 +0000 (11:07 -0400)
committerChristopher Burger <burgerc@freeside.biz>
Tue, 30 Oct 2018 19:16:33 +0000 (15:16 -0400)
Conflicts:
FS/FS/ClientAPI/MyAccount.pm
fs_selfservice/FS-SelfService/cgi/selfservice.cgi

FS/FS/ClientAPI/MyAccount.pm
fs_selfservice/FS-SelfService/cgi/change_pay.html
fs_selfservice/FS-SelfService/cgi/selfservice.cgi

index 9e1a4ad..cb6a938 100644 (file)
@@ -613,6 +613,7 @@ sub customer_info_short {
       $return{payinfo} = $cust_main->paymask;
       @return{'month', 'year'} = $cust_main->paydate_monthyear;
     }
+    else { delete $return{'payinfo'}; }
     
     my @invoicing_list = $cust_main->invoicing_list;
     $return{'invoicing_list'} =
index f90f6d9..75ceee8 100644 (file)
@@ -14,6 +14,7 @@
 
   my $tail = qq(</TABLE>).
              qq(<INPUT TYPE="hidden" NAME="action" VALUE="process_change_pay">).
+             qq(<INPUT TYPE="hidden" NAME="custpaybynum" VALUE="$custpaybynum">).
              qq(<BR>).
              qq(<INPUT TYPE="submit" NAME="process" ).
              qq(VALUE="Save payment information"> ).
@@ -60,9 +61,6 @@
   delete $options{'DCRD'} unless $payby eq 'DCRD' || ! exists $options{'CARD'};
   delete $options{'DCHK'} unless $payby eq 'DCHK' || ! exists $options{'CHEK'};
 
-  ## set default layer to first payby.
-  @p = keys %options; $payby = $p[0];
-
   HTML::Widgets::SelectLayers->new(
     options => \%options,
     selected_layer => $payby,
index 831c059..dcfccdc 100755 (executable)
@@ -306,8 +306,9 @@ sub process_change_ship {
 sub process_change_pay {
         my $postal = $cgi->param( 'postal_invoicing' );
         my $payby  = $cgi->param( 'payby' );
+        $cgi->param('paydate', $cgi->param('year') . '-' . $cgi->param('month') . '-01');
         my @list =
-          qw( payby payinfo payinfo1 payinfo2 month year payname
+          qw( payby payinfo payinfo1 payinfo2 month year paydate payname custpaybynum
               address1 address2 city county state zip country auto paytype
               paystate ss stateid stateid_state invoicing_list
             );
@@ -325,7 +326,11 @@ sub process_change_pay {
           };
         }
 
-        _process_change_info( 'change_pay', @list );
+        if (FS::SelfService->can('update_payby')) {
+          if ($cgi->param( 'custpaybynum' )) { _process_change_payby( 'change_pay', @list ); }
+          else { _process_insert_payby( 'change_pay', @list ); }
+        }
+        else { _process_change_info( 'change_pay', @list ); }
 }
 
 sub view_invoice {