summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorjeff <jeff>2007-12-06 20:49:52 +0000
committerjeff <jeff>2007-12-06 20:49:52 +0000
commita47caf361da113107053575bf537258b276d4d2b (patch)
tree31404285a1919506fff9b45a1b250a0103ca1ce0 /httemplate/edit
parentd129793270ce86edc3ae9c1428db4a6cfdaa3a6d (diff)
agent setting during package edit cleanup
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-xhttemplate/edit/part_pkg.cgi11
1 files changed, 9 insertions, 2 deletions
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index 76472334a..559ade14c 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -66,7 +66,6 @@ Tax information
</TD>
</TR>
-% my $conf = new FS::Conf;
% if ( $conf->exists('enable_taxclasses') ) {
<TR>
@@ -103,10 +102,14 @@ Line-item revenue recognition
</TD><TD VALIGN="top">
-% if ( $cgi->param('clone') || $conf->exists('agent_defaultpkg') ) {
+% if ( $cgi->param('clone') ) {
<INPUT TYPE="hidden" NAME="agent_type" VALUE="">
+% } elsif ( scalar(@all_agent_types) == 1) {
+
+ <INPUT TYPE="hidden" NAME="agent_type" VALUE="<% $all_agent_types[0] %>">
+
% } else {
Reseller information
@@ -366,8 +369,10 @@ if ( $cgi->param('pkgnum') && $cgi->param('pkgnum') =~ /^(\d+)$/ ) {
my ($query) = $cgi->keywords;
+my $conf = new FS::Conf;
my $part_pkg = '';
my @agent_type = ();
+my @all_agent_types = map {$_->typenum} qsearch('agent_type',{});
if ( $cgi->param('error') ) {
$part_pkg = new FS::part_pkg ( {
map { $_, scalar($cgi->param($_)) } fields('part_pkg')
@@ -394,6 +399,8 @@ if ( $cgi->param('clone') ) {
unless ( $part_pkg ) {
$part_pkg = new FS::part_pkg {};
$part_pkg->plan('flat');
+ @agent_type = @all_agent_types if $conf->exists('agent_defaultpkg');
+
}
}
unless ( $part_pkg->plan ) { #backwards-compat