This commit was generated by cvs2svn to compensate for changes in r2526,
[freeside.git] / httemplate / browse / agent_type.cgi
1 <!-- mason kludge -->
2 <%= header("Agent Type Listing", menubar(
3   'Main Menu' => $p,
4   'Agents'    => $p. 'browse/agent.cgi',
5 )) %>
6 Agent types define groups of packages that you can then assign to particular
7 agents.<BR><BR>
8 <A HREF="<%= $p %>edit/agent_type.cgi"><I>Add a new agent type</I></A><BR><BR>
9
10 <%= table() %>
11 <TR>
12   <TH COLSPAN=2>Agent Type</TH>
13   <TH COLSPAN=2>Packages</TH>
14 </TR>
15
16 <% 
17 foreach my $agent_type ( sort { 
18   $a->getfield('typenum') <=> $b->getfield('typenum')
19 } qsearch('agent_type',{}) ) {
20   my($hashref)=$agent_type->hashref;
21   my(@type_pkgs)=qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} });
22   my($rowspan)=scalar(@type_pkgs);
23   $rowspan = int($rowspan/2+0.5) ;
24   print <<END;
25       <TR>
26         <TD ROWSPAN=$rowspan><A HREF="${p}edit/agent_type.cgi?$hashref->{typenum}">
27           $hashref->{typenum}
28         </A></TD>
29         <TD ROWSPAN=$rowspan><A HREF="${p}edit/agent_type.cgi?$hashref->{typenum}">$hashref->{atype}</A></TD>
30 END
31
32   my($type_pkgs);
33   my($tdcount) = -1 ;
34   foreach $type_pkgs ( @type_pkgs ) {
35     my($pkgpart)=$type_pkgs->getfield('pkgpart');
36     my($part_pkg) = qsearchs('part_pkg',{'pkgpart'=> $pkgpart });
37     print qq!<TR>! if ($tdcount == 0) ;
38     $tdcount = 0 if ($tdcount == -1) ;
39     print qq!<TD><A HREF="${p}edit/part_pkg.cgi?$pkgpart">!,
40           $part_pkg->getfield('pkg'),"</A></TD>";
41     $tdcount ++ ;
42     if ($tdcount == 2)
43     {
44         print qq!</TR>\n! ;
45         $tdcount = 0 ;
46     }
47   }
48
49   print "</TR>";
50 }
51
52 print <<END;
53     </TABLE>
54   </BODY>
55 </HTML>
56 END
57
58 %>