From a4d4d3df88b33a6db30b565921f6d62efb252351 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 10 Feb 2015 01:38:56 -0800 Subject: multiple payment options, RT#23741 --- httemplate/edit/cust_main.cgi | 28 +- httemplate/edit/cust_main/billing.html | 477 ++-------------------------- httemplate/edit/cust_main/bottomfixup.js | 45 +-- httemplate/edit/cust_main/contact.html | 171 ---------- httemplate/edit/cust_main/contacts_new.html | 5 +- httemplate/edit/cust_main/cust_payby.html | 56 ++++ httemplate/edit/elements/edit.html | 4 +- httemplate/edit/process/cust_main.cgi | 57 +--- 8 files changed, 92 insertions(+), 751 deletions(-) delete mode 100644 httemplate/edit/cust_main/contact.html create mode 100644 httemplate/edit/cust_main/cust_payby.html (limited to 'httemplate/edit') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index da87bfca7..f99cce2de 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,8 +1,4 @@ -<& /elements/header.html, - $title, - '', - ' onUnload="myclose()"' #hmm, in billing.html -&> +<& /elements/header.html, $title, &> <& /elements/error.html &> @@ -60,7 +56,7 @@ - + <% mt('Service address') |h %> @@ -105,16 +101,13 @@ function samechanged(what) {
-<& cust_main/contacts_new.html, - 'cust_main' => $cust_main, -&> +<& cust_main/contacts_new.html, 'cust_main'=>$cust_main, &> %# billing info <& cust_main/billing.html, $cust_main, 'payinfo' => $payinfo, 'invoicing_list' => \@invoicing_list, &> -
% my $ro_comments = $conf->exists('cust_main-use_comments')?'':'readonly'; % if (!$ro_comments || $cust_main->comments) { @@ -156,18 +149,6 @@ function samechanged(what) { -%# cust_main/bottomfixup.js -% foreach my $hidden ( -% 'payauto', 'billday', -% 'payinfo', 'payinfo1', 'payinfo2', 'payinfo3', 'paytype', -% 'payname', 'paystate', 'exp_month', 'exp_year', 'paycvv', -% 'paystart_month', 'paystart_year', 'payissue', -% 'payip', -% 'paid', -% ) { - -% } - <& cust_main/bottomfixup.html, 'custnum' => $custnum &>
@@ -375,9 +356,6 @@ if ( $cgi->param('error') ) { } -my %keep = map { $_=>1 } qw( error tagnum lock_agentnum lock_pkgpart ); -$cgi->delete( grep { !$keep{$_} && $_ !~ /^tax_/ } $cgi->param ); - my $title = $custnum ? 'Edit Customer' : 'Add Customer'; $title = mt($title); $title .= ": ". $cust_main->name if $custnum; diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index fcd8f017c..fa392bbb7 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -1,123 +1,7 @@ -%if ( $payby_default eq 'HIDE' ) { -% $cust_main->payby('BILL') unless $cust_main->payby; -% my $payby = $cust_main->payby; - - - - - -% foreach my $field (qw( payname paycvv paystart_month paystart_year payissue payip paytype paystate billday )) { - - - -% } - -% #false laziness w/elements/select-month_year.html & view/cust_main/billing.html -% my( $mon, $year ); -% my $date = $cust_main->paydate || '12-2037'; -% if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format -% ( $mon, $year ) = ( $2, $1 ); -% } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { -% ( $mon, $year ) = ( $1, $3 ); -% } else { -% die "unrecognized expiration date format: $date"; -% } - - - - - - - - -% } else { -% % my $r = qq!* !; -
<% mt('Billing information') |h %> - <% &ntable("#cccccc") %> - - - <%$r%><% mt('Billing type') |h %> - - <& /elements/init_overlib.html &> - -% my $payby = $cust_main->payby; -% my $paytype = $cust_main->paytype; -% my( $account, $aba ) = split('@', $payinfo); -% my $branch = ''; -% ($branch,$aba) = split('\.',$aba) -% if $conf->config('echeck-country') eq 'CA'; -% -% my $disabled = 'DISABLED style="background-color: #dddddd"'; -% my $text_disabled = 'style="color: #999999"'; -% -% if ( $payby =~ /^(CARD|DCRD)$/ && cardtype($payinfo) =~ /^(Switch|Solo)$/ ) { -% $disabled = 'style="background-color: #ffffff"'; -% $text_disabled = 'style="color: #000000";' -% } -% -% my $disable_payauto = $conf->exists('disable_payauto_default'); -% my $CARD_payauto_checked = $payby eq 'DCRD' ? '' -% : $payby eq 'CARD' ? 'CHECKED' -% : $disable_payauto ? '' : 'CHECKED'; -% my $CHEK_payauto_checked = $payby eq 'DCHK' ? '' -% : $payby eq 'CHEK' ? 'CHECKED' -% : $disable_payauto ? '' : 'CHECKED'; -% -% sub billday_options { -% my $curr_value = shift; -% my $ret = ''; -% for my $billday ( 1 .. 28 ) { -% my $sel = ''; -% $sel = "SELECTED='SELECTED'" if $curr_value == $billday; -% $ret .= ""; -% } -% $ret; -% } -% -% my $card_billday_style = $payby eq 'CARD' ? '' : 'style="color: #999999"'; -% my $chek_billday_style = $payby eq 'CHEK' ? '' : 'style="color: #999999"'; -% my $card_billday_select_disabled = $payby eq 'CARD' ? '' : 'DISABLED'; -% my $chek_billday_select_disabled = $payby eq 'CHEK' ? '' : 'DISABLED'; -% -% #false laziness w/view/cust_main/billing.html and misc/payment.cgi -% my $routing_label = $conf->config('echeck-country') eq 'US' -% ? 'ABA/Routing number' -% : 'Routing number'; -% my $routing_size = $conf->config('echeck-country') eq 'CA' ? 4 : 10; -% my $routing_maxlength = $conf->config('echeck-country') eq 'CA' ? 3 : 9; -% -% -% my %payby = ( -% -% 'CARD' => -% -% ''. -% -% qq!!. -% qq!!. -% -% qq!!. -% ''. -% -% qq!!. -% '!. -% '!. -% -% qq!!. -% qq!!. -% -% qq!'. -% -% ( $conf->exists('cust_main-select-billday') ? -% qq!! -% : '' -% ). -% -% '
${r}!.emt('Card number').qq!
${r}!.emt('Expiration').qq! '. -% -% include('/elements/select-month_year.html', -% 'prefix' => 'CARD_exp', -% 'selected_date' => -% ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ), -% ). -% -% '
!.emt('CVV2').qq! !. -% -% qq!(!.emt('help').qq!)!. -% qq!'. -% -% qq!
!.emt('Start date').qq! '. -% -% include('/elements/select-month_year.html', -% 'prefix' => 'CARD_paystart', -% 'disabled' => $disabled, -% 'empty_option' => 1, -% 'start_year' => 2000, -% 'end_year' => (localtime())[5] + 1900, -% 'selected_date' => ( -% ( $payby =~ /^(CARD|DCRD)$/ -% && cardtype($payinfo) =~ /^(Switch|Solo)$/ ) -% ? $cust_main->paystart_month. '-'. -% $cust_main->paystart_year -% : '' -% ) -% ). -% -% qq!!.emt('or Issue number').qq! !. -% '
${r}!.emt('Exact name on card').qq!
!. -% qq! !. -% emt('Charge future payments to this [_1] automatically','credit card').'
-% Charge on this day of each month   -%
', -% -% 'CHEK' => -% -% ''. -% -% qq!!. -% qq!'. -% qq!!. -% -% qq!!. -% qq!!. -% -% qq!!. -% qq!!. -% -% ( $conf->config('echeck-country') eq 'CA' ? -% qq!! : '' ). -% -% qq!!. -% qq!!. -% ( $conf->exists('show_bankstate') ? -% qq!!. -% qq!" -% : '' -% ). -% -% -% qq!'. -% -% ( $conf->exists('cust_main-select-billday') ? -% qq!! -% : '' -% ). -% -% '
${r}!.emt('Account number').qq! !.emt('Type').qq!
${r}!.emt($routing_label).qq! !. -% qq!(!.emt('help').qq!)!. -% qq!
$r !.emt('Branch number').qq! -%
${r}!.emt('Bank name').qq!
$paystate_label!. -% include('/elements/select-state.html', -% 'empty' => emt('(choose)'), -% 'state' => $cust_main->paystate, -% 'country' => $cust_main->country, -% 'prefix' => 'CHEK_pay', -% ). "
!. -% qq! !. -% emt('Charge future payments to this [_1] automatically','electronic check').'
-% Charge on this day of each month   -%
', -% -% 'LECB' => -% -% ''. -% -% qq!!. -% qq!!. -% -% qq!!. -% qq!!. -% qq!!. -% -% ''. -% ''. -% ''. -% ''. -% ''. -% ''. -% -% '
${r}!.emt('Phone number').qq!
 
 
 
 
 
 
', -% -% 'BILL' => -% -% ''. -% -% qq!!. -% qq!!. -% -% qq!!. -% qq!!. -% -% qq!!. -% qq!!. -% -% ''. -% ''. -% ''. -% ''. -% ''. -% -% '
!.emt('P.O.').qq!
!.emt('Attention').qq!
 
 
 
 
 
', -% -% 'COMP' => -% -% ''. -% -% qq!!. -% qq!!. -% -% qq!!. -% ''. -% -% ''. -% ''. -% ''. -% ''. -% ''. -% -% '
${r}!.emt('Approved by').qq!
${r}!.emt('Expiration').qq! '. -% -% include('/elements/select-month_year.html', -% 'prefix' => 'COMP_exp', -% 'selected_date' => -% ( $payby eq 'COMP' ? $cust_main->paydate : '' ), -% ). -% -% '
 
 
 
 
 
', -% -% 'CASH' => -% -% ''. -% -% qq!!. -% qq!!. -% -% ''. -% ''. -% ''. -% ''. -% ''. -% ''. -% -% '
${r}!.emt('Amount').qq!
 
 
 
 
 
 
', -% -% 'WEST' => -% -% ''. -% -% qq!!. -% qq!!. -% -% ''. -% ''. -% ''. -% ''. -% ''. -% ''. -% -% '
${r}!.emt('Amount').qq!
 
 
 
 
 
 
', -% -% 'MCRD' => -% -% ''. -% -% qq!!. -% qq!!. -% -% ''. -% ''. -% ''. -% ''. -% ''. -% ''. -% -% '
${r}!.emt('Amount').qq!
 
 
 
 
 
 
', -% -% ); -% -% #this should use FS::payby -% my @allopt = qw( CARD CHEK LECB BILL CASH WEST MCRD COMP ); -% -% my %allopt = map { $_ => FS::payby->shortname($_) } @allopt; -% -% if ( $cust_main->custnum ) { -% #don't offer CASH/WEST/MCRD initial payment types when editing customer -% delete $allopt{$_} for qw(CASH WEST MCRD); -% } -% -% my @options = grep exists( $allopt{$_} ), @payby; -% -% my %payby2option = ( -% ( map { $_ => $_ } @options ), -% 'DCRD' => 'CARD', -% 'DCHK' => 'CHEK', -% ); - - - <& /elements/selectlayers.html, - 'field' => 'payby', - 'curr_value' => $payby2option{$payby || $payby_default || $payby[0] }, - 'options' => \@options, - 'labels' => \%allopt, - 'html_between' => '', - 'layer_callback' => sub { my $layer = shift; $payby{$layer}; }, - 'onchange' => 'init_payauto_changed();', - &> +
<% mt('Billing information') |h %> <% &ntable("#cccccc") %> -   - % my $curuser = $FS::CurrentUser::CurrentUser; % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups'); % if ( $conf->exists('cust_class-tax_exempt') @@ -490,18 +63,6 @@ - - > <% mt('Fax invoices') |h %> - - - - % } @@ -543,6 +104,26 @@ % } + + <% mt('Charge card/e-check on this day of the month') |h %> + + + + + +% sub billday_options { +% my $curr_value = shift; +% my $ret = ''; +% for my $billday ( 1 .. 28 ) { +% my $sel = ''; +% $sel = "SELECTED='SELECTED'" if $curr_value == $billday; +% $ret .= ""; +% } +% $ret; +% } + <% mt('Invoice terms') |h %> @@ -673,27 +254,17 @@ function toggle(obj) { % } +
- <% $r %><% mt('required fields') |h %> -% } - - - -<%once> - -my $paystate_label = FS::Msgcat::_gettext('paystate'); -$paystate_label = 'Bank state' if $paystate_label =~/^paystate$/; + <% mt('Payment information') |h %> + <& cust_payby.html, 'cust_main'=>$cust_main, &> - <%init> my( $cust_main, %options ) = @_; my @invoicing_list = @{ $options{'invoicing_list'} }; my $payinfo = $options{'payinfo'}; my $conf = new FS::Conf; -my $payby_default = $conf->config('payby-default'); my $money_char = $conf->config('money_char') || '$'; diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index 6a9deb92a..97816aad7 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -5,7 +5,7 @@ my $conf = new FS::Conf; my $company_latitude = $conf->config('company_latitude'); my $company_longitude = $conf->config('company_longitude'); -my @fixups = ('copy_payby_fields', 'standardize_locations'); +my @fixups = ('standardize_locations'); push @fixups, 'confirm_censustract_bill', 'confirm_censustract_ship' if $conf->exists('cust_main-require_censustract'); @@ -51,55 +51,12 @@ function do_submit() { document.CustomerForm.submit(); } -function copy_payby_fields() { - var layervars = new Array( - 'payauto', 'billday', - 'payinfo', 'payinfo1', 'payinfo2', 'payinfo3', 'paytype', - 'payname', 'paystate', 'exp_month', 'exp_year', 'paycvv', - 'paystart_month', 'paystart_year', 'payissue', - 'payip', - 'paid' - ); - - var cf = document.CustomerForm; - var payby = cf.payby.options[cf.payby.selectedIndex].value; - for ( f=0; f < layervars.length; f++ ) { - var field = layervars[f]; - copyelement( cf.elements[payby + '_' + field], - cf.elements[field] - ); - } - submit_continue(); -} - <& /elements/standardize_locations.js, 'callback' => 'submit_continue();', 'billship' => 1, 'with_census' => 1, # no with_firm, apparently &> -function copyelement(from, to) { - if ( from == undefined ) { - to.value = ''; - } else if ( from.type == 'select-one' ) { - to.value = from.options[from.selectedIndex].value; - //alert(from + " (" + from.type + "): " + to.name + " => (" + from.selectedIndex + ") " + to.value); - } else if ( from.type == 'checkbox' ) { - if ( from.checked ) { - to.value = from.value; - } else { - to.value = ''; - } - } else { - if ( from.value == undefined ) { - to.value = ''; - } else { - to.value = from.value; - } - } - //alert(from + " (" + from.type + "): " + to.name + " => " + to.value); -} - % # the value in pre+'censustract' is the confirmed censustract (either from % # the previous saved record, or from address standardization (if the backend % # supports it), or from an aborted previous submit. only need to reconfirm diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html deleted file mode 100644 index c2ebb093c..000000000 --- a/httemplate/edit/cust_main/contact.html +++ /dev/null @@ -1,171 +0,0 @@ - - - - - -% if ( $conf->exists('show_ss') && !$pre ) { - - - -% } elsif ( !$pre ) { - - -% } - - -% if ( $conf->exists('cust-email-high-visibility') && !$pre ) { - - - - -% } - -% unless ( $conf->exists('cust-edit-alt-field-order') ) { #standard order - - <& company &> - <& location &> - <& phones &> - <& fax &> - -% } else { #alternate field order - - <& phones &> - <& location &> - <& fax &> - <& company &> - -% } - -% if ( $conf->exists('show_stateid') && !$pre ) { - - - - - - - -% } elsif ( !$pre ) { - - - -% } - -
<%$r%><% mt('Contact name (last, first)') |h %> - <%$style%>> , - <%$style%>> - <% mt('SS#') |h %>
- <% $conf->exists('cust_main-require_invoicing_list_email', $agentnum) - ? $r : '' %>Email address(es) - - -
<% $stateid_label %> <%$style%>><% $stateid_state_label %><& /elements/select-state.html, - 'state' => $cust_main->stateid_state, - 'country' => $cust_main->country, - 'prefix' => 'stateid_', - 'onchange' => $onchange, - 'disabled' => $disabled, - 'style' => \@style, - &> -
-<%$r%><% mt('required fields') |h %>
- -<%def company> -% my $display = ($cust_main->residential_commercial eq 'Commercial') -% ? '' : 'none'; - - <% mt('Company') |h %> - - <%$style%>> - - - - -<%def location> - <& /elements/location.html, - 'prefix' => $pre, - 'object' => $cust_main, - 'onchange' => $onchange, - 'disabled' => $disabled, - 'style' => \@style, - 'same_checked' => $opt{'same_checked'}, - 'geocode' => $opt{'geocode'}, - 'censustract' => $opt{'censustract'}, - &> - - -<%def phones> - <& /elements/tr-cust_main-phones.html, - 'prefix' => $pre, - 'cust_main' => $cust_main, - 'onchange' => $onchange, - 'disabled' => $disabled, - 'style' => $style, - &> - - -<%def fax> - - <% mt('Fax') |h %> - - <%$style%>> - - - - -<%once> - -my $r = qq!* !; - - -<%shared> - -my( %opt, $cust_main, $pre, $onchange, $disabled, @style, $style ); - - -<%init> - -%opt = @_; -$cust_main = $opt{'cust_main'}; -$pre = $opt{'pre'}; -$onchange = $opt{'onchange'}; -$disabled = $opt{'disabled'}; -@style = ( $opt{'style'} ? @{ $opt{'style'} } : () ); - -$style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : ''; - -my $conf = new FS::Conf; - -foreach (qw(ss stateid)) { - $opt{$_} = $cust_main->masked($_) unless exists $opt{$_}; -} - -#false laziness with ship state -my $countrydefault = $conf->config('countrydefault') || 'US'; -$cust_main->set($pre.'country', $countrydefault ) - unless $cust_main->get($pre.'country'); - -my $statedefault = $conf->config('statedefault') - || ($countrydefault eq 'US' ? 'CA' : ''); -$cust_main->set($pre.'state', $statedefault ) - unless $cust_main->get($pre.'state') - || $cust_main->get($pre.'country') ne $countrydefault; - -$cust_main->set('stateid_state', $cust_main->state ) - unless $pre || $cust_main->get('stateid_state'); - -$opt{geocode} ||= $cust_main->get('geocode'); - -$opt{censustract} ||= $cust_main->censustract; - -my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/ - ? 'Driver’s License' - : FS::Msgcat::_gettext('stateid') || 'Driver’s License'; -my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/ - ? 'Driver’s License State' - : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State'; - -my @invoicing_list = $cust_main->invoicing_list; - -my $agentnum = $cust_main->agentnum if $cust_main->custnum; - - diff --git a/httemplate/edit/cust_main/contacts_new.html b/httemplate/edit/cust_main/contacts_new.html index 0ab02b420..9ccb45f6a 100644 --- a/httemplate/edit/cust_main/contacts_new.html +++ b/httemplate/edit/cust_main/contacts_new.html @@ -1,10 +1,9 @@
-
Contacts <% include('/edit/elements/edit.html', 'embed' => $opt{cust_main}, 'table' => 'cust_main', - 'labels' => { 'contactnum' => 'Contact', + 'labels' => { 'contactnum' => '', #'Contact', #'locationnum' => ' ', }, 'fields' => [ @@ -14,7 +13,7 @@ 'custnum' => $opt{cust_main}->custnum, 'm2m_method' => 'cust_contact', 'm2m_dstcol' => 'contactnum', - 'm2_label' => 'Contact', + 'm2_label' => ' ', #'Contact', 'm2_error_callback' => $m2_error_callback, }, ], diff --git a/httemplate/edit/cust_main/cust_payby.html b/httemplate/edit/cust_main/cust_payby.html new file mode 100644 index 000000000..cf0ada982 --- /dev/null +++ b/httemplate/edit/cust_main/cust_payby.html @@ -0,0 +1,56 @@ +<% include('/edit/elements/edit.html', + 'embed' => $opt{cust_main}, + 'tablenum' => 1, + 'table' => 'cust_main', + 'labels' => { 'custpaybynum' => '', + #'locationnum' => ' ', + }, + 'fields' => [ + { 'field' => 'custpaybynum', + 'type' => 'cust_payby', + 'colspan' => 6, + #'custnum' => $opt{cust_main}->custnum, + 'm2m_method' => 'cust_payby', + 'm2m_dstcol' => 'custpaybynum', + 'm2_label' => ' ', + 'm2_error_callback' => $m2_error_callback, + }, + ], + 'agent_virt' => 1, + ) +%> +
+<%init> + +my %opt = @_; + +my $m2_error_callback = sub { + my($cgi, $object) = @_; + + #process_o2m fields in process/cust_main-cust_payby.html + my $fields = FS::cust_payby->cgi_cust_payby_fields; + my @gfields = ( '', map "_$_", grep $_ !~ /^(payby|paydate_)/, @$fields ); + + map { + if ( /^custpaybynum(\d+)$/ ) { + my $num = $1; + if ( grep $cgi->param("custpaybynum$num$_"), @gfields ) { + my %hash = ( + 'custpaybynum' => scalar($cgi->param("custpaybynum$num")), + map { $_ => scalar($cgi->param("custpaybynum${num}_$_")) } + @$fields, + ); + FS::cust_payby::cgi_hash_callback( \%hash ); + FS::cust_payby->new( \%hash ); + } else { + (); + } + } else { + (); + } + } + $cgi->param; +}; + + + diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 4d5beee71..5a7920b6f 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -118,6 +118,8 @@ Example: # display, no
, no hidden fields for table name or primary key, no # display of primary key, no submit button, no html_foot, no footer) 'embed' => $object, #need to pass the object + 'tablenum' => 4, #need to specify a table number when using multiple + #embedded edits on a page (and m2 stuff) #don't show the primary key label and value 'no_pkey_display' => 1, @@ -256,7 +258,7 @@ Example: % } -% my $tablenum = 0; +% my $tablenum = $opt{'tablenum'} || 0; % my $g_row = 0; diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 82ec50c36..52a2608fd 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -29,29 +29,6 @@ $cgi->param('tax','') unless defined $cgi->param('tax'); $cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] ); -my $payby = $cgi->param('payby'); - -my %noauto = ( - 'CARD' => 'DCRD', - 'CHEK' => 'DCHK', -); -$payby = $noauto{$payby} - if ! $cgi->param('payauto') && exists $noauto{$payby}; - -$cgi->param('payby', $payby); - -if ( $payby ) { - if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) { - my $payinfo = $cgi->param('payinfo1'). '@'; - $payinfo .= $cgi->param('payinfo3').'.' - if $conf->config('echeck-country') eq 'CA'; - $payinfo .= $cgi->param('payinfo2'); - $cgi->param('payinfo',$payinfo); - } - $cgi->param('paydate', - $cgi->param( 'exp_month' ). '-'. $cgi->param( 'exp_year' ) ); -} - my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') ); push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST'); push @invoicing_list, 'FAX' if $cgi->param('invoicing_list_FAX'); @@ -177,6 +154,9 @@ if ( $curuser->access_right('Edit customer tax exemptions') ) { }; } +$options{'contact_params'} = scalar($cgi->Vars); +$options{'cust_payby_params'} = scalar($cgi->Vars); + #perhaps this stuff should go to cust_main.pm if ( $new->custnum eq '' or $duplicate_of ) { @@ -304,34 +284,12 @@ if ( $new->custnum eq '' or $duplicate_of ) { my $old = qsearchs( 'cust_main', { 'custnum' => $new->custnum } ); $error ||= "Old record not found!" unless $old; - if ( length($old->paycvv) && $new->paycvv =~ /^\s*\*+\s*$/ ) { - $new->paycvv($old->paycvv); - } if ($new->ss =~ /xx/) { $new->ss($old->ss); } if ($new->stateid =~ /^xxx/) { $new->stateid($old->stateid); } - if ( $new->payby =~ /^(CARD|DCRD)$/ - && ( $new->payinfo =~ /xx/ - || $new->payinfo =~ /^\s*N\/A\s+\(tokenized\)\s*$/ - ) - ) - { - $new->payinfo($old->payinfo); - - } elsif ( $new->payby =~ /^(CHEK|DCHK)$/ && $new->payinfo =~ /xx/ ) { - #fix for #3085 "edit of customer's routing code only surprisingly causes - #nothing to happen... - # this probably won't do the right thing when we don't have the - # public key (can't actually get the real $old->payinfo) - my($new_account, $new_aba) = split('@', $new->payinfo); - my($old_account, $old_aba) = split('@', $old->payinfo); - $new_account = $old_account if $new_account =~ /xx/; - $new_aba = $old_aba if $new_aba =~ /xx/; - $new->payinfo($new_account.'@'.$new_aba); - } if ( ! $conf->exists('cust_main-edit_signupdate') or ! $new->signupdate ) { @@ -353,13 +311,4 @@ if ( $new->custnum eq '' or $duplicate_of ) { } -unless ( $error ) { #XXX i should be transactional... all in the insert - # or replace call - - $error = $new->process_o2m( 'table' => 'contact', - 'fields' => FS::contact->cgi_contact_fields, - 'params' => scalar($cgi->Vars), - ); -} - -- cgit v1.2.1