From: ivan Date: Mon, 30 Mar 2009 00:32:03 +0000 (+0000) Subject: part_pkg caching should speedup display of lots of packages, RT#5083 X-Git-Tag: root_of_svc_elec_features~1333 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=3b5ccffae54e59c012eb1ebb348207510ca1d5ce part_pkg caching should speedup display of lots of packages, RT#5083 --- diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index f2e0005d7..44e1210fe 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -1220,8 +1220,10 @@ L). =cut +use Carp qw(cluck); sub part_pkg { my $self = shift; + cluck "part_pkg called" if $DEBUG > 1 && ! $self->{'_pkgpart'}; #exists( $self->{'_pkgpart'} ) $self->{'_pkgpart'} ? $self->{'_pkgpart'} diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 7643e3efd..9b1d5b317 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -76,6 +76,7 @@ Current packages Services +% my %part_pkg = (); % foreach my $cust_pkg (@$packages) { % % if ( $bgcolor eq $bgcolor1 ) { @@ -84,12 +85,18 @@ Current packages % $bgcolor = $bgcolor1; % } % +% $part_pkg{$cust_pkg->pkgpart} ||= $cust_pkg->part_pkg; +% $cust_pkg->{'_pkgpart'} ||= $part_pkg{$cust_pkg->pkgpart}; #XXX cache kludge +% % my %iopt = ( % 'bgcolor' => $bgcolor, % 'cust_pkg' => $cust_pkg, -% 'part_pkg' => $cust_pkg->part_pkg, +% 'part_pkg' => $part_pkg{$cust_pkg->pkgpart}, % %conf_opt, % ); +% +% my $oldDEBUG = $FS::cust_pkg::DEBUG; +% $FS::cust_pkg::DEBUG = 2; @@ -101,6 +108,8 @@ Current packages <% include('packages/services.html', %iopt) %> +% $FS::cust_pkg::DEBUG = $oldDEBUG; + % }