[freeside-commits] freeside/FS/FS cust_pkg.pm, 1.179.2.25, 1.179.2.26 part_pkg.pm, 1.111.2.7, 1.111.2.8
Ivan,,,
ivan at wavetail.420.am
Fri Aug 5 12:27:03 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv11091
Modified Files:
Tag: FREESIDE_2_1_BRANCH
cust_pkg.pm part_pkg.pm
Log Message:
fix double display of service links in bundled packages (and mis-alignment in customer search?), RT#13966
Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.111.2.7
retrieving revision 1.111.2.8
diff -u -w -d -r1.111.2.7 -r1.111.2.8
--- part_pkg.pm 12 Jul 2011 22:58:47 -0000 1.111.2.7
+++ part_pkg.pm 5 Aug 2011 19:27:01 -0000 1.111.2.8
@@ -975,6 +975,10 @@
shift->_self_and_linked('bill', @_);
}
+sub self_and_svc_linked {
+ shift->_self_and_linked('svc', @_);
+}
+
sub _self_and_linked {
my( $self, $type, $hidden ) = @_;
$hidden ||= '';
Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.179.2.25
retrieving revision 1.179.2.26
diff -u -w -d -r1.179.2.25 -r1.179.2.26
--- cust_pkg.pm 22 Jul 2011 17:55:49 -0000 1.179.2.25
+++ cust_pkg.pm 5 Aug 2011 19:27:01 -0000 1.179.2.26
@@ -1931,7 +1931,7 @@
my $self = shift;
my $pkgnum = $self->pkgnum;
- my $pkgpart = $self->pkgpart;
+ #my $pkgpart = $self->pkgpart;
# qsearch( {
# 'table' => 'part_svc',
@@ -1950,23 +1950,27 @@
# 'extra_param' => [ [$self->pkgpart=>'int'], [$self->pkgnum=>'int'] ],
# } );
-#seems to benchmark slightly faster...
+#seems to benchmark slightly faster... (or did?)
+
+ my @pkgparts = map $_->pkgpart, $self->part_pkg->self_and_svc_linked;
+ my $pkgparts = join(',', @pkgparts);
+
qsearch( {
#'select' => 'DISTINCT ON (svcpart) part_svc.*',
#MySQL doesn't grok DISINCT ON
'select' => 'DISTINCT part_svc.*',
'table' => 'part_svc',
'addl_from' =>
- 'LEFT JOIN pkg_svc ON ( pkg_svc.svcpart = part_svc.svcpart
- AND pkg_svc.pkgpart = ?
+ "LEFT JOIN pkg_svc ON ( pkg_svc.svcpart = part_svc.svcpart
+ AND pkg_svc.pkgpart IN ($pkgparts)
AND quantity > 0
)
LEFT JOIN cust_svc ON ( cust_svc.svcpart = part_svc.svcpart )
LEFT JOIN cust_pkg USING ( pkgnum )
- ',
+ ",
'hashref' => {},
'extra_sql' => "WHERE pkgsvcnum IS NULL AND cust_pkg.pkgnum = ? ",
- 'extra_param' => [ [$self->pkgpart=>'int'], [$self->pkgnum=>'int'] ],
+ 'extra_param' => [ [$self->pkgnum=>'int'] ],
} );
}
More information about the freeside-commits
mailing list