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 % if ( scalar(@exports) == 1 ) {
49 % my $export = $exports[0];
53 <INPUT TYPE="hidden" name="exportnum" value="<%$export->exportnum%>">
54 <% $export->exportname %>
58 <% include( '/elements/tr-select-table.html',
59 'table' => 'part_export',
60 'name_col' => 'label',
61 'order_by' => 'ORDER BY exportname, machine',
63 'empty_label' => 'Select export',
64 'hashref' => { 'exporttype' => 'internal_diddb', },
71 <TH ALIGN="right">Country code</TH>
75 VALUE = "<% $conf->config('default_phone_countrycode') || 1 %>"
80 <% include( '/elements/file-upload.html',
82 'label' => 'Filename',
87 <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px">
88 <INPUT TYPE = "submit"
91 onClick = "document.PhonenumImportForm.submit.disabled=true;"
102 Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets. The file should have a .CSV or .XLS extension.
106 <b>Bulk</b> format has the following field order: <i>state, number, rate center, rate_center_abbrev, msa, latanum</i>
108 <b>Default</b> format has the following field order: <i>state, number, name</i><br>
113 <li><i>state</i>: Two-letter state code, i.e. "CA"
114 <li><i>number</i>: Phone number
117 <li><i>rate center</i>: rate center (required)
118 <li><i>rate_center_abbrev</i>: rate center abbreviation
120 <li><i>latanum</i>: LATA #
122 <li><i>name</i>: optional, rate center
127 <% include('/elements/footer.html') %>
132 unless $FS::CurrentUser::CurrentUser->access_right('Import');
134 my $conf = new FS::Conf;
136 my $ordernum = $cgi->param('ordernum');
137 $ordernum = '' unless $ordernum =~ /^\d+$/;
139 my $vendor_order_id = '';
143 $order = qsearchs('did_order', { 'ordernum' => $ordernum } )
146 die 'invalid ordernum' unless (!$ordernum || $order);
148 my $format = 'default';
152 $confirmed = $order->confirmed;
153 $vendor_order_id = $order->vendor_order_id;
158 time2str('webimport-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);
160 my @exports = qsearch('part_export', { 'exporttype' => 'internal_diddb', });