summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorjeff <jeff>2009-10-05 01:00:32 +0000
committerjeff <jeff>2009-10-05 01:00:32 +0000
commit3b53cfb49162c9a1f32027b67ba4cbe86d65d3e5 (patch)
treecfae4caa5590db6b8b9dcbf4fa69bd809d9ef92e /FS
parent947c1f964f1304242f8a6ffabacccf040f1d505e (diff)
invoices with details in separate section but usage not separated
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_bill.pm5
-rw-r--r--FS/FS/cust_main.pm22
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm8
3 files changed, 26 insertions, 9 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index eefcc80bc..57066b474 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -3179,7 +3179,8 @@ sub _items_cust_bill_pkg {
{
my $is_summary = $display->summary;
- my $description = $is_summary ? "Usage charges" : $desc;
+ my $description = ($is_summary && $type && $type eq 'U')
+ ? "Usage charges" : $desc;
unless ( $conf->exists('disable_line_item_date_ranges') ) {
$description .= " (" . time2str("%x", $cust_bill_pkg->sdate).
@@ -3201,7 +3202,7 @@ sub _items_cust_bill_pkg {
unless $cust_pkg->part_pkg->hide_svc_detail
|| $cust_bill_pkg->itemdesc
|| $cust_bill_pkg->hidden
- || $is_summary;
+ || $is_summary && $type && $type eq 'U';
push @d, $cust_bill_pkg->details(%details_opt)
unless ($is_summary || $type && $type eq 'R');
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 16ab0ee0d..501fca45a 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -3147,7 +3147,9 @@ sub _handle_taxes {
}
my @display = ();
- if ( $conf->exists('separate_usage') || $cust_bill_pkg->hidden ) {
+ my $separate = $conf->exists('separate_usage');
+ my $usage_mandate = $cust_pkg->part_pkg->option('usage_mandate', 'Hush!');
+ if ( $separate || $cust_bill_pkg->hidden || $usage_mandate ) {
my $temp_pkg = new FS::cust_pkg { pkgpart => $real_pkgpart };
my %hash = $cust_bill_pkg->hidden # maybe for all bill linked?
@@ -3156,18 +3158,28 @@ sub _handle_taxes {
my $section = $cust_pkg->part_pkg->option('usage_section', 'Hush!');
my $summary = $cust_pkg->part_pkg->option('summarize_usage', 'Hush!');
- push @display, new FS::cust_bill_pkg_display { type => 'S', %hash };
- push @display, new FS::cust_bill_pkg_display { type => 'R', %hash };
+ if ( $separate ) {
+ push @display, new FS::cust_bill_pkg_display { type => 'S', %hash };
+ push @display, new FS::cust_bill_pkg_display { type => 'R', %hash };
+ } else {
+ push @display, new FS::cust_bill_pkg_display
+ { type => '',
+ %hash,
+ ( ( $usage_mandate ) ? ( 'summary' => 'Y' ) : () ),
+ };
+ }
- if ($section && $summary) {
+ if ($separate && $section && $summary) {
push @display, new FS::cust_bill_pkg_display { type => 'U',
summary => 'Y',
%hash,
};
+ }
+ if ($usage_mandate || $section && $summary) {
$hash{post_total} = 'Y';
}
- $hash{section} = $section if $conf->exists('separate_usage');
+ $hash{section} = $section if ($separate || $usage_mandate);
push @display, new FS::cust_bill_pkg_display { type => 'U', %hash };
}
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index f851b41d9..eccf2c19f 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -163,12 +163,16 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
'default' => 'default', #XXX test
},
- 'usage_section' => { 'name' => 'Section in which to place separate usage charges',
+ 'usage_section' => { 'name' => 'Section in which to place usage charges (whether separated or not)',
},
'summarize_usage' => { 'name' => 'Include usage summary with recurring charges when usage is in separate section',
'type' => 'checkbox',
},
+
+ 'usage_mandate' => { 'name' => 'Always put usage details in separate section',
+ 'type' => 'checkbox',
+ },
#eofalse
'bill_every_call' => { 'name' => 'Generate an invoice immediately for every call. Useful for prepaid.',
@@ -218,7 +222,7 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
skip_dst_length_less skip_lastapp
use_duration
411_rewrite
- output_format summarize_usage usage_section
+ output_format usage_mandate summarize_usage usage_section
bill_every_call
count_available_phones
)