summaryrefslogtreecommitdiff
path: root/bin/svc_phone-bulk_insert-profile
blob: b1ed89943ad1473e255c06618e0dbe52c386d7d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/perl -w

use strict;
use DBIx::Profile;
use FS::UID qw( adminsuidsetup );
#use FS::Record qw( qsearchs );
use FS::svc_phone;

my $user = shift or die &usage;
my $dbh = adminsuidsetup($user);

my $pkgnum = shift or die &usage;
my $svcpart = shift or die &usage;

#$FS::cust_pkg::DEBUG = 3;
$FS::cust_svc::ignore_quantity = 1;

#for ( 1..50000 ) {
for ( 1..5000 ) {
  my $svc_phone = new FS::svc_phone {
    'countrycode' => 1,
    'phonenum'    => '3125550000' + $_,
    'pkgnum'      => $pkgnum,
    'svcpart'     => $svcpart,
  };
  my $error = $svc_phone->insert;
  die $error if $error;
  print '.' unless $_ % 50 # % 1000;
}

print "\n";
print $dbh->sprintProfile;
#$dbh->printProfile;

sub usage {
  die "Usage:\n svc_phone-bulk_insert-profile user pkgnum svcpart\n";
}

1;