work around bug in pre-perl5.10 which is at best noisy and at worst missorting
[freeside.git] / FS / FS / cust_pkg.pm
index a3dccc6..d32ad1b 100644 (file)
@@ -1173,8 +1173,12 @@ sub h_cust_svc {
 sub _sort_cust_svc {
   my( $self, $arrayref ) = @_;
 
+  my $sort =
+    sub ($$) { my ($a, $b) = @_; $b->[1] cmp $a->[1]  or  $a->[2] <=> $b->[2]
+};
+
   map  { $_->[0] }
-  sort { $b->[1] cmp $a->[1]  or  $a->[2] <=> $b->[2] } 
+  sort $sort
   map {
         my $pkg_svc = qsearchs( 'pkg_svc', { 'pkgpart' => $self->pkgpart,
                                              'svcpart' => $_->svcpart     } );
@@ -1939,7 +1943,7 @@ sub search_sql {
 
     @pkgpart = grep /^(\d+)$/, @pkgpart;
 
-    push @where, 'pkgpart IN ('. join(',', @pkgpart). ')';
+    push @where, 'pkgpart IN ('. join(',', @pkgpart). ')' if scalar(@pkgpart);
 
   } elsif ( $params->{'pkgpart'} =~ /^(\d+)$/ ) {
     push @where, "pkgpart = $1";