summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorlevinse <levinse>2011-01-31 06:23:33 +0000
committerlevinse <levinse>2011-01-31 06:23:33 +0000
commite4f75250ed4828000922cf4d7fecef62a83b60dd (patch)
treec254c693cce08184b920db532678e95585621441 /FS
parent8f1cccb810e60497f36e7832d92c058cbfe18b6d (diff)
add missing commits as part of backporting of RT10481 to 2.1 branch
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/cust_bill.pm11
2 files changed, 15 insertions, 3 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 5ed3b6bec..991906563 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -655,6 +655,13 @@ my %payment_gateway_options = (
},
{
+ 'key' => 'discount-show-always',
+ 'section' => 'billing',
+ 'description' => 'Generate a line item on an invoice even when a package is discounted 100%',
+ 'type' => 'checkbox',
+ },
+
+ {
'key' => 'encryption',
'section' => 'billing',
'description' => 'Enable encryption of credit cards.',
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index aef0b91df..1924bbf85 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -4133,19 +4133,23 @@ sub _items_cust_bill_pkg {
my $summary_page = $opt{summary_page} || '';
my $multilocation = $opt{multilocation} || '';
my $multisection = $opt{multisection} || '';
+ my $discount_show_always = 0;
my @b = ();
my ($s, $r, $u) = ( undef, undef, undef );
foreach my $cust_bill_pkg ( @$cust_bill_pkg )
{
+ $discount_show_always = ($cust_bill_pkg->cust_bill_pkg_discount
+ && $conf->exists('discount-show-always'));
+
foreach ( $s, $r, ($opt{skip_usage} ? () : $u ) ) {
if ( $_ && !$cust_bill_pkg->hidden ) {
$_->{amount} = sprintf( "%.2f", $_->{amount} ),
$_->{amount} =~ s/^\-0\.00$/0.00/;
$_->{unit_amount} = sprintf( "%.2f", $_->{unit_amount} ),
push @b, { %$_ }
- unless $_->{amount} == 0;
+ unless ( $_->{amount} == 0 && !$discount_show_always );
$_ = undef;
}
}
@@ -4219,7 +4223,8 @@ sub _items_cust_bill_pkg {
}
- if ( ( $cust_bill_pkg->recur != 0 || $cust_bill_pkg->setup == 0 ) &&
+ if ( ( $cust_bill_pkg->recur != 0 || $cust_bill_pkg->setup == 0 ||
+ ($discount_show_always && $cust_bill_pkg->recur == 0) ) &&
( !$type || $type eq 'R' || $type eq 'U' )
)
{
@@ -4344,7 +4349,7 @@ sub _items_cust_bill_pkg {
$_->{amount} =~ s/^\-0\.00$/0.00/;
$_->{unit_amount} = sprintf( "%.2f", $_->{unit_amount} ),
push @b, { %$_ }
- unless $_->{amount} == 0;
+ unless ( $_->{amount} == 0 && !$discount_show_always );
}
}