start of package class web UI (add/edit package classes, package class selection...
[freeside.git] / httemplate / edit / agent_type.cgi
index 6842163..944ddd0 100755 (executable)
@@ -16,7 +16,7 @@ my $action = $agent_type->typenum ? 'Edit' : 'Add';
 
 %>
 
-<%= header("$action Agent Type", menubar(
+<%= include("/elements/header.html","$action Agent Type", menubar(
   'Main Menu' => "$p",
   'View all agent types' => "${p}browse/agent_type.cgi",
 ))
@@ -37,7 +37,18 @@ Agent Type
 
 Select which packages agents of this type may sell to customers<BR>
 
-<% foreach my $part_pkg ( qsearch('part_pkg',{ 'disabled' => '' }) ) { %>
+<% foreach my $part_pkg (
+     qsearch({ 'table'     => 'part_pkg',
+               'hashref'   => { 'disabled' => '' },
+               'select'    => 'part_pkg.*',
+               'addl_from' => 'LEFT JOIN type_pkgs USING ( pkgpart )',
+               'extra_sql' => ( $agent_type->typenum
+                                  ? 'OR typenum = '. $agent_type->typenum
+                                  : ''
+                              ),
+            })
+   ) {
+%>
 
   <BR>
   <INPUT TYPE="checkbox" NAME="pkgpart<%= $part_pkg->pkgpart %>" <%=
@@ -50,7 +61,8 @@ Select which packages agents of this type may sell to customers<BR>
   %> VALUE="ON">
 
   <A HREF="<%= $p %>edit/part_pkg.cgi?<%= $part_pkg->pkgpart %>"><%= $part_pkg->pkgpart %>: 
-  <%= $part_pkg->pkg %> (<%= $part_pkg->comment %>)</A>
+  <%= $part_pkg->pkg %> - <%= $part_pkg->comment %></A>
+  <%= $part_pkg->disabled =~ /^Y/i ? ' (DISABLED)' : '' %>
 
 <% } %>