1 <% include('/elements/header.html', 'Phone number (DID) import') %>
3 Import a file containing phone numbers (DIDs).
6 <% include( '/elements/form-file_upload.html',
7 'name' => 'PhonenumImportForm',
8 'action' => 'process/phone_avail-import.html',
10 'fields' => [ 'format', 'availbatch', 'exportnum', 'countrycode', 'ordernum', 'confirmed', 'vendor_order_id' ],
11 'message' => 'DID import successful',
12 'url' => $p."search/phone_avail.html?availbatch=$availbatch",
16 <% &ntable("#cccccc", 2) %>
19 <INPUT TYPE="hidden" NAME="availbatch" VALUE="<% $availbatch %>">
23 <TD ALIGN="RIGHT">Bulk DID Order #</TD>
25 <INPUT TYPE="hidden" NAME="ordernum" VALUE="<% $ordernum %>">
29 <TD ALIGN="RIGHT">Vendor Order #</TD>
31 <INPUT TYPE="text" NAME="vendor_order_id" VALUE="<% $vendor_order_id %>">
35 <% include( '/elements/tr-input-date-field.html', {
36 'name' => 'confirmed',
37 'label' => 'Order Confirmed',
38 'value' => $confirmed,
44 <TD ALIGN="RIGHT">Import Format</TD>
45 <TD><% $format %><INPUT TYPE="hidden" NAME="format" VALUE="<% $format %>"></TD>
48 <% include( '/elements/tr-select-table.html',
49 'table' => 'part_export',
50 'name_col' => 'label',
51 'order_by' => 'ORDER BY exportname, machine',
53 'empty_label' => 'Select export',
54 'hashref' => { 'exporttype' => 'internal_diddb', },
60 <TH ALIGN="right">Country code</TH>
64 VALUE = "<% $conf->config('default_phone_countrycode') || 1 %>"
69 <% include( '/elements/file-upload.html',
71 'label' => 'Filename',
76 <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px">
77 <INPUT TYPE = "submit"
80 onClick = "document.PhonenumImportForm.submit.disabled=true;"
91 Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets. The file should have a .CSV or .XLS extension.
95 <b>Bulk</b> format has the following field order: <i>state, number, rate center, rate_center_abbrev, msa, latanum</i>
97 <b>Default</b> format has the following field order: <i>state, number, name</i><br>
102 <li><i>state</i>: Two-letter state code, i.e. "CA"
103 <li><i>number</i>: Phone number
106 <li><i>rate center</i>: rate center (required)
107 <li><i>rate_center_abbrev</i>: rate center abbreviation
109 <li><i>latanum</i>: LATA #
111 <li><i>name</i>: optional, rate center
116 <% include('/elements/footer.html') %>
121 unless $FS::CurrentUser::CurrentUser->access_right('Import');
123 my $conf = new FS::Conf;
125 my $ordernum = $cgi->param('ordernum');
126 $ordernum = '' unless $ordernum =~ /^\d+$/;
128 my $vendor_order_id = '';
132 $order = qsearchs('did_order', { 'ordernum' => $ordernum } )
135 die 'invalid ordernum' unless (!$ordernum || $order);
137 my $format = 'default';
141 $confirmed = $order->confirmed;
142 $vendor_order_id = $order->vendor_order_id;
147 time2str('webimport-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);