X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Fagent_type.cgi;h=5473804e825bde1bb86594a0ef987ab90f86a23c;hp=11ba20ac5da44200038969a0989af9675aafb695;hb=432a10eb5431f3ef973f6273539b2a685f665807;hpb=c14a267229fc0d6f2d2afdebab3bd34d825df2ef
diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi
index 11ba20ac5..5473804e8 100755
--- a/httemplate/browse/agent_type.cgi
+++ b/httemplate/browse/agent_type.cgi
@@ -1,38 +1,27 @@
-<%
-#
-
-use strict;
-use vars qw( $cgi $p $agent_type );
-use CGI;
-use CGI::Carp qw(fatalsToBrowser);
-use FS::UID qw(cgisuidsetup);
-use FS::Record qw(qsearch qsearchs);
-use FS::CGI qw(header menubar popurl table);
-use FS::agent_type;
-use FS::type_pkgs;
-use FS::part_pkg;
-
-$cgi = new CGI;
-
-&cgisuidsetup($cgi);
-
-$p = popurl(2);
-print header("Agent Type Listing", menubar(
+
+<%= header("Agent Type Listing", menubar(
'Main Menu' => $p,
-)), "Agent types define groups of packages that you can then assign to".
- " particular agents.
", &table(), <
- Agent Type |
- Packages |
-
-END
-
-foreach $agent_type ( sort {
+ 'Agents' => $p. 'browse/agent.cgi',
+)) %>
+Agent types define groups of packages that you can then assign to particular
+agents.
+Add a new agent type
+
+<%= table() %>
+
+ Agent Type |
+ Packages |
+
+
+<%
+foreach my $agent_type ( sort {
$a->getfield('typenum') <=> $b->getfield('typenum')
} qsearch('agent_type',{}) ) {
- my($hashref)=$agent_type->hashref;
- my(@type_pkgs)=qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} });
- my($rowspan)=scalar(@type_pkgs);
+ my $hashref = $agent_type->hashref;
+ #more efficient to do this with SQL...
+ my @type_pkgs = grep { $_->part_pkg and ! $_->part_pkg->disabled }
+ qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} });
+ my $rowspan = scalar(@type_pkgs);
$rowspan = int($rowspan/2+0.5) ;
print <
@@ -63,7 +52,6 @@ END
}
print <Add a new agent type |