summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-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
-rw-r--r--httemplate/elements/menu.html1
-rw-r--r--httemplate/elements/tr-coords.html2
-rwxr-xr-xhttemplate/search/cust_main.html4
-rw-r--r--httemplate/search/cust_payby.html94
-rwxr-xr-xhttemplate/search/report_cust_main.html37
-rw-r--r--httemplate/search/report_cust_payby.html57
-rwxr-xr-xhttemplate/view/cust_main.cgi17
-rw-r--r--httemplate/view/cust_main/billing.html194
-rw-r--r--httemplate/view/cust_main/cust_payby.html133
-rwxr-xr-xhttemplate/view/cust_main/packages.html4
18 files changed, 411 insertions, 975 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>
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index 5f6921c36..7d5d4f398 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -127,6 +127,7 @@ $report_customers{'Advanced customer reports'} = [ $fsurl. 'search/report_cust_m
if ( $curuser->access_right('List contacts') ) {
$report_customers{'separator'} = '';
$report_customers{'Customer contacts'} = [ $fsurl. 'search/report_contact.html?link=cust_main' ];
+ $report_customers{'Customer stored payment information'} = [ $fsurl. 'search/report_cust_payby.html' ];
}
tie my %report_invoices_open, 'Tie::IxHash',
diff --git a/httemplate/elements/tr-coords.html b/httemplate/elements/tr-coords.html
index 3248dc2de..5ac5ed4e4 100644
--- a/httemplate/elements/tr-coords.html
+++ b/httemplate/elements/tr-coords.html
@@ -1,6 +1,6 @@
<TR>
<TD ALIGN="right"><% mt('Latitude') |h %></TD>
- <TD COLSPAN=5>
+ <TD COLSPAN=7>
<FONT STYLE="background-color: #ffffff; border: 1px solid #ffffff"><% $latitude %></FONT>
&nbsp;<% mt('Longitude') |h %>
<FONT STYLE="background-color: #ffffff; border: 1px solid #ffffff"><% $longitude %></FONT>
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index 503e78274..672c20174 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -42,7 +42,7 @@ my %search_hash = ();
#scalars
my @scalars = qw (
agentnum salesnum status address city county state zip country
- paydate_year paydate_month invoice_terms
+ invoice_terms
no_censustract with_geocode with_email tax no_tax POST no_POST
custbatch usernum
cancelled_pkgs
@@ -58,7 +58,7 @@ for my $param ( @scalars ) {
}
#lists
-for my $param (qw( classnum refnum payby tagnum pkg_classnum )) {
+for my $param (qw( classnum refnum tagnum pkg_classnum )) {
$search_hash{$param} = [ $cgi->param($param) ];
}
diff --git a/httemplate/search/cust_payby.html b/httemplate/search/cust_payby.html
new file mode 100644
index 000000000..140391b15
--- /dev/null
+++ b/httemplate/search/cust_payby.html
@@ -0,0 +1,94 @@
+<& elements/search.html,
+ 'title' => emt('Customer stored payment information results'),
+ 'menubar' => $menubar,
+ 'name' => emt('cards or bank accounts'), #??
+ 'query' => $sql_query,
+ 'count_query' => $count_query,
+ 'header' => [ @headers,
+ FS::UI::Web::cust_header(
+ $cgi->param('cust_fields')
+ ),
+ ],
+ 'fields' => [
+ @fields,
+ \&FS::UI::Web::cust_fields,
+ ],
+ 'color' => [
+ ( map '', @fields ),
+ FS::UI::Web::cust_colors(),
+ ],
+ 'style' => [
+ ( map '', @fields ),
+ FS::UI::Web::cust_styles(),
+ ],
+ 'align' => [
+ ( map '', @fields ),
+ FS::UI::Web::cust_aligns(),
+ ],
+ 'links' => [
+ ( map '', @fields ),
+ ( map { $_ ne 'Cust. Status' ? $link : '' }
+ FS::UI::Web::cust_header(
+ $cgi->param('cust_fields')
+ )
+ ),
+ ],
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Advanced customer search');
+
+my %search_hash = ();
+
+my @scalars = qw (
+ paydate_year paydate_month
+);
+
+for my $param ( @scalars ) {
+ $search_hash{$param} = scalar( $cgi->param($param) )
+ if length($cgi->param($param));
+}
+
+#lists
+for my $param (qw( payby )) {
+ $search_hash{$param} = [ $cgi->param($param) ];
+}
+
+###
+# etc
+###
+
+my $sql_query = FS::cust_payby->search_sql(\%search_hash);
+my $count_query = delete($sql_query->{'count_query'});
+
+my @headers = ( 'Payment information',
+ );
+
+my @fields = ( sub { my $cust_payby = shift;
+ FS::payby->shortname( $cust_payby->payby ). ' '.
+ $cust_payby->paymask;
+ }
+ );
+
+my $link = [ "${p}view/cust_main.cgi?", 'custnum' ];
+
+###
+# email links
+###
+
+my $menubar = [];
+
+#XXX TODO
+#if ( $FS::CurrentUser::CurrentUser->access_right('Bulk send customer notices') ) {
+#
+# my $uri = new URI;
+# $uri->query_form( \%search_hash );
+# my $query = $uri->query;
+#
+# push @$menubar, emt('Email a notice to these customers') =>
+# "${p}misc/email-customers.html?table=cust_main&$query",
+#
+#}
+
+</%init>
diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html
index cacb7de6e..ba7c99a45 100755
--- a/httemplate/search/report_cust_main.html
+++ b/httemplate/search/report_cust_main.html
@@ -194,43 +194,6 @@
<TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Billing search options') |h %></FONT></TH>
</TR>
- <& /elements/tr-select-payby.html,
- 'payby_type' => 'cust',
- 'multiple' => 1,
- 'all_selected' => 1,
- &>
-
- <TR>
- <TD ALIGN="right"><% mt('Payment expiration before') |h %></TD>
- <TD>
- <SELECT NAME="paydate_month" DISABLED>
-% foreach my $month ( 1 .. 12 ) {
- <OPTION VALUE="<% $month %>"><% $month %></OPTION>
-% }
- </SELECT>
- /
- <SELECT NAME="paydate_year" onChange="paydate_year_changed(this);">
- <OPTION VALUE=""></OPTION>
-% my $lastyear = (localtime(time))[5] + 1899;
-% foreach my $year ( $lastyear .. $lastyear+12 ) {
- <OPTION VALUE="<% $year %>"><% $year %></OPTION>
-% }
- </SELECT>
- </TD>
- </TR>
-
- <SCRIPT TYPE="text/javascript">
- function paydate_year_changed(what) {
- var value = what.options[what.selectedIndex].value;
- var month_select = what.form.paydate_month;
- if ( value == '' ) {
- month_select.disabled = true;
- } else {
- month_select.disabled = false;
- }
- }
- </SCRIPT>
-
% my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
% unless ( @exempt_groups ) {
diff --git a/httemplate/search/report_cust_payby.html b/httemplate/search/report_cust_payby.html
new file mode 100644
index 000000000..81a827051
--- /dev/null
+++ b/httemplate/search/report_cust_payby.html
@@ -0,0 +1,57 @@
+<& /elements/header.html, mt('Customer stored payment infomation report') &>
+
+<FORM ACTION="cust_payby.html" METHOD="GET">
+
+ <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+ <& /elements/tr-select-payby.html,
+ 'payby_type' => 'cust',
+ 'multiple' => 1,
+ 'all_selected' => 1,
+ &>
+
+ <TR>
+ <TD ALIGN="right"><% mt('Payment expiration before') |h %></TD>
+ <TD>
+ <SELECT NAME="paydate_month" DISABLED>
+% foreach my $month ( 1 .. 12 ) {
+ <OPTION VALUE="<% $month %>"><% $month %></OPTION>
+% }
+ </SELECT>
+ /
+ <SELECT NAME="paydate_year" onChange="paydate_year_changed(this);">
+ <OPTION VALUE=""></OPTION>
+% my $lastyear = (localtime(time))[5] + 1899;
+% foreach my $year ( $lastyear .. $lastyear+12 ) {
+ <OPTION VALUE="<% $year %>"><% $year %></OPTION>
+% }
+ </SELECT>
+ </TD>
+ </TR>
+
+ <SCRIPT TYPE="text/javascript">
+ function paydate_year_changed(what) {
+ var value = what.options[what.selectedIndex].value;
+ var month_select = what.form.paydate_month;
+ if ( value == '' ) {
+ month_select.disabled = true;
+ } else {
+ month_select.disabled = false;
+ }
+ }
+ </SCRIPT>
+
+ </TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
+
+</FORM>
+
+<& /elements/footer.html &>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Advanced customer search');
+
+</%init>
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index d18c7f70f..081b96bed 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -169,14 +169,12 @@ function areyousure(href, message) {
<TABLE BORDER=0>
<TR>
<TD VALIGN="top">
- <& cust_main/contacts.html, $cust_main &>
+ <& cust_main/misc.html, $cust_main &>
+ <BR><& cust_main/contacts.html, $cust_main &>
</TD>
<TD VALIGN="top" STYLE="padding-left: 54px">
- <& cust_main/misc.html, $cust_main &>
-% if ( $conf->config('payby-default') ne 'HIDE' ) {
- <BR><& cust_main/billing.html, $cust_main &>
-% }
-
+ <& cust_main/billing.html, $cust_main &>
+ <BR><& cust_main/cust_payby.html, $cust_main &>
</TD>
</TR>
<TR>
@@ -281,9 +279,7 @@ function areyousure(href, message) {
% if ( $view eq 'payment_history' || $view eq 'jumbo' ) {
-% if ( $conf->config('payby-default') ne 'HIDE' ) {
- <& cust_main/payment_history.html, $cust_main &>
-% }
+<& cust_main/payment_history.html, $cust_main &>
% }
@@ -352,8 +348,7 @@ if ( $conf->config('ticket_system') ) {
}
$views{emt('Quotations')} = 'quotations';
$views{emt('Packages')} = 'packages';
-$views{emt('Payment History')} = 'payment_history'
- unless $conf->config('payby-default' eq 'HIDE');
+$views{emt('Payment History')} = 'payment_history';
$views{emt('Change History')} = 'change_history'
if $curuser->access_right('View customer history');
$views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html
index 64ec591a2..f1125c008 100644
--- a/httemplate/view/cust_main/billing.html
+++ b/httemplate/view/cust_main/billing.html
@@ -32,165 +32,25 @@
% }
% if ( $conf->exists('cust_main-select-billday')
-% && ($cust_main->payby eq 'CARD' || $cust_main->payby eq 'CHEK') ) {
-<TR>
- <TD ALIGN="right"><% mt('Billing day of month') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $cust_main->billday %>
- </TD>
-</TR>
-% }
-
-<TR>
- <TD ALIGN="right"><% mt('Billing type') |h %></TD>
- <TD BGCOLOR="#ffffff">
-% if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) {
-
-% my $autodemand = $cust_main->payby eq 'CARD' ? 'automatic' : 'on-demand';
- <% mt("Credit card ([_1])",$autodemand) |h %>
- </TD>
-</TR>
-<TR>
- <TD ALIGN="right"><% mt('Card number') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $cust_main->paymask %></TD>
-</TR>
-%
-%#false laziness w/elements/select-month_year.html & edit/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 {
-% warn "unrecognized expiration date format: $date";
-% ( $mon, $year ) = ( '', '' );
-%}
-%
-
-<TR>
- <TD ALIGN="right"><% mt('Expiration') |h %></TD>
- <TD BGCOLOR="#ffffff"><% "$mon/$year" %></TD>
-</TR>
-% if ( $cust_main->paystart_month ) {
-
- <TR>
- <TD ALIGN="right"><% mt('Start date') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $cust_main->paystart_month. '/'. $cust_main->paystart_year %>
- </TR>
-% } elsif ( $cust_main->payissue ) {
-
- <TR>
- <TD ALIGN="right"><% mt('Issue #') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $cust_main->payissue %>
- </TR>
-% }
-
-
-<TR>
- <TD ALIGN="right"><% mt('Name on card') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $cust_main->payname %></TD>
-</TR>
-% } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') {
-% my( $account, $aba ) = split('@', $cust_main->paymask );
-% my $branch = '';
-% ($branch,$aba) = split('\.',$aba) if $conf->config('echeck-country') eq 'CA';
-
-
-% my $autodemand = $cust_main->payby eq 'CHEK' ? 'automatic' : 'on-demand';
- <% mt("Electronic check ([_1])",$autodemand) |h %>
- </TD>
-</TR>
-
-% #false laziness w/edit/cust_main/billing.html and misc/payment.cgi
-% my $routing_label = $conf->config('echeck-country') eq 'US'
-% ? 'ABA/Routing number'
-% : 'Routing number';
-
-<TR>
- <TD ALIGN="right"><% mt($routing_label) |h %></TD>
- <TD BGCOLOR="#ffffff"><% $aba %></TD>
-</TR>
-
-% if ( $conf->config('echeck-country') eq 'CA' ) {
-<TR>
- <TD ALIGN="right"><% mt('Branch number') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $branch %></TD>
-<TR>
-% }
-
- <TD ALIGN="right"><% mt('Account number') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $account %></TD>
-</TR>
-<TR>
- <TD ALIGN="right"><% mt('Account type') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $cust_main->paytype %></TD>
-</TR>
-<TR>
- <TD ALIGN="right"><% mt('Bank name') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $cust_main->payname %></TD>
-</TR>
-% if ( $conf->exists('show_bankstate') ) {
-<TR>
- <TD ALIGN="right"><% $paystate_label %></TD>
- <TD BGCOLOR="#ffffff"><% $cust_main->paystate || '&nbsp;&nbsp;&nbsp;' %></TD>
-</TR>
+% && qsearch({ 'table' => 'cust_payby',
+% 'hashref' => { 'custnum' => $cust_main->custnum, },
+% 'extra_sql' => "AND payby IN ( 'CARD', 'CHEK' )",
+% 'order_by' => 'LIMIT 1',
+% })
+% )
+% {
+ <TR>
+ <TD ALIGN="right"><% mt('Payment day of month') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $cust_main->billday %>
+ </TD>
+ </TR>
% }
-% } elsif ( $cust_main->payby eq 'LECB' ) {
-% $cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/;
-% my $payinfo = "$1-$2-$3";
-
- <% mt('Phone bill billing') |h %>
- </TD>
-</TR>
-<TR>
- <TD ALIGN="right"><% mt('Phone number') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $payinfo %></TD>
-</TR>
-% } elsif ( $cust_main->payby eq 'BILL' ) {
-
- <% mt('Billing') |h %>
- </TD>
-</TR>
-% if ( $cust_main->payinfo ) {
-
-<TR>
- <TD ALIGN="right"><% mt('P.O.') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $cust_main->payinfo %></TD>
-</TR>
-% }
-
-<TR>
- <TD ALIGN="right"><% mt('Attention') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $cust_main->payname |h %></TD>
-</TR>
-% } elsif ( $cust_main->payby eq 'COMP' ) {
-
- <% mt('Complimentary') |h %>
- </TD>
-</TR>
-<TR>
- <TD ALIGN="right"><% mt('Authorized by') |h %></TD>
- <TD BGCOLOR="#ffffff"><% $cust_main->payinfo %></TD>
-</TR>
-%
-%#false laziness w/above etc.
-%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 {
-% warn "unrecognized expiration date format: $date";
-% ( $mon, $year ) = ( '', '' );
-%}
-%
-
-<TR>
- <TD ALIGN="right"><% mt('Expiration') |h %></TD>
- <TD BGCOLOR="#ffffff"><% "$mon/$year" %></TD>
-</TR>
+% if ( $cust_main->po_number ) {
+ <TR>
+ <TD ALIGN="right"><% mt('Purchase Order #') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $cust_main->po_number %></TD>
+ </TR>
% }
% my $yes = emt('yes');
@@ -230,13 +90,13 @@
<TR>
<TD ALIGN="right"><% mt('Postal mail invoices') |h %></TD>
<TD BGCOLOR="#ffffff">
- <% ( grep { $_ eq 'POST' } @invoicing_list ) ? $yes : $no %>
- </TD>
-</TR>
-<TR>
- <TD ALIGN="right"><% mt('Fax invoices') |h %></TD>
- <TD BGCOLOR="#ffffff">
- <% ( grep { $_ eq 'FAX' } @invoicing_list ) ? $yes : $no %>
+ <% ( grep { $_ eq 'POST' } @invoicing_list )
+ ? $yes. ( $cust_main->invoice_attn
+ ? ', attn: '. $cust_main->invoice_attn
+ : ''
+ )
+ : $no
+ %>
</TD>
</TR>
<TR>
@@ -336,12 +196,6 @@
</TABLE>
-<%once>
-
-my $paystate_label = FS::Msgcat::_gettext('paystate');
-$paystate_label = 'Bank state' if $paystate_label =~/^paystate$/;
-
-</%once>
<%init>
my( $cust_main ) = @_;
diff --git a/httemplate/view/cust_main/cust_payby.html b/httemplate/view/cust_main/cust_payby.html
new file mode 100644
index 000000000..3ebb0551d
--- /dev/null
+++ b/httemplate/view/cust_main/cust_payby.html
@@ -0,0 +1,133 @@
+% if ( @cust_payby ) {
+
+ <FONT CLASS="fsinnerbox-title"><% mt('Payment information') |h %></FONT>
+ <TABLE CLASS="fsinnerbox">
+
+% my $num = 0;
+% foreach my $cust_payby ( @cust_payby ) {
+
+% #one line per piece of info? maybe, but just getting something working
+% # for now
+
+% if ( $cust_payby->payby eq 'CARD' || $cust_payby->payby eq 'DCRD' ) {
+
+% my $auto = $cust_payby->payby eq 'CARD' ? 'automatic' : 'on-demand';
+ <TR>
+ <TD COLSPAN=2 ALIGN="center" BGCOLOR="#ffffff">
+ <% mt("Credit card ([_1])",$auto) |h %>
+ </TD>
+ </TR>
+ <TR>
+ <TD ALIGN="right"><% mt('Card number') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $cust_payby->paymask %></TD>
+ </TR>
+
+% my( $mon, $year ) = $cust_payby->paydate_mon_year;
+ <TR>
+ <TD ALIGN="right"><% mt('Expiration') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% "$mon/$year" %></TD>
+ </TR>
+
+% if ( $cust_payby->paystart_month ) {
+ <TR>
+ <TD ALIGN="right"><% mt('Start date') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $cust_payby->paystart_month. '/'. $cust_payby->paystart_year %>
+ </TR>
+% } elsif ( $cust_payby->payissue ) {
+ <TR>
+ <TD ALIGN="right"><% mt('Issue #') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $cust_payby->payissue %>
+ </TR>
+% }
+
+ <TR>
+ <TD ALIGN="right"><% mt('Name on card') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $cust_payby->payname %></TD>
+ </TR>
+
+% } elsif ( $cust_payby->payby eq 'CHEK' || $cust_payby->payby eq 'DCHK') {
+
+% my $auto = $cust_payby->payby eq 'CHEK' ? 'automatic' : 'on-demand';
+%
+% my( $account, $aba ) = split('@', $cust_payby->paymask );
+% my $branch = '';
+% ($branch,$aba) = split('\.',$aba)
+% if $conf->config('echeck-country') eq 'CA';
+
+ <TR>
+ <TD COLSPAN=2 ALIGN="center" BGCOLOR="#ffffff">
+ <% mt("Electronic check ([_1])",$auto) |h %>
+ </TD>
+ </TR>
+
+% #false laziness w/edit/cust_main/billing.html and misc/payment.cgi
+% my $routing_label = $conf->config('echeck-country') eq 'US'
+% ? 'ABA/Routing number'
+% : 'Routing number';
+ <TR>
+ <TD ALIGN="right"><% mt($routing_label) |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $aba %></TD>
+ </TR>
+
+% if ( $conf->config('echeck-country') eq 'CA' ) {
+ <TR>
+ <TD ALIGN="right"><% mt('Branch number') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $branch %></TD>
+ </TR>
+% }
+
+ <TR>
+ <TD ALIGN="right"><% mt('Account number') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $account %></TD>
+ </TR>
+ <TR>
+ <TD ALIGN="right"><% mt('Account type') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $cust_payby->paytype %></TD>
+ </TR>
+ <TR>
+ <TD ALIGN="right"><% mt('Bank name') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $cust_payby->payname %></TD>
+ </TR>
+
+% if ( $conf->exists('show_bankstate') ) {
+ <TR>
+ <TD ALIGN="right"><% $paystate_label %></TD>
+ <TD BGCOLOR="#ffffff"><% $cust_payby->paystate || '&nbsp;&nbsp;&nbsp;' %></TD>
+ </TR>
+% }
+
+% } else {
+ <TR>
+ <TD COLSPAN="2"><FONT COLOR="#FF0000">
+ Unknown cust_pay.payby <% $cust_payby->payby %>
+ </FONT></TD>
+ </TR>
+% }
+
+% unless ( $num++ == $#cust_payby ) {
+ <TR>
+ <TD COLSPAN="2"></TD>
+ </TR>
+ <TR>
+ <TD COLSPAN="2" STYLE="border-top: 1px solid black; padding:2px"></TD>
+ </TR>
+% }
+
+% }
+
+ </TABLE>
+
+% }
+<%once>
+
+my $paystate_label = FS::Msgcat::_gettext('paystate');
+$paystate_label = 'Bank state' if $paystate_label =~/^paystate$/;
+
+</%once>
+<%init>
+
+my( $cust_main ) = @_;
+my $conf = new FS::Conf;
+my @cust_payby = $cust_main->cust_payby;
+
+</%init>
diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html
index 9a2332ba8..90985110c 100755
--- a/httemplate/view/cust_main/packages.html
+++ b/httemplate/view/cust_main/packages.html
@@ -92,9 +92,7 @@ if ( el ) el.scrollIntoView(true);
<& /elements/order_pkg_link.html, 'cust_main'=>$cust_main &>
% }
-% if ( $curuser->access_right('One-time charge')
-% && $conf->config('payby-default') ne 'HIDE'
-% ) {
+% if ( $curuser->access_right('One-time charge') ) {
<% $s++ ? ' | ' : '' %>
<& /elements/one_time_charge_link.html, 'custnum'=>$cust_main->custnum &>
% }