X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Fagent_type.cgi;h=5473804e825bde1bb86594a0ef987ab90f86a23c;hb=d0772a4270e8a4d54770c2f33591a69bb94a9dc9;hp=30b80000c1b5665e382136b0bdf2e910fb510c83;hpb=1e4aa8069f25e1b4101da20bb9e0d3f60357ea52;p=freeside.git
diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi
index 30b80000c..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 $cgi->header( '-expires' => 'now' ), 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 |