From 046131d0a951a09c8674345c37bb130c910dc7c1 Mon Sep 17 00:00:00 2001 From: levinse Date: Fri, 29 Apr 2011 12:16:47 +0000 Subject: [PATCH] apply discount to setup fees, part 1 of 2, RT11512 --- FS/FS/part_pkg/flat.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm index c9f285898..7837acc96 100644 --- a/FS/FS/part_pkg/flat.pm +++ b/FS/FS/part_pkg/flat.pm @@ -98,7 +98,12 @@ sub calc_setup { my $quantity = $cust_pkg->quantity || 1; - sprintf("%.2f", $quantity * $self->unit_setup($cust_pkg, $sdate, $details) ); + my $charge = $quantity * $self->unit_setup($cust_pkg, $sdate, $details); + + my $param = { 'setup_charge' => $charge }; + my $discount = $self->calc_discount($cust_pkg, $sdate, $details, $param); + + sprintf('%.2f', $charge - $discount); } sub unit_setup { -- 2.11.0