[freeside-commits] freeside/httemplate/view/cust_main packages.html, 1.51, 1.52

Ivan,,, ivan at wavetail.420.am
Sun Mar 29 18:05:06 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/view/cust_main
In directory wavetail.420.am:/tmp/cvs-serv14746/httemplate/view/cust_main

Modified Files:
	packages.html 
Log Message:
forget caching, instead scoop up cust_pkg and part_pkg in one query, RT#5083

Index: packages.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main/packages.html,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- packages.html	30 Mar 2009 00:32:03 -0000	1.51
+++ packages.html	30 Mar 2009 01:05:04 -0000	1.52
@@ -76,7 +76,7 @@
   <TH CLASS="grid" BGCOLOR="#cccccc">Services</TH>
 </TR>
 
-% my %part_pkg = ();
+% local($FS::cust_pkg::DEBUG) = 2;
 % foreach my $cust_pkg (@$packages) {
 %
 %   if ( $bgcolor eq $bgcolor1 ) {
@@ -85,18 +85,15 @@
 %     $bgcolor = $bgcolor1;
 %   }
 %
-%   $part_pkg{$cust_pkg->pkgpart} ||= $cust_pkg->part_pkg;
-%   $cust_pkg->{'_pkgpart'} ||= $part_pkg{$cust_pkg->pkgpart}; #XXX cache kludge
+%   $cust_pkg->{'_pkgpart'} = new FS::part_pkg { $cust_pkg->hash }; #quelle klud
 %
 %   my %iopt = (
 %     'bgcolor'  => $bgcolor,
 %     'cust_pkg' => $cust_pkg,
-%     'part_pkg' => $part_pkg{$cust_pkg->pkgpart},
+%     'part_pkg' => $cust_pkg->part_pkg,
 %     %conf_opt,
 %   );
 %
-%   my $oldDEBUG = $FS::cust_pkg::DEBUG;
-%   $FS::cust_pkg::DEBUG = 2;
 
     <!--pkgnum: <% $cust_pkg->pkgnum %>-->
     <TR>
@@ -108,8 +105,6 @@
       <% include('packages/services.html', %iopt) %>
     </TR>
 
-%   $FS::cust_pkg::DEBUG = $oldDEBUG;
-
 % }
 
 </TABLE>
@@ -174,7 +169,10 @@
     $method = 'all_pkgs';
   }
 
-  my @packages = $cust_main->$method();
+  my @packages = $cust_main->$method( {
+    'select'    => 'cust_pkg.*, part_pkg.*',
+    'addl_from' => 'LEFT JOIN part_pkg USING ( pkgpart )'
+  } );
   my $num_old_packages = scalar(@packages);
 
   unless ( $cgi->param('showoldpackages') ) {



More information about the freeside-commits mailing list