1 <% include('/elements/header.html', 'Phone number (DID) import') %>
3 Import a file containing phone numbers (DIDs).
6 <& /elements/form-file_upload.html,
7 'name' => 'PhonenumImportForm',
8 'action' => 'process/phone_avail-import.html',
10 'fields' => [ 'format', 'availbatch', 'exportnum', 'countrycode',
11 'ordernum', 'confirmed', 'vendor_order_id' ],
12 'message' => 'DID import successful',
13 'url' => $p."search/phone_avail.html?availbatch=$availbatch",
14 'onsubmit' => "document.PhonenumImportForm.submitButton.disabled=true;",
17 <% &ntable("#cccccc", 2) %>
20 <INPUT TYPE="hidden" NAME="availbatch" VALUE="<% $availbatch %>">
24 <TD ALIGN="RIGHT">Bulk DID Order #</TD>
26 <INPUT TYPE="hidden" NAME="ordernum" VALUE="<% $ordernum %>">
30 <TD ALIGN="RIGHT">Vendor Order #</TD>
32 <INPUT TYPE="text" NAME="vendor_order_id" VALUE="<% $vendor_order_id %>">
36 <% include( '/elements/tr-input-date-field.html', {
37 'name' => 'confirmed',
38 'label' => 'Order Confirmed',
39 'value' => $confirmed,
45 <TD ALIGN="RIGHT">Import Format</TD>
46 <TD><% $format %><INPUT TYPE="hidden" NAME="format" VALUE="<% $format %>"></TD>
49 % if ( scalar(@exports) == 1 ) {
50 % my $export = $exports[0];
54 <INPUT TYPE="hidden" name="exportnum" value="<%$export->exportnum%>">
55 <% $export->exportname %>
59 <% include( '/elements/tr-select-table.html',
60 'table' => 'part_export',
61 'name_col' => 'label',
62 'order_by' => 'ORDER BY exportname, machine',
64 'empty_label' => 'Select export',
65 'hashref' => { 'exporttype' => 'internal_diddb', },
72 <TH ALIGN="right">Country code</TH>
76 VALUE = "<% $conf->config('default_phone_countrycode') || 1 %>"
81 <% include( '/elements/file-upload.html',
83 'label' => 'Filename',
88 <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px">
89 <INPUT TYPE = "submit"
103 Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets. The file should have a .CSV or .XLS extension.
107 <b>Bulk</b> format has the following field order: <i>state, number, rate center, rate_center_abbrev, msa, latanum</i>
109 <b>Default</b> format has the following field order: <i>state, number, name</i><br>
114 <li><i>state</i>: Two-letter state code, i.e. "CA"
115 <li><i>number</i>: Phone number
118 <li><i>rate center</i>: rate center (required)
119 <li><i>rate_center_abbrev</i>: rate center abbreviation
121 <li><i>latanum</i>: LATA #
123 <li><i>name</i>: optional, rate center
128 <% include('/elements/footer.html') %>
133 unless $FS::CurrentUser::CurrentUser->access_right('Import');
135 my $conf = new FS::Conf;
137 my $ordernum = $cgi->param('ordernum');
138 $ordernum = '' unless $ordernum =~ /^\d+$/;
140 my $vendor_order_id = '';
144 $order = qsearchs('did_order', { 'ordernum' => $ordernum } )
147 die 'invalid ordernum' unless (!$ordernum || $order);
149 my $format = 'default';
153 $confirmed = $order->confirmed;
154 $vendor_order_id = $order->vendor_order_id;
159 time2str('webimport-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);
161 my @exports = qsearch('part_export', { 'exporttype' => 'internal_diddb', });