explicit & for table/itable/ntable
[freeside.git] / htdocs / browse / agent.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: agent.cgi,v 1.12 1999-04-09 03:52:55 ivan Exp $
4 #
5 # ivan@sisd.com 97-dec-12
6 #
7 # changes to allow pages to load from a relative location in the web tree.
8 #       bmccane@maxbaud.net     98-mar-25
9 #
10 # changed 'type' to 'atype' because type is reserved word in Pg6.3
11 #       bmccane@maxbaud.net     98-apr-3
12 #
13 # agent type was linking to wrong cgi ivan@sisd.com 98-jul-18
14 #
15 # lose background, FS::CGI ivan@sisd.com 98-sep-2
16 #
17 # $Log: agent.cgi,v $
18 # Revision 1.12  1999-04-09 03:52:55  ivan
19 # explicit & for table/itable/ntable
20 #
21 # Revision 1.11  1999/01/20 09:43:16  ivan
22 # comment out future UI code (but look at it, it's neat!)
23 #
24 # Revision 1.10  1999/01/19 05:13:24  ivan
25 # for mod_perl: no more top-level my() variables; use vars instead
26 # also the last s/create/new/;
27 #
28 # Revision 1.9  1999/01/18 09:41:14  ivan
29 # all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
30 # (good idea anyway)
31 #
32 # Revision 1.8  1999/01/18 09:22:26  ivan
33 # changes to track email addresses for email invoicing
34 #
35 # Revision 1.7  1998/12/17 05:25:16  ivan
36 # fix visual and other bugs
37 #
38 # Revision 1.6  1998/11/23 05:29:46  ivan
39 # use CGI::Carp
40 #
41 # Revision 1.5  1998/11/23 05:27:31  ivan
42 # to eliminate warnings
43 #
44 # Revision 1.4  1998/11/20 08:50:36  ivan
45 # s/CGI::Base/CGI.pm, visual fixes
46 #
47 # Revision 1.3  1998/11/08 10:11:02  ivan
48 # CGI.pm
49 #
50 # Revision 1.2  1998/11/07 10:24:22  ivan
51 # don't use depriciated FS::Bill and FS::Invoice, other miscellania
52 #
53
54 use strict;
55 use vars qw( $ui $cgi $p $agent );
56 use CGI;
57 use CGI::Carp qw(fatalsToBrowser);
58 use FS::UID qw(cgisuidsetup swapuid);
59 use FS::Record qw(qsearch qsearchs);
60 use FS::CGI qw(header menubar table popurl);
61 use FS::agent;
62 use FS::agent_type;
63
64 #Begin silliness
65 #
66 #use FS::UI::CGI;
67 #use FS::UI::agent;
68 #
69 #$ui = new FS::UI::agent;
70 #$ui->browse;
71 #exit;
72 #__END__
73 #End silliness
74
75 $cgi = new CGI;
76
77 &cgisuidsetup($cgi);
78
79 $p = popurl(2);
80
81 print $cgi->header( '-expires' => 'now' ), header('Agent Listing', menubar(
82   'Main Menu'   => $p,
83   'Agent Types' => $p. 'browse/agent_type.cgi',
84 #  'Add new agent' => '../edit/agent.cgi'
85 )), <<END;
86 Agents are resellers of your service. Agents may be limited to a subset of your
87 full offerings (via their type).<BR><BR>
88 END
89 print &table, <<END;
90       <TR>
91         <TH COLSPAN=2>Agent</TH>
92         <TH>Type</TH>
93         <TH><FONT SIZE=-1>Freq. (unimp.)</FONT></TH>
94         <TH><FONT SIZE=-1>Prog. (unimp.)</FONT></TH>
95       </TR>
96 END
97 #        <TH><FONT SIZE=-1>Agent #</FONT></TH>
98 #        <TH>Agent</TH>
99
100 foreach $agent ( sort { 
101   $a->getfield('agentnum') <=> $b->getfield('agentnum')
102 } qsearch('agent',{}) ) {
103   my($hashref)=$agent->hashref;
104   my($typenum)=$hashref->{typenum};
105   my($agent_type)=qsearchs('agent_type',{'typenum'=>$typenum});
106   my($atype)=$agent_type->getfield('atype');
107   print <<END;
108       <TR>
109         <TD><A HREF="${p}edit/agent.cgi?$hashref->{agentnum}">
110           $hashref->{agentnum}</A></TD>
111         <TD><A HREF="${p}edit/agent.cgi?$hashref->{agentnum}">
112           $hashref->{agent}</A></TD>
113         <TD><A HREF="${p}edit/agent_type.cgi?$typenum">$atype</A></TD>
114         <TD>$hashref->{freq}</TD>
115         <TD>$hashref->{prog}</TD>
116       </TR>
117 END
118
119 }
120
121 print <<END;
122       <TR>
123         <TD COLSPAN=2><A HREF="${p}edit/agent.cgi"><I>Add new agent</I></A></TD>
124         <TD><A HREF="${p}edit/agent_type.cgi"><I>Add new agent type</I></A></TD>
125       </TR>
126     </TABLE>
127
128   </BODY>
129 </HTML>
130 END
131