From 0870a4c1fb02be43ea5524f58650d99c81477681 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Sun, 15 Feb 2015 23:35:12 -0800 Subject: [PATCH] multiple payment options (new complimentary flag), RT#23741 --- FS/FS/API.pm | 41 ------------------- FS/FS/Cron/breakage.pm | 2 +- FS/FS/Setup.pm | 12 +++--- FS/FS/cust_bill.pm | 19 +-------- FS/FS/cust_main/API.pm | 6 +-- FS/FS/cust_main/Billing.pm | 2 +- FS/FS/cust_pay.pm | 5 --- FS/FS/tax_rate.pm | 3 -- httemplate/edit/cust_main/billing.html | 67 +++++++++++++++++++++++++++---- httemplate/search/cust_tax_exempt.cgi | 1 - httemplate/search/cust_tax_exempt_pkg.cgi | 1 - httemplate/view/cust_bill.cgi | 3 +- httemplate/view/cust_main/billing.html | 13 ++++-- httemplate/view/cust_statement.html | 6 --- 14 files changed, 80 insertions(+), 101 deletions(-) diff --git a/FS/FS/API.pm b/FS/FS/API.pm index c49fb205a..f848361ac 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 6dd904d6a..56a9df436 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 5528c8988..f26e50ea9 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 26f10da06..8d6966161 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 158b5cf58..2d6da9ed6 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 9e2082fc3..b3d4e705f 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 139d2ffe5..e8f9aee8e 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 ec3bb12b6..0047f9d5f 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 fa392bbb7..d25e88712 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') ) { + + + complimentary eq "Y" ? 'CHECKED' : '' %>>Complimentary customer + + +% } else { + + + +% } + +% ### +% # 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 { - tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %> + tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %> % } @@ -48,10 +69,14 @@ % } % } +% ### +% # postal invoices +% ### + % unless ( $conf->exists('emailinvoiceonly') ) { - - invoice_noemail eq 'Y' ) ? '' @@ -93,6 +122,10 @@ % } +% ### +% # prorate_day +% ### + % if ( $conf->exists('cust_main-select-prorate_day') ) { <% mt('Prorate day (1-28)') |h %> @@ -104,6 +137,10 @@ % } +% ### +% # billday +% ### + <% mt('Charge card/e-check on this day of the month') |h %> @@ -124,6 +161,10 @@ % $ret; % } +% ### +% # invoice_terms +% ### + <% mt('Invoice terms') |h %> @@ -134,6 +175,10 @@ +% ### +% # credit_limit +% ### + <% mt('Credit limit') |h %> @@ -162,6 +207,10 @@ function toggle(obj) { +% ### +% # CDR flags / options +% ### + % if ( $conf->exists('voip-cust_cdr_spools') ) { spool_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Spool CDRs') |h %> @@ -213,6 +262,10 @@ function toggle(obj) { % } +% ### +% # 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 005d77c33..91b2001dc 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 ba3f2758c..7b4a6d0cd 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 4ee4efbf4..6bc499a35 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 f1125c008..4f4b74587 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'); + +% if ( $cust_main->complimentary ) { + + + + +% } + %( my $balance = $cust_main->balance ) % =~ s/^(\-?)(.*)$/$1<\/FONT>$money_char$2/; @@ -53,9 +63,6 @@ % } -% 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 5d37b3167..87a185fab 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', -- 2.11.0
<% mt('Complimentary') |h %><% $yes %>