X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Fagent_type.cgi;h=a5ffb1048080a4fed5cf1199575ad85adc7bc016;hb=c738a3c4923774b64960aa87fa58bd0751487edb;hp=c61208c83afdc1d4f117f4447aa047fadd0cd642;hpb=b487a58e0f36136dbd714916f98a4eaed2373bb0;p=freeside.git
diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi
index c61208c83..a5ffb1048 100755
--- a/httemplate/browse/agent_type.cgi
+++ b/httemplate/browse/agent_type.cgi
@@ -1,60 +1,62 @@
-
-<%= header("Agent Type Listing", menubar(
- 'Main Menu' => $p,
- '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 |
-
+my $html_init =
+ 'Agent types define groups of packages that you can then assign to'.
+ ' particular agents.
'.
+ qq!Add a new agent type
!;
-<%
-foreach my $agent_type ( sort {
- $a->getfield('typenum') <=> $b->getfield('typenum')
-} qsearch('agent_type',{}) ) {
- my $hashref = $agent_type->hashref;
- #more efficient to do this with SQL...
- my @type_pkgs = grep { ! $_->part_pkg->disabled }
- qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} });
- my $rowspan = scalar(@type_pkgs);
- $rowspan = int($rowspan/2+0.5) ;
- print <
-
- $hashref->{typenum}
- |
- $hashref->{atype} |
-END
+my $count_query = 'SELECT COUNT(*) FROM agent_type';
- my($type_pkgs);
- my($tdcount) = -1 ;
- foreach $type_pkgs ( @type_pkgs ) {
- my($pkgpart)=$type_pkgs->getfield('pkgpart');
- my($part_pkg) = qsearchs('part_pkg',{'pkgpart'=> $pkgpart });
- print qq!! if ($tdcount == 0) ;
- $tdcount = 0 if ($tdcount == -1) ;
- print qq!!,
- $part_pkg->getfield('pkg')," | ";
- $tdcount ++ ;
- if ($tdcount == 2)
- {
- print qq!
\n! ;
- $tdcount = 0 ;
- }
- }
+#false laziness w/access_user.html
+my $packages_sub = sub {
+ my $agent_type = shift;
- print "";
-}
+ [ map {
+ my $type_pkgs = $_;
+ my $part_pkg = $type_pkgs->part_pkg;
+ [
+ {
+ 'data' => $part_pkg->pkg. ' - '. $part_pkg->comment,
+ 'align' => 'left',
+ 'link' => $p. 'edit/part_pkg.cgi?'. $type_pkgs->pkgpart,
+ },
+ ];
+ }
+ #sort {
+ # }
+ grep {
+ $_->part_pkg and ! $_->part_pkg->disabled
+ }
+ $agent_type->type_pkgs #XXX the method should order itself by something
+ ];
-print <
-