From e4c72328fb4c89eca20c4fe7645252ecb287ba89 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 24 Sep 2010 22:08:05 +0000 Subject: [PATCH] import tax exempt and force postal invoice optiosn --- FS/FS/cust_main/Import.pm | 43 ++++++++++++++++++++++++++++++++---- httemplate/misc/cust_main-import.cgi | 15 ++++++++++++- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/FS/FS/cust_main/Import.pm b/FS/FS/cust_main/Import.pm index e58a0447b..7f5a3f009 100644 --- a/FS/FS/cust_main/Import.pm +++ b/FS/FS/cust_main/Import.pm @@ -34,7 +34,8 @@ FS::cust_main::Import - Batch customer importing file => $file, #filename type => $type, #csv or xls format => $format, #extended, extended-plus_company, svc_external, - # or svc_external_svc_phone + #extended-plus_company_and_options + #extended-plus_options, or svc_external_svc_phone agentnum => $agentnum, refnum => $refnum, pkgpart => $pkgpart, @@ -144,6 +145,19 @@ sub batch_import { svc_acct.username svc_acct._password ); $payby = 'BILL'; + } elsif ( $format eq 'extended-plus_options' ) { + @fields = qw( agent_custid refnum + last first address1 address2 city state zip country + daytime night + ship_last ship_first ship_company ship_address1 ship_address2 + ship_city ship_state ship_zip ship_country + payinfo paycvv paydate + invoicing_list + cust_pkg.pkgpart + svc_acct.username svc_acct._password + customer_options + ); + $payby = 'BILL'; } elsif ( $format eq 'extended-plus_company' ) { @fields = qw( agent_custid refnum last first company address1 address2 city state zip country @@ -156,6 +170,19 @@ sub batch_import { svc_acct.username svc_acct._password ); $payby = 'BILL'; + } elsif ( $format eq 'extended-plus_company_and_options' ) { + @fields = qw( agent_custid refnum + last first company address1 address2 city state zip country + daytime night + ship_last ship_first ship_company ship_address1 ship_address2 + ship_city ship_state ship_zip ship_country + payinfo paycvv paydate + invoicing_list + cust_pkg.pkgpart + svc_acct.username svc_acct._password + customer_options + ); + $payby = 'BILL'; } elsif ( $format =~ /^svc_external/ ) { @fields = qw( agent_custid refnum last first company address1 address2 city state zip country @@ -318,14 +345,22 @@ sub batch_import { } } - $cust_main{'payby'} = 'CARD' - if defined $cust_main{'payinfo'} - && length $cust_main{'payinfo'}; + if ( defined $cust_main{'payinfo'} && length $cust_main{'payinfo'} ) { + $cust_main{'payby'} = 'CARD'; + if ($cust_main{'payinfo'} =~ /\s*([AD]?)(.*)\s*$/) { + $cust_main{'payby'} = 'DCRD' if $1 eq 'D'; + $cust_main{'payinfo'} = $2; + } + } my $invoicing_list = $cust_main{'invoicing_list'} ? [ delete $cust_main{'invoicing_list'} ] : []; + my $customer_options = delete $cust_main{customer_options}; + $cust_main{tax} = 'Y' if $customer_options =~ /taxexempt/i; + push @$invoicing_list, 'POST' if $customer_options =~ /postalinvoice/i; + my $cust_main = new FS::cust_main ( \%cust_main ); use Tie::RefHash; diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi index 2ccf997c8..edf466566 100644 --- a/httemplate/misc/cust_main-import.cgi +++ b/httemplate/misc/cust_main-import.cgi @@ -30,7 +30,9 @@ Import a file containing customer records. @@ -89,7 +91,11 @@ Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets. Extended format has the following field order: agent_custid, refnum<%$req%>, last<%$req%>, first<%$req%>, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo, paycvv, paydate, invoicing_list, pkgpart, username, _password

+Extended plus options format has the following field order: agent_custid, refnum<%$req%>, last<%$req%>, first<%$req%>, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo, paycvv, paydate, invoicing_list, pkgpart, username, _password, options + Extended plus company format has the following field order: agent_custid, refnum<%$req%>, last<%$req%>, first<%$req%>, company, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_company, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo, paycvv, paydate, invoicing_list, pkgpart, username, _password + +Extended plus company and options format has the following field order: agent_custid, refnum<%$req%>, last<%$req%>, first<%$req%>, company, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_company, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo, paycvv, paydate, invoicing_list, pkgpart, username, _password, options

External service format has the following field order: agent_custid, refnum<%$req%>, last<%$req%>, first<%$req%>, company, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_company, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo, paycvv, paydate, invoicing_list, pkgpart, next_bill_date, id, title @@ -111,7 +117,7 @@ Field information: of an integer, the string is searched for and if necessary auto-created in the advertising source table. -
  • payinfo: Credit card number, or leave this, paycvv and paydate blank for email/paper invoicing. +
  • payinfo: Credit card number, or leave this, paycvv and paydate blank for email/paper invoicing. You may optionally prepend an 'A' or 'D' to the credit card number for automatic or on demand of customer billing respectively
  • paycvv: CVV2 number (three digits on the back of the credit card) @@ -127,6 +133,13 @@ advertising source table.
  • title: External service identifier, text +
  • options: text containing one or more of + + +
    -- 2.11.0