X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fdiscount_Mixin.pm;h=3dc3f6e2677b6b86769bc6f93d2fe87ef839ebdf;hp=761d32292c1e56b5c044c0afbf780530ca4813e4;hb=ef6e75c42256463303650203628803f5e781f3db;hpb=7515198c4da1c80ab00628e1f05cb498f916fead diff --git a/FS/FS/part_pkg/discount_Mixin.pm b/FS/FS/part_pkg/discount_Mixin.pm index 761d32292..3dc3f6e26 100644 --- a/FS/FS/part_pkg/discount_Mixin.pm +++ b/FS/FS/part_pkg/discount_Mixin.pm @@ -34,10 +34,6 @@ Takes all the arguments of calc_recur. Calculates and returns the amount by which to reduce the recurring fee; also increments months used on the discount and generates an invoice detail describing it. -If the configuration option 'discount-show_available' is enabled, and this -package is eligible for a prepayment discount but doesn't have one, an -invoice detail will be generated to describe the available discounts. - =cut sub calc_discount { @@ -171,46 +167,7 @@ sub calc_discount { $tot_discount += $amount; } - if (!@cust_pkg_discount and $conf->exists('discount-show_available') ) { - push @$details, $self->available_discounts; - } - sprintf('%.2f', $tot_discount); } -=item available_discounts - -Returns a list of details decribing the available prepayment discounts -for this package. - -=cut - -sub available_discounts { - my $self = shift; - return if $self->freq ne '1'; - my @details; - my $money_char = FS::Conf->new->config('money_char') || '$'; - my @discounts = map { $_->discount } $self->part_pkg_discount; - # probably the most logical way to arrange these - foreach my $discount (sort { $a->months <=> $b->months } @discounts) { - my $months = $discount->months; - my $amount; - if ( $discount->amount > 0 ) { - $amount = $money_char . sprintf('%.2f', $discount->amount); - } - elsif ( $discount->percent ) { - $amount = $discount->percent .'%'; - } - else { #? - next; - } - push @details, "Prepay $months months for $amount discount." - # better way to display this? - # if it's a problem, we'll add discount.invoice_text or something - # for the customer-visible text line. - } - return @details; -} - - 1;