1 <% include( 'elements/browse.html',
2 'title' => 'Bulk DID Orders',
3 'html_init' => $html_init,
4 'name' => 'bulk DID orders',
7 'count_query' => 'SELECT COUNT(*) FROM did_order', # XXX: this is wrong!?
8 'header' => [ '#', 'Vendor',' Vendor Order #',
9 'Submitted', 'Confirmed', 'Customer',
10 'Received', 'Provision', 'Cancel',
13 my $did_order = shift;
18 sub { &$display_date(shift->submitted); },
20 my $did_order = shift;
21 my $ordernum = $did_order->ordernum;
22 return &$display_date($did_order->confirmed)
23 if $did_order->confirmed;
24 include( '/elements/popup_link.html',
25 { 'action' => "${p}misc/did_order_confirm.html?ordernum=$ordernum",
27 'actionlabel' => 'Confirm Bulk DID Order',
34 my $did_order = shift;
35 my $cust_main = $did_order->cust_main;
36 return "Stock" unless $cust_main;
37 "<A HREF='${p}view/cust_main.cgi?".$cust_main->custnum."'>".$cust_main->name."</A>";
40 my $did_order = shift;
41 my $ordernum = $did_order->ordernum;
42 return "<A HREF='${p}misc/phone_avail-import.html?ordernum=$ordernum'>Upload Received</A>"
43 unless $did_order->received;
44 "<A HREF='${p}search/phone_avail.html?ordernum=$ordernum'>"
45 . &$display_date($did_order->received) . "</A>";
48 my $did_order = shift;
49 my $ordernum = $did_order->ordernum;
50 my @provisioned = $did_order->provisioned;
52 unless $did_order->received
53 && $did_order->custnum
54 && !scalar(@provisioned);
55 include( '/elements/popup_link.html',
56 { 'action' => "${p}misc/did_order_provision.html?ordernum=".$did_order->ordernum,
57 'label' => 'Provision All DIDs',
58 'actionlabel' => 'Bulk DID order - DID provisioning',
65 my $did_order = shift;
66 return '' unless !$did_order->received;
67 qq!<A HREF="javascript:areyousure('${p}misc/did_order_confirmed.html?action=cancel;ordernum=!
68 . $did_order->ordernum . qq!', 'Cancel this order (#!
69 . $did_order->ordernum . qq!)?')">Cancel</A>!
73 [ $p.'edit/did_order.html?', 'ordernum' ],
76 <script type="text/javascript">
77 function areyousure(href,msg) {
79 window.location.href = href;
88 unless $FS::CurrentUser::CurrentUser->access_right('Import');
90 my $conf = new FS::Conf;
91 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
93 my $display_date = sub {
95 return '' unless $date;
96 time2str($date_format, $date);
99 my $html_init = qq!<A HREF="${p}edit/did_order.html">Add a bulk DID order</A>
103 'table' => 'did_order',
105 'addl_from' => 'left join did_vendor using (vendornum) ',
106 'order_by' => 'ORDER BY ordernum',
108 $query->{'hashref'}->{'custnum'} = $1 if $cgi->param('custnum') =~ /^(\d+)$/;
109 if ( $cgi->param('custrcvdunprov') ) {
110 $query->{'hashref'}->{'received'} = { 'op' => '>', 'value' => '0', };
111 $query->{'hashref'}->{'custnum'} = { 'op' => '>', 'value' => '0', };
112 $query->{'addl_from'} .= ' left join phone_avail using (ordernum) ';
113 $query->{'extra_sql'} .= ' and svcnum is null ';
114 $html_init .= qq!<A HREF="${p}browse/did_order.html">Browse all DID orders</A>!;
117 $html_init .= qq!<A HREF="${p}browse/did_order.html?custrcvdunprov=1">
118 Browse all non-stock orders with received unprovisioned DIDs
122 $html_init .= "<BR><BR>";