3 # $Id: agent_type.cgi,v 1.8 1999-01-18 09:41:22 ivan Exp $
5 # agent_type.cgi: Add/Edit agent type (output form)
7 # ivan@sisd.com 97-dec-10
9 # Changes to allow page to work at a relative position in server
10 # Changed 'type' to 'atype' because Pg6.3 reserves the type word
11 # bmccane@maxbaud.net 98-apr-3
13 # use FS::CGI, added inline documentation ivan@sisd.com 98-jul-12
15 # $Log: agent_type.cgi,v $
16 # Revision 1.8 1999-01-18 09:41:22 ivan
17 # all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
20 # Revision 1.7 1999/01/18 09:22:29 ivan
21 # changes to track email addresses for email invoicing
23 # Revision 1.6 1998/12/17 06:16:58 ivan
24 # fix double // in relative URLs, s/CGI::Base/CGI/;
26 # Revision 1.5 1998/11/21 07:58:27 ivan
27 # package names link to them
29 # Revision 1.4 1998/11/21 07:45:19 ivan
30 # visual, use FS::table_name when doing qsearch('table_name')
32 # Revision 1.3 1998/11/15 11:20:12 ivan
33 # s/CGI-Base/CGI.pm/ causes s/QUERY_STRING/keywords/;
35 # Revision 1.2 1998/11/13 09:56:46 ivan
36 # change configuration file layout to support multiple distinct databases (with
37 # own set of config files, export, etc.)
42 use CGI::Carp qw(fatalsToBrowser);
43 use FS::UID qw(cgisuidsetup);
44 use FS::Record qw(qsearch qsearchs);
46 use FS::CGI qw(header menubar popurl);
55 my($agent_type,$action);
56 if ( $cgi->keywords ) { #editing
57 my( $query ) = $cgi->keywords;
59 $agent_type=qsearchs('agent_type',{'typenum'=>$1});
62 $agent_type=create FS::agent_type {};
65 my($hashref)=$agent_type->hashref;
68 print $cgi->header( '-expires' => 'now' ), header("$action Agent Type", menubar(
70 'View all agent types' => "${p}browse/agent_type.cgi",
71 )), '<FORM ACTION="', popurl(1), 'process/agent_type.cgi" METHOD=POST>';
73 print qq!<INPUT TYPE="hidden" NAME="typenum" VALUE="$hashref->{typenum}">!,
74 "Agent Type #", $hashref->{typenum} ? $hashref->{typenum} : "(NEW)";
77 <BR><BR>Agent Type <INPUT TYPE="text" NAME="atype" SIZE=32 VALUE="$hashref->{atype}">
78 <BR><BR>Select which packages agents of this type may sell to customers<BR>
82 foreach $part_pkg ( qsearch('part_pkg',{}) ) {
83 print qq!<BR><INPUT TYPE="checkbox" NAME="pkgpart!,
84 $part_pkg->getfield('pkgpart'), qq!" !,
85 # ( 'CHECKED 'x scalar(
86 qsearchs('type_pkgs',{
87 'typenum' => $agent_type->getfield('typenum'),
88 'pkgpart' => $part_pkg->getfield('pkgpart'),
93 qq!<A HREF="${p}edit/part_pkg.cgi?!, $part_pkg->pkgpart,
94 '">', $part_pkg->getfield('pkg'), '</A>',
98 print qq!<BR><INPUT TYPE="submit" VALUE="!,
99 $hashref->{typenum} ? "Apply changes" : "Add agent type",