[freeside-commits] freeside/FS/FS cust_pkg.pm,1.204.2.4,1.204.2.5
Ivan,,,
ivan at wavetail.420.am
Wed Aug 17 17:33:39 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv14519/FS/FS
Modified Files:
Tag: FREESIDE_2_3_BRANCH
cust_pkg.pm
Log Message:
allow multiple classnums in package search, RT#13922
Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.204.2.4
retrieving revision 1.204.2.5
diff -u -w -d -r1.204.2.4 -r1.204.2.5
--- cust_pkg.pm 11 Aug 2011 00:38:13 -0000 1.204.2.4
+++ cust_pkg.pm 18 Aug 2011 00:33:37 -0000 1.204.2.5
@@ -1801,7 +1801,7 @@
FS::h_cust_svc->sql_h_search(@_),
) ]
);
- if ( $mode eq 'I' ) {
+ if ( defined($mode) && $mode eq 'I' ) {
my %hidden_svcpart = map { $_->svcpart => $_->hidden } $self->part_svc;
return grep { !$hidden_svcpart{$_->svcpart} } @cust_svc;
} else {
@@ -2956,34 +2956,42 @@
# parse package class
###
- #false lazinessish w/graph/cust_bill_pkg.cgi
- my $classnum = 0;
- my @pkg_class = ();
- if ( exists($params->{'classnum'})
- && $params->{'classnum'} =~ /^(\d*)$/
- )
- {
- $classnum = $1;
- if ( $classnum ) { #a specific class
- push @where, "part_pkg.classnum = $classnum";
-
- #@pkg_class = ( qsearchs('pkg_class', { 'classnum' => $classnum } ) );
- #die "classnum $classnum not found!" unless $pkg_class[0];
- #$title .= $pkg_class[0]->classname.' ';
+ if ( exists($params->{'classnum'}) ) {
- } elsif ( $classnum eq '' ) { #the empty class
+ my @classnum = ();
+ if ( ref($params->{'classnum'}) ) {
- push @where, "part_pkg.classnum IS NULL";
- #$title .= 'Empty class ';
- #@pkg_class = ( '(empty class)' );
- } elsif ( $classnum eq '0' ) {
- #@pkg_class = qsearch('pkg_class', {} ); # { 'disabled' => '' } );
- #push @pkg_class, '(empty class)';
+ if ( ref($params->{'classnum'}) eq 'HASH' ) {
+ @classnum = grep $params->{'classnum'}{$_}, keys %{ $params->{'classnum'} };
+ } elsif ( ref($params->{'classnum'}) eq 'ARRAY' ) {
+ @classnum = @{ $params->{'classnum'} };
} else {
- die "illegal classnum";
+ die 'unhandled classnum ref '. $params->{'classnum'};
}
+
+
+ } elsif ( $params->{'classnum'} =~ /^(\d*)$/ && $1 ne '0' ) {
+ @classnum = ( $1 );
+ }
+
+ if ( @classnum ) {
+
+ my @c_where = ();
+ my @nums = grep $_, @classnum;
+ push @c_where, 'part_pkg.classnum IN ('. join(',', at nums). ')' if @nums;
+ my $null = scalar( grep { $_ eq '' } @classnum );
+ push @c_where, 'part_pkg.classnum IS NULL' if $null;
+
+ if ( scalar(@c_where) == 1 ) {
+ push @where, @c_where;
+ } elsif ( @c_where ) {
+ push @where, ' ( '. join(' OR ', @c_where). ' ) ';
+ }
+
+ }
+
+
}
- #eslaf
###
# parse package report options
More information about the freeside-commits
mailing list