1 <% include( 'elements/browse.html',
2 'title' => 'Bulk DID Orders',
3 'html_init' => qq!<A HREF="${p}edit/did_order.html"><I>Add a bulk DID order</I></A><BR><BR>!,
4 'name' => 'bulk DID orders',
6 'query' => { 'table' => 'did_order',
7 'addl_from' => 'left join did_vendor using (vendornum) ',
9 'order_by' => 'ORDER BY ordernum',
11 'count_query' => 'SELECT COUNT(*) FROM did_order',
12 'header' => [ '#', 'Vendor',' Vendor Order #',
13 'Submitted', 'Confirmed', 'Customer',
14 'Received', 'Provision', 'Cancel',
17 my $did_order = shift;
22 sub { &$display_date(shift->submitted); },
24 my $did_order = shift;
25 my $ordernum = $did_order->ordernum;
26 return &$display_date($did_order->confirmed)
27 if $did_order->confirmed;
28 include( '/elements/popup_link.html',
29 { 'action' => "${p}misc/did_order_confirm.html?ordernum=$ordernum",
31 'actionlabel' => 'Confirm Bulk DID Order',
38 my $did_order = shift;
39 my $cust_main = $did_order->cust_main;
40 return "Stock" unless $cust_main;
41 "<A HREF='${p}view/cust_main.cgi?".$cust_main->custnum."'>".$cust_main->name."</A>";
44 my $did_order = shift;
45 my $ordernum = $did_order->ordernum;
46 return &$display_date($did_order->received)
47 if $did_order->received;
48 "<A HREF='${p}misc/phone_avail-import.html?ordernum=$ordernum'>Upload Received</A>";
51 my $did_order = shift;
52 my $ordernum = $did_order->ordernum;
54 qsearch({ table => 'phone_avail',
55 hashref => { 'ordernum' => $ordernum, },
56 select => 'phone_avail.*',
57 extra_sql => ' and svcnum is not null ',
60 unless $did_order->received
61 && $did_order->custnum
62 && !scalar(@provisioned);
63 include( '/elements/popup_link.html',
64 { 'action' => "${p}misc/did_order_provision.html?ordernum=".$did_order->ordernum,
65 'label' => 'Provision All DIDs',
66 'actionlabel' => 'Bulk DID order - DID provisioning',
73 my $did_order = shift;
74 return '' unless !$did_order->received;
75 qq!<A HREF="javascript:areyousure('${p}misc/did_order_confirmed.html?action=cancel;ordernum=!
76 . $did_order->ordernum . qq!', 'Cancel this order (#!
77 . $did_order->ordernum . qq!)?')">Cancel</A>!
81 [ $p.'edit/did_order.html?', 'ordernum' ],
84 <script type="text/javascript">
85 function areyousure(href,msg) {
87 window.location.href = href;
96 unless $FS::CurrentUser::CurrentUser->access_right('Import');
98 my $conf = new FS::Conf;
99 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
101 my $display_date = sub {
103 return '' unless $date;
104 time2str($date_format, $date);