X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=eg%2FTEMPLATE_cust_main.import;h=f6d88c701a484ce4ddedf163a7905bd2a53daa55;hp=39a5785db62377185daf3e10456648d8ff746ef5;hb=29d80a8582103ead0b5910391cabc45cb85fa836;hpb=09a1086ecc936117027e8fb6f015dbc038449316 diff --git a/eg/TEMPLATE_cust_main.import b/eg/TEMPLATE_cust_main.import index 39a5785db..f6d88c701 100755 --- a/eg/TEMPLATE_cust_main.import +++ b/eg/TEMPLATE_cust_main.import @@ -1,17 +1,19 @@ #!/usr/bin/perl -w - -# Template for importing legacy customer data # -# ivan@sisd.com 98-aug-17 - 20 +# Template for importing legacy customer data use strict; +use Date::Parse; use FS::UID qw(adminsuidsetup datasrc); use FS::Record qw(fields qsearch qsearchs); use FS::cust_main; use FS::cust_pkg; -use Date::Parse; +use FS::cust_svc; +use FS::svc_acct; +use FS::pkg_svc; -adminsuidsetup; +my $user = shift or die &usage; +adminsuidsetup $user; # use these for the imported cust_main records (unless you have these in legacy # data) @@ -90,7 +92,7 @@ while () { $svc{'First'} =~ s/&/and/go; $svc{'Zip'} =~ s/\s+$//go; - my($cust_main) = create FS::cust_main ( { + my($cust_main) = new FS::cust_main ( { 'custnum' => $svc{'custnum'}, 'agentnum' => $agentnum, 'last' => $svc{'last'}, @@ -121,7 +123,7 @@ while () { die $error; } - my($cust_pkg)=create FS::cust_pkg ( { + my($cust_pkg)=new FS::cust_pkg ( { 'custnum' => $svc{'custnum'}, 'pkgpart' => $pkgpart{$svc{'LegacyBillingData'}}, 'setup' => '', @@ -168,7 +170,7 @@ while () { } else { #create new cust_svc record linked to cust_pkg record - my($n_cust_svc) = create FS::cust_svc ({ + my($n_cust_svc) = new FS::cust_svc ({ 'svcnum' => $o_cust_svc->svcnum, 'pkgnum' => $cust_pkg->pkgnum, 'svcpart' => $pkg_svc->svcpart, @@ -187,3 +189,8 @@ while () { warn "\n$link of $line lines linked\n"; +# --- + +sub usage { + die "Usage:\n\n cust_main.import user\n"; +}