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