[freeside-commits] freeside/FS/FS agent_type.pm,1.5,1.6

Ivan,,, ivan at wavetail.420.am
Mon Oct 11 03:36:22 PDT 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv31532

Modified Files:
	agent_type.pm 
Log Message:
optimization to speed up new customer page when there's lots of agents, RT#10184

Index: agent_type.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/agent_type.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- agent_type.pm	21 Jun 2006 08:42:18 -0000	1.5
+++ agent_type.pm	11 Oct 2010 10:36:20 -0000	1.6
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw( @ISA );
-use FS::Record qw( qsearch );
+use FS::Record qw( qsearch dbh );
 use FS::m2m_Common;
 use FS::agent;
 use FS::type_pkgs;
@@ -119,9 +119,7 @@
 sub pkgpart_hashref {
   my $self = shift;
   my %pkgpart;
-  #$pkgpart{$_}++ foreach $self->pkgpart;
-  # not compatible w/5.004_04 (fixed in 5.004_05)
-  foreach ( $self->pkgpart ) { $pkgpart{$_}++; }
+  $pkgpart{$_}++ foreach $self->pkgpart;
   \%pkgpart;
 }
 
@@ -166,7 +164,13 @@
 
 sub pkgpart {
   my $self = shift;
-  map $_->pkgpart, $self->type_pkgs;
+
+  #map $_->pkgpart, $self->type_pkgs;
+
+  my $sql = 'SELECT pkgpart FROM type_pkgs WHERE typenum = ?';
+  my $sth = dbh->prepare($sql)    or die  dbh->errstr;
+  $sth->execute( $self->typenum ) or die $sth->errstr;
+  map $_->[0], @{ $sth->fetchall_arrayref };
 }
 
 =back



More information about the freeside-commits mailing list