agent virt inventory, RT#7010
[freeside.git] / httemplate / search / inventory_item.html
index 3f0288b..681e5db 100644 (file)
@@ -1,14 +1,21 @@
 <% include( 'elements/search.html',
                  'title'       => $title,
 
-                 #less lame to use Lingua:: something to pluralize
-                 'name'        => $inventory_class->classname. 's',
+                 'menubar'     => [ 'View inventory classes' =>
+                                      $p.'browse/inventory_class.html',
+                                    'Upload '. PL($inventory_class->classname)=>
+                                      $p.'misc/inventory_item-import.html?'.
+                                      "classnum=$classnum"
+                                  ],
+
+                 'name'        => PL($inventory_class->classname),
 
                  'query'       => {
                                     'table'   => 'inventory_item',
                                     'hashref' => {},
                                     'select'  => join(', ',
                                         'inventory_item.*',
+                                        'part_svc.svcdb',
                                         'cust_main.custnum',
                                         FS::UI::Web::cust_sql_fields(),
                                       ),
 
                  'count_query' => $count_query,
 
+                 'agent_virt' => 1,
+                 'agent_null' => 1,
+                 'agent_pos'  => 2,
+
                  'header'      => [
                    '#',
                    $inventory_class->classname,
 %>
 <%init>
 
+my $curuser = $FS::CurrentUser::CurrentUser;
+
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+  unless $curuser->access_right('Edit inventory')
+      || $curuser->access_right('Edit global inventory')
+      || $curuser->access_right('Configuration');
 
 my $classnum = $cgi->param('classnum');
 $classnum =~ /^(\d+)$/ or errorpage("illegal classnum $classnum");
@@ -103,7 +118,16 @@ my $count_query =
 my $link = sub {
   my $inventory_item = shift;
   if ( $inventory_item->svcnum ) {
-    [ "${p}view/svc_acct.cgi?", 'svcnum' ];
+
+    #[ "${p}view/svc_acct.cgi?", 'svcnum' ];
+    my $url = svc_url(
+      'm'      => $m,
+      'action' => 'view',
+      #'svcdb'  => $inventory_item->cust_svc->part_svc->svcdb,
+      'svcdb'  => $inventory_item->svcdb, #we have it from the joined search
+      'query'  => '',
+    );
+    [ $url, 'svcnum' ];
   } else {
     '';
   }