1 <% $cgi->redirect(popurl(3). "view/cust_main.cgi?custnum=$custnum;show=packages#cust_pkg$pkgnum") %>
5 unless $FS::CurrentUser::CurrentUser->access_right('Bulk provision customer service');
7 $cgi->param('phonenum') =~ /^\s*(\d+)\s*\-\s*(\d+)\s*$/
8 or errorpage('Enter a phone number range, with dash as the separator');
9 my($start, $end) = ($1, $2);
11 $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'illegal pkgnum';
13 my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $pkgnum })
14 or die 'unknown pkgnum';
15 my $custnum = $cust_pkg->custnum;
17 if ( length($end) < length($start) ) {
18 $end = substr($start, 0, length($start) - length($end) ). $end;
21 errorpage("$end is smaller than $start") if $end < $start;
23 $cgi->param('num_avail') =~ /^(\d+)$/ or die 'illegal num_avail';
25 errorpage("There are only $num_avail available")
26 if $end - $start + 1 > $num_avail;
28 foreach my $phonenum ( "$start" .. "$end" ) {
30 my $svc_phone = new FS::svc_phone {
31 'phonenum' => $phonenum,
33 'svcpart' => scalar($cgi->param('svcpart')),
35 $svc_phone->set_default_and_fixed;
37 my $error = $svc_phone->insert;
38 errorpage($error) if $error;