X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Fagent_type.cgi;h=5473804e825bde1bb86594a0ef987ab90f86a23c;hp=0d7c11f3e16abf28316ccfd5040afff71d067f09;hb=6a751696054face897088706d222d5c9383d40fe;hpb=3d671921441ba8422650b54435a1959ad1d4c71d diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index 0d7c11f3e..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 swapuid); -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 new agent type