[freeside-commits] freeside/FS/FS cust_main.pm,1.375,1.376
Ivan,,,
ivan at wavetail.420.am
Mon Oct 13 17:50:36 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv26289/FS/FS
Modified Files:
cust_main.pm
Log Message:
add an import format for external services, including next bill date (cust_pkg.bill), RT#4108
Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.375
retrieving revision 1.376
diff -u -d -r1.375 -r1.376
--- cust_main.pm 10 Oct 2008 01:15:49 -0000 1.375
+++ cust_main.pm 14 Oct 2008 00:50:33 -0000 1.376
@@ -6392,6 +6392,9 @@
=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 @@
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 @@
);
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 @@
} 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 @@
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 );
More information about the freeside-commits
mailing list