summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2008-10-14 00:50:34 +0000
committerivan <ivan>2008-10-14 00:50:34 +0000
commit774d8233d58603582bea392eab368b05e6baf159 (patch)
treecb97eb7aae320184f483b3afc956b29649d2f199
parent0731f30e839cb53da5d5bebe68518f136058e919 (diff)
add an import format for external services, including next bill date (cust_pkg.bill), RT#4108
-rw-r--r--FS/FS/cust_main.pm40
-rw-r--r--httemplate/misc/cust_main-import.cgi11
2 files changed, 43 insertions, 8 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index c048482..61cb75d 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -6392,6 +6392,9 @@ sub process_batch_import {
=cut
+use FS::svc_acct;
+use FS::svc_external;
+
#some false laziness w/cdr.pm now
sub batch_import {
my $param = shift;
@@ -6439,6 +6442,18 @@ sub batch_import {
svc_acct.username svc_acct._password
);
$payby = 'BILL';
+ } elsif ( $format eq 'svc_external' ) {
+ @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 cust_pkg.bill
+ svc_external.id svc_external.title
+ );
+ $payby = 'BILL';
} else {
die "unknown format $format";
}
@@ -6527,7 +6542,7 @@ sub batch_import {
);
my $billtime = time;
my %cust_pkg = ( pkgpart => $pkgpart );
- my %svc_acct = ();
+ my %svc_x = ();
foreach my $field ( @fields ) {
if ( $field =~ /^cust_pkg\.(pkgpart|setup|bill|susp|adjourn|expire|cancel)$/ ) {
@@ -6543,7 +6558,11 @@ sub batch_import {
} elsif ( $field =~ /^svc_acct\.(username|_password)$/ ) {
- $svc_acct{$1} = shift @columns;
+ $svc_x{$1} = shift @columns;
+
+ } elsif ( $field =~ /^svc_external\.(id|title)$/ ) {
+
+ $svc_x{$1} = shift @columns;
} else {
@@ -6591,18 +6610,25 @@ sub batch_import {
if ( $cust_pkg{'pkgpart'} ) {
my $cust_pkg = new FS::cust_pkg ( \%cust_pkg );
- my @svc_acct = ();
- if ( $svc_acct{'username'} ) {
+ my @svc_x = ();
+ my $svcdb = '';
+ if ( $svc_x{'username'} ) {
+ $svcdb = 'svc_acct';
+ } elsif ( $svc_x{'id'} || $svc_x{'title'} ) {
+ $svcdb = 'svc_external';
+ }
+ if ( $svcdb ) {
my $part_pkg = $cust_pkg->part_pkg;
unless ( $part_pkg ) {
$dbh->rollback if $oldAutoCommit;
return "unknown pkgpart: ". $cust_pkg{'pkgpart'};
}
- $svc_acct{svcpart} = $part_pkg->svcpart( 'svc_acct' );
- push @svc_acct, new FS::svc_acct ( \%svc_acct )
+ $svc_x{svcpart} = $part_pkg->svcpart( $svcdb );
+ my $class = "FS::$svcdb";
+ push @svc_x, $class->new( \%svc_x );
}
- $hash{$cust_pkg} = \@svc_acct;
+ $hash{$cust_pkg} = \@svc_x;
}
my $error = $cust_main->insert( \%hash, $invoicing_list );
diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi
index bbeaa51..066f891 100644
--- a/httemplate/misc/cust_main-import.cgi
+++ b/httemplate/misc/cust_main-import.cgi
@@ -31,6 +31,7 @@ Import a file containing customer records.
<!-- <OPTION VALUE="simple">Simple -->
<OPTION VALUE="extended" SELECTED>Extended
<OPTION VALUE="extended-plus_company">Extended plus company
+ <OPTION VALUE="svc_external">External service
</SELECT>
</TD>
</TR>
@@ -90,6 +91,9 @@ Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets.
<b>Extended plus company</b> format has the following field order: <i>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</i>
<BR><BR>
+<b>External service</b> format has the following field order: <i>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</i>
+<BR><BR>
+
<%$req%> Required fields
<BR><BR>
@@ -113,7 +117,12 @@ advertising source table.
<li><i>pkgpart</i>: Package definition. Configuration -&gt; Provisioning, services and packages -&gt; View/Edit package definitions
- <li><i>username</i> and <i>_password</i> are required if <i>pkgpart</i> is specified.
+ <li><i>username</i> and <i>_password</i> are required if <i>pkgpart</i> is specified. (Extended and Extended plus company formats)
+
+ <li><i>id</i>: External service id, integer
+
+ <li><i>title</i>: External service identifier, text
+
</ul>
<BR>