[freeside-commits] freeside/httemplate/edit part_pkg.cgi, 1.67.2.5, 1.67.2.6

Jeff Finucane,420,, jeff at wavetail.420.am
Thu Dec 6 12:49:58 PST 2007


Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail:/tmp/cvs-serv12876

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	part_pkg.cgi 
Log Message:
agent setting during package edit cleanup

Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_pkg.cgi,v
retrieving revision 1.67.2.5
retrieving revision 1.67.2.6
diff -u -d -r1.67.2.5 -r1.67.2.6
--- part_pkg.cgi	28 Nov 2007 20:18:33 -0000	1.67.2.5
+++ part_pkg.cgi	6 Dec 2007 20:49:52 -0000	1.67.2.6
@@ -66,7 +66,6 @@
     </TD>
   </TR>
 
-% my $conf = new FS::Conf; 
 % if ( $conf->exists('enable_taxclasses') ) { 
 
   <TR>
@@ -103,10 +102,14 @@
 
 </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 @@
 
 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 @@
   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



More information about the freeside-commits mailing list