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