summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-02-15 23:35:12 -0800
committerIvan Kohler <ivan@freeside.biz>2015-02-15 23:35:12 -0800
commit0870a4c1fb02be43ea5524f58650d99c81477681 (patch)
tree9f8050ba4a9bcb76f5c094bf65770c004a4c32df
parent2c5aa117162ef4dfce93da42ea3391dcdece4bb9 (diff)
multiple payment options (new complimentary flag), RT#23741
-rw-r--r--FS/FS/API.pm41
-rw-r--r--FS/FS/Cron/breakage.pm2
-rw-r--r--FS/FS/Setup.pm12
-rw-r--r--FS/FS/cust_bill.pm19
-rw-r--r--FS/FS/cust_main/API.pm6
-rw-r--r--FS/FS/cust_main/Billing.pm2
-rw-r--r--FS/FS/cust_pay.pm5
-rw-r--r--FS/FS/tax_rate.pm3
-rw-r--r--httemplate/edit/cust_main/billing.html67
-rw-r--r--httemplate/search/cust_tax_exempt.cgi1
-rw-r--r--httemplate/search/cust_tax_exempt_pkg.cgi1
-rwxr-xr-xhttemplate/view/cust_bill.cgi3
-rw-r--r--httemplate/view/cust_main/billing.html13
-rwxr-xr-xhttemplate/view/cust_statement.html6
14 files changed, 80 insertions, 101 deletions
diff --git a/FS/FS/API.pm b/FS/FS/API.pm
index c49fb20..f848361 100644
--- a/FS/FS/API.pm
+++ b/FS/FS/API.pm
@@ -365,26 +365,6 @@ comma-separated list of email addresses for email invoices. The special value 'P
postal_invoicing
Set to 1 to enable postal invoicing
-=item payby
-
-CARD, DCRD, CHEK, DCHK, LECB, BILL, COMP or PREPAY
-
-=item payinfo
-
-Card number for CARD/DCRD, account_number@aba_number for CHEK/DCHK, prepaid "pin" for PREPAY, purchase order number for BILL
-
-=item paycvv
-
-Credit card CVV2 number (1.5+ or 1.4.2 with CVV schema patch)
-
-=item paydate
-
-Expiration date for CARD/DCRD
-
-=item payname
-
-Exact name on credit card for CARD/DCRD, bank name for CHEK/DCHK
-
=item referral_custnum
Referring customer number
@@ -505,27 +485,6 @@ addition to email addresses),
postal_invoicing
Set to 1 to enable postal invoicing
-=item payby
-
-CARD, DCRD, CHEK, DCHK, LECB, BILL, COMP or PREPAY
-
-=item payinfo
-
-Card number for CARD/DCRD, account_number@aba_number for CHEK/DCHK, prepaid
-"pin" for PREPAY, purchase order number for BILL
-
-=item paycvv
-
-Credit card CVV2 number (1.5+ or 1.4.2 with CVV schema patch)
-
-=item paydate
-
-Expiration date for CARD/DCRD
-
-=item payname
-
-Exact name on credit card for CARD/DCRD, bank name for CHEK/DCHK
-
=item referral_custnum
Referring customer number
diff --git a/FS/FS/Cron/breakage.pm b/FS/FS/Cron/breakage.pm
index 6dd904d..56a9df4 100644
--- a/FS/FS/Cron/breakage.pm
+++ b/FS/FS/Cron/breakage.pm
@@ -47,7 +47,7 @@ sub reconcile_breakage {
my @customers = qsearch({
'table' => 'cust_main',
'hashref' => { 'agentnum' => $agent->agentnum,
- 'payby' => { op=>'!=', value=>'COMP', },
+ 'complimentary' => { op=>'!=', value=>'Y', },
},
'extra_sql' => $extra_sql,
});
diff --git a/FS/FS/Setup.pm b/FS/FS/Setup.pm
index 5528c89..f26e50e 100644
--- a/FS/FS/Setup.pm
+++ b/FS/FS/Setup.pm
@@ -363,13 +363,11 @@ sub initial_data {
#with billing type Complimentary. Leave the First package dropdown set to
#(none).
'cust_main' => [
- { 'agentnum' => 1, #XXX
- 'refnum' => 1, #XXX
- 'first' => 'System',
- 'last' => 'Accounts',
- 'payby' => 'COMP',
- 'payinfo' => 'system', #or something
- 'paydate' => '1/2037',
+ { 'agentnum' => 1, #XXX
+ 'refnum' => 1, #XXX
+ 'first' => 'System',
+ 'last' => 'Accounts',
+ 'complimentary' => 'Y',
'bill_location' => $cust_location,
'ship_location' => $cust_location,
},
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 26f10da..8d69661 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -6,6 +6,7 @@ use base qw( FS::cust_bill::Search FS::Template_Mixin
use strict;
use vars qw( $DEBUG $me );
# but NOT $conf
+use Carp;
use Fcntl qw(:flock); #for spool_csv
use Cwd;
use List::Util qw(min max sum);
@@ -1953,24 +1954,8 @@ sub print_csv {
}
-=item comp
-
-Pays this invoice with a compliemntary payment. If there is an error,
-returns the error, otherwise returns false.
-
-=cut
-
sub comp {
- my $self = shift;
- my $cust_pay = new FS::cust_pay ( {
- 'invnum' => $self->invnum,
- 'paid' => $self->owed,
- '_date' => '',
- 'payby' => 'COMP',
- 'payinfo' => $self->cust_main->payinfo,
- 'paybatch' => '',
- } );
- $cust_pay->insert;
+ croak 'cust_bill->comp is deprecated (COMP payments are deprecated)';
}
=item realtime_card
diff --git a/FS/FS/cust_main/API.pm b/FS/FS/cust_main/API.pm
index 158b5cf..2d6da9e 100644
--- a/FS/FS/cust_main/API.pm
+++ b/FS/FS/cust_main/API.pm
@@ -21,8 +21,7 @@ use vars qw(
first last company daytime night fax mobile
);
# locale
-# payby payinfo payname paystart_month paystart_year payissue payip
-# ss paytype paystate stateid stateid_state
+# ss stateid stateid_state
@location_editable_fields = qw(
address1 address2 city county state zip country
);
@@ -106,14 +105,12 @@ sub API_insert {
#same for refnum like signup_server-default_refnum?
my $cust_main = new FS::cust_main ( { # $class->new( {
- 'payby' => 'BILL',
'tagnum' => [ FS::part_tag->default_tags ],
map { $_ => $opt{$_} } qw(
agentnum salesnum refnum agent_custid referral_custnum
last first company
daytime night fax mobile
- payby payinfo paydate paycvv payname
),
} );
@@ -176,7 +173,6 @@ sub API_update {
agentnum salesnum refnum agent_custid referral_custnum
last first company
daytime night fax mobile
- payby payinfo paydate paycvv payname
),
my @invoicing_list;
diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm
index 9e2082f..b3d4e70 100644
--- a/FS/FS/cust_main/Billing.pm
+++ b/FS/FS/cust_main/Billing.pm
@@ -390,7 +390,7 @@ terms or the default terms are used.
sub bill {
my( $self, %options ) = @_;
- return '' if $self->payby eq 'COMP';
+ return '' if $self->complimentary eq 'Y';
local($DEBUG) = $FS::cust_main::DEBUG if $FS::cust_main::DEBUG > $DEBUG;
my $log = FS::Log->new('FS::cust_main::Billing::bill');
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index 139d2ff..e8f9aee 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -978,7 +978,6 @@ sub _upgrade_data { #class method
$cust_pay->set('otaker', 'legacy');
}
- delete $FS::payby::hash{'COMP'}->{cust_pay}; #quelle kludge
my $error = $cust_pay->replace;
if ( $error ) {
@@ -987,8 +986,6 @@ sub _upgrade_data { #class method
next;
}
- $FS::payby::hash{'COMP'}->{cust_pay} = ''; #restore it
-
$count++;
if ( $DEBUG > 1 && $lastprog + 30 < time ) {
warn "$me $count/$total (".sprintf('%.2f',100*$count/$total). '%)'."\n";
@@ -1042,9 +1039,7 @@ sub _upgrade_data { #class method
# otaker->usernum upgrade
###
- delete $FS::payby::hash{'COMP'}->{cust_pay}; #quelle kludge
$class->_upgrade_otaker(%opt);
- $FS::payby::hash{'COMP'}->{cust_pay} = ''; #restore it
# if we do this anywhere else, it should become an FS::Upgrade method
my $num_to_upgrade = $class->count('paybatch is not null');
diff --git a/FS/FS/tax_rate.pm b/FS/FS/tax_rate.pm
index ec3bb12..0047f9d 100644
--- a/FS/FS/tax_rate.pm
+++ b/FS/FS/tax_rate.pm
@@ -2055,9 +2055,6 @@ sub generate_liability_report {
join(';', map { "$_=". uri_escape($t->$_) } @params);
my $itemdesc_loc =
- # " payby != 'COMP' ". # breaks the entire report under 4.x
- # # and unnecessary since COMP accounts don't
- # # get taxes calculated in the first place
" ( itemdesc = ? OR ? = '' AND itemdesc IS NULL ) ".
"AND ". FS::tax_rate_location->location_sql( map { $_ => $t->$_ }
@taxparams
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index fa392bb..d25e887 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -18,6 +18,27 @@
<% &ntable("#cccccc") %>
% my $curuser = $FS::CurrentUser::CurrentUser;
+
+% ###
+% # complimentry flag
+% ###
+
+% if ( $curuser->access_right('Complimentary customer') ) {
+
+ <TR>
+ <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="complimentary" VALUE="Y" <% $cust_main->complimentary eq "Y" ? 'CHECKED' : '' %>>Complimentary customer
+ </TR>
+
+% } else {
+
+ <INPUT TYPE="hidden" NAME="complimentary" VALUE="<% $cust_main->complimentary eq 'Y' ? 'Y' : '' %>">
+
+% }
+
+% ###
+% # tax exemptions
+% ###
+
% my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
% if ( $conf->exists('cust_class-tax_exempt')
% || $conf->exists('tax-cust_exempt-groups-require_individual_nums')
@@ -31,7 +52,7 @@
% } else {
<TR>
- <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <% $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %></TD>
+ <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <% $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %></TD>
</TR>
% }
@@ -48,10 +69,14 @@
% }
% }
+% ###
+% # postal invoices
+% ###
+
% unless ( $conf->exists('emailinvoiceonly') ) {
<TR>
- <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST" <%
+ <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST" <%
( grep { $_ eq 'POST' } @invoicing_list )
@@ -65,8 +90,12 @@
% }
+% ###
+% # email invoices
+% ###
+
<TR>
- <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoice_email" VALUE="Y" <%
+ <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoice_email" VALUE="Y" <%
( $cust_main->invoice_noemail eq 'Y' )
? ''
@@ -93,6 +122,10 @@
</TR>
% }
+% ###
+% # prorate_day
+% ###
+
% if ( $conf->exists('cust_main-select-prorate_day') ) {
<TR>
<TD ALIGN="right" WIDTH="200"><% mt('Prorate day (1-28)') |h %> </TD>
@@ -104,6 +137,10 @@
<INPUT TYPE="hidden" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>">
% }
+% ###
+% # billday
+% ###
+
<TR>
<TD ALIGN="right" WIDTH="200"><% mt('Charge card/e-check on this day of the month') |h %> </TD>
<TD>
@@ -124,6 +161,10 @@
% $ret;
% }
+% ###
+% # invoice_terms
+% ###
+
<TR>
<TD ALIGN="right" WIDTH="200"><% mt('Invoice terms') |h %> </TD>
<TD WIDTH="408">
@@ -134,6 +175,10 @@
</TD>
</TR>
+% ###
+% # credit_limit
+% ###
+
<TR>
<TD ALIGN="right" WIDTH="200"><% mt('Credit limit') |h %> </TD>
<TD WIDTH="408">
@@ -162,6 +207,10 @@ function toggle(obj) {
</TD>
</TR>
+% ###
+% # CDR flags / options
+% ###
+
% if ( $conf->exists('voip-cust_cdr_spools') ) {
<TR>
<TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="spool_cdr" VALUE="Y" <% $cust_main->spool_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Spool CDRs') |h %></TD>
@@ -213,6 +262,10 @@ function toggle(obj) {
<INPUT TYPE="hidden" NAME="cdr_termination_percentage" VALUE="<% $cust_main->cdr_termination_percentage %>">
% }
+% ###
+% # Invoicing currency
+% ###
+
%my @currencies = $conf->config('currencies');
%if ( scalar(@currencies) ) {
% unshift @currencies, ''; #default
@@ -229,6 +282,9 @@ function toggle(obj) {
&>
% }
+% ###
+% # Invoicing locale
+% ###
%my @available_locales = $conf->config('available-locales');
%if ( scalar(@available_locales) ) {
@@ -268,11 +324,6 @@ my $conf = new FS::Conf;
my $money_char = $conf->config('money_char') || '$';
-my @payby = grep /\w/, $conf->config('payby');
-#@payby = (qw( CARD DCRD CHEK DCHK BILL CASH WEST COMP ))
-@payby = (qw( CARD DCRD CHEK DCHK BILL CASH COMP ))
- unless @payby;
-
my $show_term = '';
if ( $cust_main->custnum ) {
#false laziness w/view/cust_main/billing.html
diff --git a/httemplate/search/cust_tax_exempt.cgi b/httemplate/search/cust_tax_exempt.cgi
index 005d77c..91b2001 100644
--- a/httemplate/search/cust_tax_exempt.cgi
+++ b/httemplate/search/cust_tax_exempt.cgi
@@ -61,7 +61,6 @@ my @where = ();
#if ( $beginning || $ending ) {
# push @where, "_date >= $beginning",
# "_date <= $ending";
-# #"payby != 'COMP';
#}
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
diff --git a/httemplate/search/cust_tax_exempt_pkg.cgi b/httemplate/search/cust_tax_exempt_pkg.cgi
index ba3f275..7b4a6d0 100644
--- a/httemplate/search/cust_tax_exempt_pkg.cgi
+++ b/httemplate/search/cust_tax_exempt_pkg.cgi
@@ -107,7 +107,6 @@ my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
if ( $beginning || $ending ) {
push @where, "_date >= $beginning",
"_date <= $ending";
- #"payby != 'COMP';
}
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi
index 4ee4efb..6bc499a 100755
--- a/httemplate/view/cust_bill.cgi
+++ b/httemplate/view/cust_bill.cgi
@@ -174,8 +174,7 @@ my %opt = (
$opt{'barcode_img'} = 1 if $conf->exists('invoice-barcode');
my @payby = grep /\w/, $conf->config('payby');
-#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
-@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
+@payby = (qw( CARD DCRD CHEK DCHK BILL CASH ))
unless @payby;
my %payby = map { $_=>1 } @payby;
diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html
index f1125c0..4f4b745 100644
--- a/httemplate/view/cust_main/billing.html
+++ b/httemplate/view/cust_main/billing.html
@@ -13,8 +13,18 @@
&>
% }
+% my $yes = emt('yes');
+% my $no = emt('no');
+
<TABLE CLASS="fsinnerbox">
+% if ( $cust_main->complimentary ) {
+ <TR>
+ <TD ALIGN="right"><% mt('Complimentary') |h %></TD>
+ <TD BGCOLOR="#ffffff"><% $yes %></TD>
+ </TR>
+% }
+
%( my $balance = $cust_main->balance )
% =~ s/^(\-?)(.*)$/<FONT SIZE=+1>$1<\/FONT>$money_char$2/;
@@ -53,9 +63,6 @@
</TR>
% }
-% my $yes = emt('yes');
-% my $no = emt('no');
-
% my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
% unless ( $conf->exists('cust_class-tax_exempt')
diff --git a/httemplate/view/cust_statement.html b/httemplate/view/cust_statement.html
index 5d37b31..87a185f 100755
--- a/httemplate/view/cust_statement.html
+++ b/httemplate/view/cust_statement.html
@@ -55,12 +55,6 @@ my $statementnum = $3;
my $conf = new FS::Conf;
-my @payby = grep /\w/, $conf->config('payby');
-#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
-@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
- unless @payby;
-my %payby = map { $_=>1 } @payby;
-
my $cust_statement = qsearchs({
'select' => 'cust_statement.*',
'table' => 'cust_statement',