[freeside-commits] freeside/httemplate/browse did_order.html, 1.1.2.4, 1.1.2.5

Erik Levinson levinse at wavetail.420.am
Thu Apr 14 20:09:53 PDT 2011


Update of /home/cvs/cvsroot/freeside/httemplate/browse
In directory wavetail.420.am:/tmp/cvs-serv15204/httemplate/browse

Modified Files:
      Tag: FREESIDE_2_1_BRANCH
	did_order.html 
Log Message:
bulk DID orders/inventory enhancements, RT11291

Index: did_order.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/did_order.html,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -w -d -r1.1.2.4 -r1.1.2.5
--- did_order.html	11 Apr 2011 23:03:32 -0000	1.1.2.4
+++ did_order.html	15 Apr 2011 03:09:51 -0000	1.1.2.5
@@ -1,6 +1,6 @@
 <% include( 'elements/browse.html',
                  'title'       => 'Bulk DID Orders',
-                 'html_init'   => $html_init,
+                 'html_init'   => qq!<A HREF="${p}edit/did_order.html"><I>Add a bulk DID order</I></A><BR><BR>!,
                  'name'        => 'bulk DID orders',
                  'disableable' => 0,
                  'query'       => { 'table'     => 'did_order',
@@ -8,47 +8,26 @@
                                     'hashref'   => {},
                                     'order_by' => 'ORDER BY ordernum',
                                   },
-                 'count_query' => $count_query,
-                 'header'      => $header,
-                 'fields'      => $fields,
-                 'links'       => [
-				    [ $p.'edit/did_order.html?', 'ordernum' ],
+                 'count_query' => 'SELECT COUNT(*) FROM did_order',
+                 'header'      => [ '#', 'Vendor',' Vendor Order #', 
+                                    'Submitted', 'Confirmed', 'Customer',
+                                    'Received', 'Provision', 'Cancel',
 				  ],
-             )
-%>
-<%init>
-
-die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('Import');
-
-my $conf = new FS::Conf;
-my $date_format = $conf->config('date_format') || '%m/%d/%Y';
-
-my $html_init = 
-  qq!<A HREF="${p}edit/did_order.html"><I>Add a bulk DID order</I></A><BR><BR>!;
-
-my $count_query = 'SELECT COUNT(*) FROM did_order';
-
-my $display_date = sub {
-    my $date = shift;
-    return '' unless $date;
-    time2str($date_format, $date);
-};
-
-my $header = [ '#', 'Vendor',' Vendor Order #', 'Submitted', 'Confirmed',
-                'Customer', 'Received', ];
-my $fields = [  sub {
+                 'fields'      => [ sub {
 		    my $did_order = shift;
 		    $did_order->ordernum;
-		}, 'vendorname', 'vendor_order_id', 
+                                    }, 
+                                    'vendorname', 
+                                    'vendor_order_id', 
 		sub { &$display_date(shift->submitted); }, 
 		sub {
 		    my $did_order = shift;
 		    my $ordernum = $did_order->ordernum;
-            return &$display_date($did_order->confirmed) if $did_order->confirmed;
+                                        return &$display_date($did_order->confirmed) 
+                                            if $did_order->confirmed;
             include( '/elements/popup_link.html',
               { 'action'      => "${p}misc/did_order_confirm.html?ordernum=$ordernum",
-                'label'       => 'Confirm&nbsp;Bulk&nbsp;DID&nbsp;Order',
+                                            'label'       => 'Confirm',
                 'actionlabel' => 'Confirm Bulk DID Order',
                 'width'       => 480,
                 'height'      => 300,
@@ -68,6 +47,61 @@
 			    if $did_order->received;
 		    "<A HREF='${p}misc/phone_avail-import.html?ordernum=$ordernum'>Upload Received</A>";
 		}, 
-	     ];
+                                    sub {
+                                        my $did_order = shift;
+                                        my $ordernum = $did_order->ordernum;
+                                        my @provisioned = 
+                                            qsearch({ table   => 'phone_avail',
+                                                      hashref => { 'ordernum' => $ordernum, },
+                                                      select  => 'phone_avail.*',
+                                                      extra_sql => ' and svcnum is not null ',
+                                                    });
+                                        return '' 
+                                            unless $did_order->received 
+                                                        && $did_order->custnum
+                                                        && !scalar(@provisioned);
+                                        include( '/elements/popup_link.html',
+                                          { 'action'      => "${p}misc/did_order_provision.html?ordernum=".$did_order->ordernum,
+                                            'label'       => 'Provision All DIDs',
+                                            'actionlabel' => 'Bulk DID order - DID provisioning',
+                                            'width'       => 520,
+                                            'height'      => 300,
+                                          }
+                                        )
+                                    },
+                                    sub {
+                                        my $did_order = shift;
+                                        return '' unless !$did_order->received;
+                                        qq!<A HREF="javascript:areyousure('${p}misc/did_order_confirmed.html?action=cancel;ordernum=!
+                                        . $did_order->ordernum . qq!', 'Cancel this order (#!
+                                        . $did_order->ordernum . qq!)?')">Cancel</A>!
+                                    },
+                                  ],
+                 'links'       => [
+                                    [ $p.'edit/did_order.html?', 'ordernum' ],
+				                  ],
+                 'html_foot' => '
+                            <script type="text/javascript">
+                                function areyousure(href,msg) {
+                                    if (confirm(msg))
+                                        window.location.href = href;
+                                }
+                            </script>
+                                ',
+             )
+%>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Import');
+
+my $conf = new FS::Conf;
+my $date_format = $conf->config('date_format') || '%m/%d/%Y';
+
+my $display_date = sub {
+    my $date = shift;
+    return '' unless $date;
+    time2str($date_format, $date);
+};
 
 </%init>



More information about the freeside-commits mailing list