to eliminate warnings
[freeside.git] / htdocs / browse / agent.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: agent.cgi,v 1.5 1998-11-23 05:27:31 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.5  1998-11-23 05:27:31  ivan
19 # to eliminate warnings
20 #
21 # Revision 1.4  1998/11/20 08:50:36  ivan
22 # s/CGI::Base/CGI.pm, visual fixes
23 #
24 # Revision 1.3  1998/11/08 10:11:02  ivan
25 # CGI.pm
26 #
27 # Revision 1.2  1998/11/07 10:24:22  ivan
28 # don't use depriciated FS::Bill and FS::Invoice, other miscellania
29 #
30
31 use strict;
32 use CGI;
33 use FS::UID qw(cgisuidsetup swapuid);
34 use FS::Record qw(qsearch qsearchs);
35 use FS::CGI qw(header menubar table popurl);
36 use FS::agent;
37 use FS::agent_type;
38
39 my($cgi) = new CGI;
40
41 &cgisuidsetup($cgi);
42
43 print $cgi->header, header('Agent Listing', menubar(
44   'Main Menu'   => popurl(2),
45   'Agent Types' => 'agent_type.cgi',
46 #  'Add new agent' => '../edit/agent.cgi'
47 )), <<END;
48 Agents are resellers of your service. Agents may be limited to a subset of your
49 full offerings (via their type).<BR><BR>
50 END
51 print table, <<END;
52       <TR>
53         <TH COLSPAN=2>Agent</TH>
54         <TH>Type</TH>
55         <TH><FONT SIZE=-1>Freq. (unimp.)</FONT></TH>
56         <TH><FONT SIZE=-1>Prog. (unimp.)</FONT></TH>
57       </TR>
58 END
59 #        <TH><FONT SIZE=-1>Agent #</FONT></TH>
60 #        <TH>Agent</TH>
61
62 my($agent);
63 my($p)=popurl(2);
64 foreach $agent ( sort { 
65   $a->getfield('agentnum') <=> $b->getfield('agentnum')
66 } qsearch('agent',{}) ) {
67   my($hashref)=$agent->hashref;
68   my($typenum)=$hashref->{typenum};
69   my($agent_type)=qsearchs('agent_type',{'typenum'=>$typenum});
70   my($atype)=$agent_type->getfield('atype');
71   print <<END;
72       <TR>
73         <TD><A HREF="$p/edit/agent.cgi?$hashref->{agentnum}">
74           $hashref->{agentnum}</A></TD>
75         <TD><A HREF="$p/edit/agent.cgi?$hashref->{agentnum}">
76           $hashref->{agent}</A></TD>
77         <TD><A HREF="$p/edit/agent_type.cgi?$typenum">$atype</A></TD>
78         <TD>$hashref->{freq}</TD>
79         <TD>$hashref->{prog}</TD>
80       </TR>
81 END
82
83 }
84
85 print <<END;
86       <TR>
87         <TD COLSPAN=2><A HREF="$p/edit/agent.cgi"><I>Add new agent</I></A></TD>
88         <TD><A HREF="$p/edit/agent_type.cgi"><I>Add new agent type</I></A></TD>
89       </TR>
90     </TABLE>
91
92   </BODY>
93 </HTML>
94 END
95