better export labeling for DID import, RT#11219
[freeside.git] / httemplate / misc / phone_avail-import.html
1 <% include('/elements/header.html', 'Phone number (DID) import') %>
2
3 Import a file containing phone numbers (DIDs).
4 <BR><BR>
5
6 <% include( '/elements/form-file_upload.html',
7               'name'      => 'PhonenumImportForm',
8               'action'    => 'process/phone_avail-import.html',
9               'num_files' => 1,
10               'fields'    => [ 'format', 'availbatch', 'exportnum', 'countrycode' ],
11               'message'   => 'DID import successful',
12               'url'       => $p."search/phone_avail.html?availbatch=$availbatch",
13           )
14 %>
15
16 <% &ntable("#cccccc", 2) %>
17
18   <INPUT TYPE="hidden" NAME="format" VALUE="default">
19
20   <INPUT TYPE="hidden" NAME="availbatch" VALUE="<% $availbatch %>">
21
22   <% include( '/elements/tr-select-table.html',
23                 'table'       => 'part_export',
24                 'name_col'    => 'label',
25                 'order_by'    => 'ORDER BY exportname, machine',
26                 'label'       => 'Export',
27                 'empty_label' => 'Select export',
28                 'hashref'     => { 'exporttype' => 'internal_diddb', },
29                 #'label_callback' => 
30             )
31   %>
32
33   <TR>
34     <TH ALIGN="right">Country code</TH>
35     <TD>
36       <INPUT TYPE  = "text"
37              NAME  = "countrycode"
38              VALUE = "<% $conf->config('default_phone_countrycode') || 1 %>"
39       >
40     </TD>
41   </TR>
42
43   <% include( '/elements/file-upload.html',
44                 'field' => 'file',
45                 'label' => 'Filename',
46             )
47   %>
48
49   <TR>
50     <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px">
51       <INPUT TYPE    = "submit"
52              ID      = "submit"
53              VALUE   = "Import file"
54              onClick = "document.PhonenumImportForm.submit.disabled=true;"
55       >
56     </TD>
57   </TR>
58
59 </TABLE>
60
61 </FORM>
62
63 <BR>
64
65 Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets.  The file should have a .CSV or .XLS extension.
66 <BR><BR>
67
68 <b>Default</b> format has the following field order: <i>state, number, name</i>
69 <BR><BR>
70
71 Field information:
72 <ul>
73   <li><i>state</i>: Two-letter state code, i.e. "CA"
74   <li><i>number</i>: Phone number
75   <li><i>name</i>: optional, rate center
76 </ul>
77
78 <% include('/elements/footer.html') %>
79
80 <%init>
81
82 die "access denied"
83   unless $FS::CurrentUser::CurrentUser->access_right('Import');
84
85 my $conf = new FS::Conf;
86
87 my $availbatch =
88   time2str('webimport-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);
89
90 </%init>