#resolved by performing a change package instead (which unprovisions) and
#later cancelling
if ( !$options{nobill} && !$date && $conf->exists('bill_usage_on_cancel') ) {
+ my $copy = $self->new({$self->hash});
my $error =
- $self->cust_main->bill( pkg_list => [ $self ], cancel => 1 );
+ $copy->cust_main->bill( pkg_list => [ $copy ], cancel => 1 );
warn "Error billing during cancel, custnum ".
#$self->cust_main->custnum. ": $error"
": $error"
if ( $num > $max_same_services ) {
push @labels, "$label ($num)";
} else {
- push @labels, map { "$label: $_" } @values;
+ if ( $conf->exists('cust_bill-consolidate_services') ) {
+ # push @labels, "$label: ". join(', ', @values);
+ while ( @values ) {
+ my $detail = "$label: ";
+ $detail .= shift(@values). ', '
+ while @values && length($detail.$values[0]) < 78;
+ $detail =~ s/, $//;
+ push @labels, $detail;
+ }
+ } else {
+ push @labels, map { "$label: $_" } @values;
+ }
}
}
"cust_main.agentnum = $1";
}
+ ##
+ # parse custnum
+ ##
+
+ if ( $params->{'custnum'} =~ /^(\d+)$/ and $1 ) {
+ push @where,
+ "cust_pkg.custnum = $1";
+ }
+
##
# parse status
##
@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";
my $addl_from = 'LEFT JOIN cust_main USING ( custnum ) '.
'LEFT JOIN part_pkg USING ( pkgpart ) '.
- 'LEFT JOIN pkg_class USING ( classnum ) ';
+ 'LEFT JOIN pkg_class ON ( part_pkg.classnum = pkg_class.classnum ) ';
my $count_query = "SELECT COUNT(*) FROM cust_pkg $addl_from $extra_sql";