[freeside-commits] freeside/FS/FS cust_pkg.pm, 1.204.2.1, 1.204.2.2 part_pkg.pm, 1.123, 1.123.2.1
Ivan,,,
ivan at wavetail.420.am
Fri Aug 5 12:26:59 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv11090
Modified Files:
Tag: FREESIDE_2_3_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.123
retrieving revision 1.123.2.1
diff -u -w -d -r1.123 -r1.123.2.1
--- part_pkg.pm 12 Jul 2011 22:58:41 -0000 1.123
+++ part_pkg.pm 5 Aug 2011 19:26:57 -0000 1.123.2.1
@@ -1067,6 +1067,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.204.2.1
retrieving revision 1.204.2.2
diff -u -w -d -r1.204.2.1 -r1.204.2.2
--- cust_pkg.pm 22 Jul 2011 17:55:47 -0000 1.204.2.1
+++ cust_pkg.pm 5 Aug 2011 19:26:57 -0000 1.204.2.2
@@ -1937,7 +1937,7 @@
my $self = shift;
my $pkgnum = $self->pkgnum;
- my $pkgpart = $self->pkgpart;
+ #my $pkgpart = $self->pkgpart;
# qsearch( {
# 'table' => 'part_svc',
@@ -1956,23 +1956,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