summaryrefslogtreecommitdiff
path: root/httemplate/edit/cust_main
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-02-10 01:38:56 -0800
committerIvan Kohler <ivan@freeside.biz>2015-02-10 01:38:56 -0800
commita4d4d3df88b33a6db30b565921f6d62efb252351 (patch)
tree0ddfa8fe885dfe6776a0c074aed9e1e0735a7cd7 /httemplate/edit/cust_main
parent6615733676adb431ae48c78ce24758fe571614c1 (diff)
multiple payment options, RT#23741
Diffstat (limited to 'httemplate/edit/cust_main')
-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
5 files changed, 83 insertions, 671 deletions
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>
+