X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpackages.html;h=9b13a8f972fd49a4cb4c56fe1be1031ee8c20b42;hb=ff2ad3e74efe8173d362003e1efdce5953388acf;hp=7643e3efd691032c342fdffa941aeb63584e1906;hpb=75989a32bd20f0ab3d38d2cd2c05795ea9b7590d;p=freeside.git
diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html
index 7643e3efd..9b13a8f97 100755
--- a/httemplate/view/cust_main/packages.html
+++ b/httemplate/view/cust_main/packages.html
@@ -76,6 +76,7 @@ Current packages
Services |
+% $FS::cust_pkg::DEBUG = 2;
% foreach my $cust_pkg (@$packages) {
%
% if ( $bgcolor eq $bgcolor1 ) {
@@ -84,12 +85,18 @@ Current packages
% $bgcolor = $bgcolor1;
% }
%
+% my %hash = $cust_pkg->hash;
+% my %part_pkg = map { /^part_pkg_(.+)$/ or die; ( $1 => $hash{$_} ); }
+% grep { /^part_pkg_/ } keys %hash;
+% $cust_pkg->{'_pkgpart'} = new FS::part_pkg \%part_pkg;
+%
% my %iopt = (
% 'bgcolor' => $bgcolor,
% 'cust_pkg' => $cust_pkg,
% 'part_pkg' => $cust_pkg->part_pkg,
% %conf_opt,
% );
+%
@@ -165,7 +172,16 @@ sub get_packages {
$method = 'all_pkgs';
}
- my @packages = $cust_main->$method();
+ my $cust_pkg_fields =
+ join(', ', map { "cust_pkg.$_ AS $_" } fields('cust_pkg') );
+
+ my $part_pkg_fields =
+ join(', ', map { "part_pkg.$_ AS part_pkg_$_" } fields('part_pkg') );
+
+ my @packages = $cust_main->$method( {
+ 'select' => "$cust_pkg_fields, $part_pkg_fields",
+ 'addl_from' => 'LEFT JOIN part_pkg USING ( pkgpart )'
+ } );
my $num_old_packages = scalar(@packages);
unless ( $cgi->param('showoldpackages') ) {