[freeside-commits] branch FREESIDE_3_BRANCH updated. 6cefc6b5606b26af3fecdbf24e8cbebf870577f4

Ivan ivan at 420.am
Wed May 7 16:36:02 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  6cefc6b5606b26af3fecdbf24e8cbebf870577f4 (commit)
      from  204902c9dd654a2bc0e7400b057bcd8c4a60ab54 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6cefc6b5606b26af3fecdbf24e8cbebf870577f4
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed May 7 16:36:01 2014 -0700

    fix agent type selection, RT#28804

diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index f446aa9..60e10d9 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -217,23 +217,6 @@ sub insert {
     }
   }
 
-  my $conf = new FS::Conf;
-  if ( $conf->exists('agent_defaultpkg') ) {
-    warn "  agent_defaultpkg set; allowing all agents to purchase package"
-      if $DEBUG;
-    foreach my $agent_type ( qsearch('agent_type', {} ) ) {
-      my $type_pkgs = new FS::type_pkgs({
-        'typenum' => $agent_type->typenum,
-        'pkgpart' => $self->pkgpart,
-      });
-      my $error = $type_pkgs->insert;
-      if ( $error ) {
-        $dbh->rollback if $oldAutoCommit;
-        return $error;
-      }
-    }
-  }
-
   warn "  inserting part_pkg_taxoverride records" if $DEBUG;
   my %overrides = %{ $options{'tax_overrides'} || {} };
   foreach my $usage_class ( keys %overrides ) {
diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi
index 932e33b..9eb10d2 100755
--- a/httemplate/edit/process/part_pkg.cgi
+++ b/httemplate/edit/process/part_pkg.cgi
@@ -50,8 +50,7 @@ my $precheck_callback = sub {
   }
   return "At least one agent type must be specified."
     unless scalar(@agents)
-           || ( $cgi->param('clone') && $cgi->param('clone') =~ /^\d+$/ )
-           || ( !$cgi->param('pkgpart') && $conf->exists('agent-defaultpkg') )
+           #wtf? || ( $cgi->param('clone') && $cgi->param('clone') =~ /^\d+$/ )
            || $cgi->param('disabled')
            || $cgi->param('agentnum');
 
@@ -232,18 +231,16 @@ foreach my $override_class ($cgi->param) {
 
 my $conf = new FS::Conf;
 
-if ( $cgi->param('pkgpart') || ! $conf->exists('agent_defaultpkg') ) {
-  my @agents = ();
-  foreach ($cgi->param('agent_type')) {
-    /^(\d+)$/;
-    push @agents, $1 if $1;
-  }
-  push @process_m2m, {
-    'link_table'   => 'type_pkgs',
-    'target_table' => 'agent_type',
-    'params'       => \@agents,
-  };
+my @agents = ();
+foreach ($cgi->param('agent_type')) {
+  /^(\d+)$/;
+  push @agents, $1 if $1;
 }
+push @process_m2m, {
+  'link_table'   => 'type_pkgs',
+  'target_table' => 'agent_type',
+  'params'       => \@agents,
+};
 
 my @process_o2m = (
   {
diff --git a/httemplate/elements/tr-select-agent_type.html b/httemplate/elements/tr-select-agent_type.html
index 3fcbcd3..400cb4e 100644
--- a/httemplate/elements/tr-select-agent_type.html
+++ b/httemplate/elements/tr-select-agent_type.html
@@ -1,8 +1,8 @@
-%#% if ( scalar(@agent_types) == 1 ) { 
-%#
-%#  <INPUT TYPE="hidden" NAME="<% $opt{'field'} || 'typenum' %>" VALUE="<% $agent_types[0]->typenum %>">
-%#
-%#% } else { 
+% if ( scalar(@agent_types) == 1 ) { 
+
+  <INPUT TYPE="hidden" NAME="<% $opt{'field'} || 'typenum' %>" VALUE="<% $agent_types[0]->typenum %>">
+
+% } else { 
 
   <TR>
     <TD ALIGN="right"><% $opt{'label'} || 'Agent Type' %></TD>
@@ -15,7 +15,7 @@
     </TD>
   </TR>
 
-%#% } 
+% } 
 
 <%init>
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_pkg.pm                             |   17 -----------------
 httemplate/edit/process/part_pkg.cgi          |   23 ++++++++++-------------
 httemplate/elements/tr-select-agent_type.html |   12 ++++++------
 3 files changed, 16 insertions(+), 36 deletions(-)




More information about the freeside-commits mailing list