|| $cust_pkg->part_pkg->option('usage_mandate', 'Hush!');
# or use the category from $opt{'part_pkg'} if its not bundled?
- my $section = $cust_pkg->part_pkg->categoryname;
+ my $categoryname = $cust_pkg->part_pkg->categoryname;
return $self->set('display', [])
- unless $separate || $section || $usage_mandate;
+ unless $separate || $categoryname || $usage_mandate;
my @display = ();
- my %hash = ( 'section' => $section );
+ my %hash = ( 'section' => $categoryname );
- $section = $part_pkg->option('usage_section', 'Hush!')
- || $cust_pkg->part_pkg->option('usage_section', 'Hush!');
+ my $usage_section = $part_pkg->option('usage_section', 'Hush!')
+ || $cust_pkg->part_pkg->option('usage_section', 'Hush!');
my $summary = $part_pkg->option('summarize_usage', 'Hush!')
|| $cust_pkg->part_pkg->option('summarize_usage', 'Hush!');
};
}
- if ($separate && $section && $summary) {
+ if ($separate && $usage_section && $summary) {
push @display, new FS::cust_bill_pkg_display { type => 'U',
summary => 'Y',
%hash,
};
}
- if ($usage_mandate || $section && $summary) {
+ if ($usage_mandate || ($usage_section && $summary) ) {
$hash{post_total} = 'Y';
}
if ($separate || $usage_mandate) {
- $hash{section} = $section if ($separate || $usage_mandate);
+ $hash{section} = $usage_section if $usage_section;
push @display, new FS::cust_bill_pkg_display { type => 'U', %hash };
}
if ( $self->get('details') ) {
@values =
- map { $_->[2] }
- grep { ref($_) && ( defined($classnum) ? $_->[3] eq $classnum : 1 ) }
+ map { ref($_) eq 'HASH'
+ ? $_->{'amount'}
+ : $_->[2]
+ }
+ grep { ref($_) && ( defined($classnum)
+ ? $classnum eq ( ref($_) eq 'HASH'
+ ? $_->{'classnum'}
+ : $_->[3]
+ )
+ : 1
+ )
+ }
@{ $self->get('details') };
- }else{
+ } else {
my $hashref = { 'billpkgnum' => $self->billpkgnum };
$hashref->{ 'classnum' } = $classnum if defined($classnum);
my %seen = ();
foreach my $detail ( grep { ref($_) } @{$self->get('details')} ) {
- $seen{ $detail->[3] } = 1;
+ $seen{ ref($detail) eq 'HASH'
+ ? $detail->{'classnum'}
+ : $detail->[3]
+ } = 1;
}
keys %seen;
- }else{
+ } else {
map { $_->classnum }
qsearch({ table => 'cust_bill_pkg_detail',