X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fcust_payby.html;h=1d789a47bf32eb8423257ad9bd674359648bda5e;hb=227953e3a6ee41683ea06b3f440946d4007898c3;hp=5e0f09d3fec3c12cfea89b913e404d69b32700a2;hpb=74cf17d7e822d75cbf51098c7e337ba4174b18aa;p=freeside.git
diff --git a/httemplate/elements/cust_payby.html b/httemplate/elements/cust_payby.html
index 5e0f09d3f..1d789a47b 100644
--- a/httemplate/elements/cust_payby.html
+++ b/httemplate/elements/cust_payby.html
@@ -68,7 +68,7 @@
ID = "<%$id%>_paycvv"
SIZE = 2
MAXLENGTH = 4
- VALUE = "<% scalar($cgi->param($name.'_paycvv')) %>"
+ VALUE = "<% scalar($cgi->param($name.'_paycvv')) || ('*' x length($cust_payby->paycvv)) %>"
onChange = "<% $onchange %>"
>
<% mt('CVV2') |h %> (<% mt('help') |h %>)
@@ -180,11 +180,11 @@
<& /elements/select-state.html,
'prefix' => $name. '_pay',
'empty' => emt('(choose)'),
- 'state' => $cgi->param($name.'_paystate')
- || $cust_payby->paystate,
+ 'state' => ( scalar($cgi->param($name.'_paystate'))
+ || $cust_payby->paystate ),
#was cust_main->country in 3.x, but this will do until/unlesss
# someone needs to track foreign bank states
- 'country' => scalar($conf->config('countrydefault')) || 'US',
+ 'country' => ( scalar($conf->config('countrydefault')) || 'US' ),
&>
<% mt('Bank state') |h %>
@@ -216,7 +216,7 @@
% }
-% unless ( $opt{'html_only'} ) {
+% unless ( $opt{'html_only'} || $payby_changed_init ) {
+% $payby_changed_init = 1;
% }
+<%once>
+my $payby_changed_init = 0;
+%once>
<%init>
my( %opt ) = @_;
@@ -294,8 +298,17 @@ if ( $curr_value ) {
$cust_payby = new FS::cust_payby {};
}
my $sel_payby = $cgi->param($name.'_payby') || $cust_payby->payby;
-$sel_payby = 'CARD' if $sel_payby eq 'DCRD' || $sel_payby eq '';
-$sel_payby = 'CHEK' if $sel_payby eq 'DCHK';
+# convert DCRD to CARD + no weight, and the same for DCHK/CHEK
+if ($sel_payby eq 'DCRD') {
+ $sel_payby = 'CARD';
+ $cust_payby->weight('');
+} elsif ($sel_payby eq 'DCHK') {
+ $sel_payby = 'CHEK';
+ $cust_payby->weight('');
+} elsif (!$sel_payby) {
+ # default
+ $sel_payby = 'CARD';
+}
my @payby = FS::payby->cust_payby;
my %conf_payby = map { $_=>1 } $conf->config('payby');