fix A/R report
[freeside.git] / httemplate / search / inventory_item.html
index 37914e0..d827734 100644 (file)
@@ -1,4 +1,4 @@
-<% include( 'elements/search.html',
+<& elements/search.html,
                  'title'       => $title,
 
                  'menubar'     => [ 'View inventory classes' =>
@@ -34,6 +34,7 @@
                    $inventory_class->classname,
                    'Service',
                    FS::UI::Web::cust_header(),
+                   '', # checkbox column
                  ],
 
                  'fields'      => [
@@ -56,6 +57,7 @@
                    },
 
                    \&FS::UI::Web::cust_fields,
+                   $sub_checkbox,
 
                  ],
                  'align'       => 'rll'.FS::UI::Web::cust_aligns(),
                               '',
                               FS::UI::Web::cust_styles(),
                             ],
-
-             )
-%>
+                  'html_init' => $html_form,
+                  'html_foot' => $html_foot,
+             
+&>
 <%init>
 
 my $curuser = $FS::CurrentUser::CurrentUser;
@@ -150,6 +153,40 @@ my $link_cust = sub {
 my $addl_from = ' LEFT JOIN cust_svc  USING ( svcnum  ) '.
                 ' LEFT JOIN part_svc  USING ( svcpart ) '.
                 ' LEFT JOIN cust_pkg  USING ( pkgnum  ) '.
-                ' LEFT JOIN cust_main USING ( custnum ) ';
+                FS::UI::Web::join_cust_main('cust_pkg', 'cust_pkg');
+
+my $sub_checkbox = sub {
+  my $item = $_[0];
+  my $itemnum = $item->itemnum;
+  return '' if $item->svcnum;
+
+  return qq!<INPUT NAME="itemnum" TYPE="checkbox" VALUE="$itemnum">!;
+};
+
+my $html_form = qq!
+<FORM NAME="itemForm" ACTION="$p/misc/inventory_item-move.cgi" METHOD="POST">
+<INPUT TYPE="hidden" NAME="classnum" VALUE="$classnum">
+<INPUT TYPE="hidden" NAME="avail"    VALUE="! .$cgi->param('avail') . '">';
+#'
+
+my $html_foot = include('elements/checkbox-foot.html',
+      actions => [
+          { submit  => 'Delete',
+            confirm => 'Delete the selected items?',
+            name    => 'delete',
+          },
+          { submit  => 'Move to',
+            name    => 'move',
+          },
+      ],
+);
+
+$html_foot =~ s[</DIV>][];
+$html_foot .= 
+  include('/elements/select-agent.html',
+    'field'         => 'move_agentnum',
+    'disable_empty' => 1,
+  ) .
+  '</DIV></FORM>';
 
 </%init>