summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-xhttemplate/edit/cust_main.cgi28
-rw-r--r--httemplate/edit/cust_main/billing.html477
-rw-r--r--httemplate/edit/cust_main/bottomfixup.js45
-rw-r--r--httemplate/edit/cust_main/contact.html171
-rw-r--r--httemplate/edit/cust_main/contacts_new.html5
-rw-r--r--httemplate/edit/cust_main/cust_payby.html56
-rw-r--r--httemplate/edit/elements/edit.html4
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi57
8 files changed, 92 insertions, 751 deletions
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 @@
</TABLE>
</TD>
</TR>
-<TR><TD STYLE="height:40px"></TD></TR>
+<TR><TD STYLE="height:14px"></TD></TR>
<TR>
<TD STYLE="width:650px">
<FONT CLASS="fsinnerbox-title"><% mt('Service address') |h %></FONT>
@@ -105,16 +101,13 @@ function samechanged(what) {
<BR>
-<& 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,
&>
-<BR>
% my $ro_comments = $conf->exists('cust_main-use_comments')?'':'readonly';
% if (!$ro_comments || $cust_main->comments) {
@@ -156,18 +149,6 @@ function samechanged(what) {
<INPUT TYPE="hidden" NAME="usernum" VALUE="<% $cust_main->usernum %>">
-%# 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',
-% ) {
- <INPUT TYPE="hidden" NAME="<% $hidden %>" VALUE="">
-% }
-
<& cust_main/bottomfixup.html, 'custnum' => $custnum &>
<BR>
@@ -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;
-
- <INPUT TYPE="hidden" NAME="payby" VALUE="<% $payby %>">
-
- <INPUT TYPE="hidden" NAME="<%$payby%>_payinfo" VALUE="<% $cust_main->paymask %>">
-
-% foreach my $field (qw( payname paycvv paystart_month paystart_year payissue payip paytype paystate billday )) {
-
- <INPUT TYPE="hidden" NAME="<% $payby.'_'.$field %>" VALUE="<% $cust_main->get($field) %>">
-
-% }
-
-% #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";
-% }
-
- <INPUT TYPE="hidden" NAME="<%$payby%>_exp_month" VALUE="<% $mon %>">
- <INPUT TYPE="hidden" NAME="<%$payby%>_exp_year" VALUE="<% $year %>">
-
- <INPUT TYPE="hidden" NAME="tax" VALUE="<% $cust_main->tax %>">
-
- <INPUT TYPE="hidden" NAME="invoicing_list" VALUE="<% join(', ', @invoicing_list) %>">
-
-% } else {
-%
% my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
- <BR><FONT CLASS="fsinnerbox-title"><% mt('Billing information') |h %></FONT>
- <% &ntable("#cccccc") %>
-
- <TR>
- <TD ALIGN="right" WIDTH="200"><%$r%><% mt('Billing type') |h %></TD>
-
<SCRIPT>
- var mywindow = -1;
- function myopen(filename,windowname,properties) {
- myclose();
- mywindow = window.open(filename,windowname,properties);
- }
- function myclose() {
- if ( mywindow != -1 )
- mywindow.close();
- mywindow = -1;
- }
-
- var achwindow = -1;
- function achopen(filename,windowname,properties) {
- achclose();
- achwindow = window.open(filename,windowname,properties);
- }
- function achclose() {
- if ( achwindow != -1 )
- achwindow.close();
- achwindow = -1;
- }
-
- function card_changed(what) {
- if (
- what.form.payinfo.value.substring(0, 4) == '4093'
- || what.form.payinfo.value.substring(0, 4) == '4911'
- || what.form.payinfo.value.substring(0, 4) == '4936'
- || what.form.payinfo.value.substring(0, 6) == '564132'
- || what.form.payinfo.value.substring(0, 2) == '63'
- || what.form.payinfo.value.substring(0, 2) == '67'
- )
- {
- what.form.paystart_month.disabled = false;
- what.form.paystart_year.disabled = false;
- what.form.payissue.disabled = false;
- what.form.paystart_month.style.backgroundColor = '#ffffff';
- what.form.paystart_year.style.backgroundColor = '#ffffff';
- what.form.payissue.style.backgroundColor = '#ffffff';
- document.getElementById('paystart_label').style.color = '#000000';
- document.getElementById('payissue_label').style.color = '#000000';
- } else {
- what.form.paystart_month.disabled = true;
- what.form.paystart_year.disabled = true;
- what.form.payissue.disabled = true;
- what.form.paystart_month.style.backgroundColor = '#dddddd';
- what.form.paystart_year.style.backgroundColor = '#dddddd';
- what.form.payissue.style.backgroundColor = '#dddddd';
- document.getElementById('paystart_label').style.color = '#999999';
- document.getElementById('payissue_label').style.color = '#999999';
- }
- return true;
- }
-
- function init_payauto_changed(){
- var f = document.getElementById('CARD_payauto');
- if(f != null) payauto_changed(f);
- f = document.getElementById('CHEK_payauto');
- if(f != null) payauto_changed(f);
- }
-
- function payauto_changed(payauto_field){
- var select = (payauto_field.name == 'CARD_payauto') ? 'CARD_billday' : 'CHEK_billday';
- var span = document.getElementById('td_'+select);
- select = document.getElementById(select);
- if (span == null || select == null) return;
- if(payauto_field.checked) {
- span.style.color = '#000000';
- select.disabled = false;
- }
- else {
- span.style.color = '#999999';
- select.disabled = true;
- //why? select.selectedIndex = 0;
- }
- }
-
function tax_changed(what) {
var num = document.getElementById(what.id + '_num');
if ( what.checked ) {
@@ -129,321 +13,10 @@
</SCRIPT>
- <& /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 .= "<OPTION VALUE='$billday' $sel>$billday</OPTION>";
-% }
-% $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' =>
-%
-% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Card number').qq! </TD>!.
-% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="CARD_payinfo" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $payinfo : '' ). qq!" MAXLENGTH=19 onChange="card_changed(this)" onKeyUp="card_changed(this)"></TD></TR>!.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Expiration').qq! </TD>!.
-% '<TD WIDTH="408">'.
-%
-% include('/elements/select-month_year.html',
-% 'prefix' => 'CARD_exp',
-% 'selected_date' =>
-% ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ),
-% ).
-%
-% '</TD></TR>'.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">!.emt('CVV2').qq!&nbsp;!.
-%
-% qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/cvv2.html', 480, 352, 'cvv2_popup' ), CAPTION, 'CVV2 Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">!.emt('help').qq!</A>)!.
-% qq!</TD>!.
-% '<TD WIDTH="408"><INPUT TYPE="text" NAME="CARD_paycvv" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ && !$cust_main->is_encrypted($cust_main->paycvv) ? $cust_main->paycvv : '' ). '" SIZE=4 MAXLENGTH=4>'.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200"><SPAN ID="paystart_label" $text_disabled>!.emt('Start date').qq! </SPAN></TD>!.
-% '<TD WIDTH="408">'.
-%
-% 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!<SPAN ID="payissue_label" $text_disabled>!.emt('or Issue number').qq! </SPAN>!.
-% '<INPUT TYPE="text" NAME="CARD_payissue" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payissue : '' ). qq!" SIZE=3 MAXLENGTH=2 $disabled></TD></TR>!.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Exact name on card').qq! </TD>!.
-% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="CARD_payname" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.
-%
-% qq!<TR><TD COLSPAN=2 WIDTH="608">!.
-% qq!<INPUT TYPE="checkbox" onchange="payauto_changed(this);" ID="CARD_payauto" NAME="CARD_payauto" $CARD_payauto_checked> !.
-% emt('Charge future payments to this [_1] automatically','credit card').'</TD></TR>'.
-%
-% ( $conf->exists('cust_main-select-billday') ?
-% qq!<TR><TD ALIGN="RIGHT" id="td_CARD_billday" $card_billday_style>
-% Charge on this day of each month</TD><TD> &nbsp;
-% <SELECT id="CARD_billday" $card_billday_select_disabled NAME="CARD_billday">!
-% . billday_options($cust_main->billday) . qq!</SELECT> </TD></TR>!
-% : ''
-% ).
-%
-% '</TABLE>',
-%
-% 'CHEK' =>
-%
-% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Account number').qq! </TD>!.
-% qq!<TD><INPUT TYPE="text" SIZE=12 NAME="CHEK_payinfo1" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $account : '' ). '"></TD>'.
-% qq!<TD ALIGN="right">!.emt('Type').qq!</TD><TD><SELECT NAME="CHEK_paytype">!.
-% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } @FS::cust_main::paytypes).
-% qq!</SELECT></TD></TR>!.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt($routing_label).qq! </TD>!.
-% qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" SIZE=$routing_size MAXLENGTH=$routing_maxlength NAME="CHEK_payinfo2" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). qq!"> !.
-% qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">!.emt('help').qq!</A>)!.
-% qq!</TD></TR>!.
-%
-% qq!<INPUT TYPE="hidden" NAME="CHEK_exp_month" VALUE="12">!.
-% qq!<INPUT TYPE="hidden" NAME="CHEK_exp_year" VALUE="2037">!.
-%
-% ( $conf->config('echeck-country') eq 'CA' ?
-% qq!<TR><TD ALIGN="right">$r !.emt('Branch number').qq!</TD><TD COLSPAN="3">
-% <INPUT TYPE="text" name="CHEK_payinfo3" VALUE="$branch" SIZE=6 MAXLENGTH=5></TD></TR>! : '' ).
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Bank name').qq! </TD>!.
-% qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" NAME="CHEK_payname" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.
-% ( $conf->exists('show_bankstate') ?
-% qq!<TR><TD ALIGN="right" WIDTH="200">$paystate_label</TD>!.
-% qq!<TD COLSPAN="3" WIDTH="408">!.
-% include('/elements/select-state.html',
-% 'empty' => emt('(choose)'),
-% 'state' => $cust_main->paystate,
-% 'country' => $cust_main->country,
-% 'prefix' => 'CHEK_pay',
-% ). "</TD></TR>"
-% : '<INPUT TYPE="hidden" NAME="CHEK_paystate" VALUE="'.
-% $cust_main->paystate. '">'
-% ).
-%
-%
-% qq!<TR><TD COLSPAN=4 WIDTH="608">!.
-% qq!<INPUT TYPE="checkbox" onchange="payauto_changed(this);" ID="CHEK_payauto" NAME="CHEK_payauto" $CHEK_payauto_checked> !.
-% emt('Charge future payments to this [_1] automatically','electronic check').'</TD></TR>'.
-%
-% ( $conf->exists('cust_main-select-billday') ?
-% qq!<TR><TD ALIGN="RIGHT" id="td_CHEK_billday" $chek_billday_style>
-% Charge on this day of each month</TD><TD> &nbsp;
-% <SELECT id="CHEK_billday" $chek_billday_select_disabled NAME="CHEK_billday">!
-% . billday_options($cust_main->billday) . qq!</SELECT> </TD></TR>!
-% : ''
-% ).
-%
-% '</TABLE>',
-%
-% 'LECB' =>
-%
-% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Phone number').qq! </TD>!.
-% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="LECB_payinfo" VALUE="!. ( $payby eq 'LECB' ? $cust_main->payinfo : '' ). qq!" MAXLENGTH=15 SIZE=16></TD></TR>!.
-%
-% qq!<INPUT TYPE="hidden" NAME="LECB_exp_month" VALUE="12">!.
-% qq!<INPUT TYPE="hidden" NAME="LECB_exp_year" VALUE="2037">!.
-% qq!<INPUT TYPE="hidden" NAME="LECB_payname" VALUE="">!.
-%
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-%
-% '</TABLE>',
-%
-% 'BILL' =>
-%
-% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">!.emt('P.O.').qq! </TD>!.
-% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="BILL_payinfo" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payinfo : '' ). qq!"></TD></TR>!.
-%
-% qq!<INPUT TYPE="hidden" NAME="BILL_exp_month" VALUE="12">!.
-% qq!<INPUT TYPE="hidden" NAME="BILL_exp_year" VALUE="2037">!.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">!.emt('Attention').qq! </TD>!.
-% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="BILL_payname" VALUE="!. encode_entities( $payby eq 'BILL' ? $cust_main->payname : '' ). qq!"></TD></TR>!.
-%
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-%
-% '</TABLE>',
-%
-% 'COMP' =>
-%
-% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Approved by').qq! </TD>!.
-% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="COMP_payinfo" VALUE=""></TD></TR>!.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Expiration').qq! </TD>!.
-% '<TD WIDTH="408">'.
-%
-% include('/elements/select-month_year.html',
-% 'prefix' => 'COMP_exp',
-% 'selected_date' =>
-% ( $payby eq 'COMP' ? $cust_main->paydate : '' ),
-% ).
-%
-% '</TD></TR>'.
-%
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-%
-% '</TABLE>',
-%
-% 'CASH' =>
-%
-% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Amount').qq! </TD>!.
-% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="CASH_paid" VALUE="!. ( $payby eq 'CASH' ? $cust_main->paid : '' ). qq!"></TD></TR>!.
-%
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-%
-% '</TABLE>',
-%
-% 'WEST' =>
-%
-% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Amount').qq! </TD>!.
-% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="WEST_paid" VALUE="!. ( $payby eq 'WEST' ? $cust_main->paid : '' ). qq!"></TD></TR>!.
-%
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-%
-% '</TABLE>',
-%
-% 'MCRD' =>
-%
-% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
-%
-% qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Amount').qq! </TD>!.
-% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="MCRD_paid" VALUE="!. ( $payby eq 'MCRD' ? $cust_main->paid : '' ). qq!"></TD></TR>!.
-%
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-% '<TR><TD>&nbsp;</TD></TR>'.
-%
-% '</TABLE>',
-%
-% );
-%
-% #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',
-% );
-
- <TD WIDTH="408">
- <& /elements/selectlayers.html,
- 'field' => 'payby',
- 'curr_value' => $payby2option{$payby || $payby_default || $payby[0] },
- 'options' => \@options,
- 'labels' => \%allopt,
- 'html_between' => '</TD></TR></TABLE>',
- 'layer_callback' => sub { my $layer = shift; $payby{$layer}; },
- 'onchange' => 'init_payauto_changed();',
- &>
+ <BR><FONT CLASS="fsinnerbox-title"><% mt('Billing information') |h %></FONT>
<% &ntable("#cccccc") %>
- <TR><TD>&nbsp;</TD></TR>
-
% 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 @@
</TD>
</TR>
- <TR>
- <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_FAX" VALUE="FAX" <%
-
- ( grep { $_ eq 'FAX' } @invoicing_list )
- ? 'CHECKED'
- : ''
-
- %>> <% mt('Fax invoices') |h %>
-
- </TD>
- </TR>
-
% }
<TR>
@@ -544,6 +105,26 @@
% }
<TR>
+ <TD ALIGN="right" WIDTH="200"><% mt('Charge card/e-check on this day of the month') |h %> </TD>
+ <TD>
+ <SELECT NAME="billday">
+ <% billday_options($cust_main->billday) %>
+ </SELECT>
+ </TD>
+ </TR>
+
+% sub billday_options {
+% my $curr_value = shift;
+% my $ret = '';
+% for my $billday ( 1 .. 28 ) {
+% my $sel = '';
+% $sel = "SELECTED='SELECTED'" if $curr_value == $billday;
+% $ret .= "<OPTION VALUE='$billday' $sel>$billday</OPTION>";
+% }
+% $ret;
+% }
+
+ <TR>
<TD ALIGN="right" WIDTH="200"><% mt('Invoice terms') |h %> </TD>
<TD WIDTH="408">
<& /elements/select-terms.html,
@@ -673,27 +254,17 @@ function toggle(obj) {
% }
</TABLE>
+ <BR>
- <% $r %><% mt('required fields') |h %>
-% }
-
-<script type="text/javascript">
- init_payauto_changed();
-</script>
-
-<%once>
-
-my $paystate_label = FS::Msgcat::_gettext('paystate');
-$paystate_label = 'Bank state' if $paystate_label =~/^paystate$/;
+ <FONT CLASS="fsinnerbox-title"><% mt('Payment information') |h %></FONT>
+ <& cust_payby.html, 'cust_main'=>$cust_main, &>
-</%once>
<%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 @@
-<TABLE CLASS="fsinnerbox">
-
-<TR>
- <TH ALIGN="right"><%$r%><% mt('Contact name (last, first)') |h %></TH>
- <TD COLSPAN=7>
- <INPUT TYPE="text" NAME="<%$pre%>last" VALUE="<% $cust_main->get($pre.'last') |h %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>> ,
- <INPUT TYPE="text" NAME="<%$pre%>first" VALUE="<% $cust_main->get($pre.'first') |h %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
-% if ( $conf->exists('show_ss') && !$pre ) {
-
- <TD ALIGN="right"><% mt('SS#') |h %></TD>
- <TD><INPUT TYPE="text" NAME="ss" VALUE="<% $opt{ss} %>" SIZE=11></TD>
-% } elsif ( !$pre ) {
-
- <TD><INPUT TYPE="hidden" NAME="ss" VALUE="<% $opt{ss} %>"></TD>
-% }
-</TR>
-
-% if ( $conf->exists('cust-email-high-visibility') && !$pre ) {
- <TR>
- <TD ALIGN="right" WIDTH="200">
- <% $conf->exists('cust_main-require_invoicing_list_email', $agentnum)
- ? $r : '' %>Email address(es)
- </TD>
- <TD bgcolor="#FFFF00">
- <INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>">
- </TD>
- </TR>
-% }
-
-% 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 ) {
-
-<TR>
- <TD ALIGN="right"><% $stateid_label %></TD>
- <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>></TD>
- <TD ALIGN="right"><% $stateid_state_label %></TD>
- <TD><& /elements/select-state.html,
- 'state' => $cust_main->stateid_state,
- 'country' => $cust_main->country,
- 'prefix' => 'stateid_',
- 'onchange' => $onchange,
- 'disabled' => $disabled,
- 'style' => \@style,
- &>
- </TD>
-</TR>
-% } elsif ( !$pre ) {
-
- <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
- <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
-% }
-
-</TABLE>
-<%$r%><% mt('required fields') |h %><BR>
-
-<%def company>
-% my $display = ($cust_main->residential_commercial eq 'Commercial')
-% ? '' : 'none';
- <TR ID="<%$pre%>company_row" STYLE="display:<%$display%>">
- <TD ALIGN="right"><% mt('Company') |h %></TD>
- <TD COLSPAN=7>
- <INPUT TYPE="text" NAME="<%$pre%>company" ID="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=60 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
- </TR>
-</%def>
-
-<%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>
-
-<%def phones>
- <& /elements/tr-cust_main-phones.html,
- 'prefix' => $pre,
- 'cust_main' => $cust_main,
- 'onchange' => $onchange,
- 'disabled' => $disabled,
- 'style' => $style,
- &>
-</%def>
-
-<%def fax>
- <TR>
- <TD ALIGN="right"><% mt('Fax') |h %></TD>
- <TD COLSPAN=5>
- <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
- </TD>
- </TR>
-</%def>
-
-<%once>
-
-my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
-
-</%once>
-<%shared>
-
-my( %opt, $cust_main, $pre, $onchange, $disabled, @style, $style );
-
-</%shared>
-<%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&rsquo;s License'
- : FS::Msgcat::_gettext('stateid') || 'Driver&rsquo;s License';
-my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
- ? 'Driver&rsquo;s License State'
- : FS::Msgcat::_gettext('stateid_state') || 'Driver&rsquo;s License State';
-
-my @invoicing_list = $cust_main->invoicing_list;
-
-my $agentnum = $cust_main->agentnum if $cust_main->custnum;
-
-</%init>
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 @@
<DIV ID="contacts_div" STYLE="display:<% $display %>">
-<BR>
<FONT CLASS="fsinnerbox-title">Contacts</FONT>
<% include('/edit/elements/edit.html',
'embed' => $opt{cust_main},
'table' => 'cust_main',
- 'labels' => { 'contactnum' => 'Contact',
+ 'labels' => { 'contactnum' => '', #'Contact',
#'locationnum' => '&nbsp;',
},
'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' => '&nbsp;',
+ },
+ '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,
+ )
+%>
+</DIV>
+<%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;
+};
+
+</%init>
+
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 <FORM>, 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;
<TABLE ID="TableNumber<% $tablenum++ %>" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=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),
- );
-}
-
</%init>