X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FBilling_Discount.pm;h=ec2bf077eaa93eddf77afb9fd90288511f59420f;hb=4171d4440a6bf042f342095f13439a5f9d27487d;hp=117bf311a3614e0e461ffcabcd751452b7c0c5fc;hpb=536c3720cb3820d7806d2e672463b5b3d06be078;p=freeside.git diff --git a/FS/FS/cust_main/Billing_Discount.pm b/FS/FS/cust_main/Billing_Discount.pm index 117bf311a..ec2bf077e 100644 --- a/FS/FS/cust_main/Billing_Discount.pm +++ b/FS/FS/cust_main/Billing_Discount.pm @@ -92,8 +92,11 @@ sub discount_terms { my @discount_pkgs = $self->_discount_pkgs_and_bill; shift @discount_pkgs; #discard bill; - - map { $terms{$_->months} = 1 } + + # convert @discount_pkgs (the list of packages that have available discounts) + # to a list of distinct term lengths in months, and strip any decimal places + # from the number of months, not that it should have any + map { $terms{sprintf('%.0f', $_->months)} = 1 } grep { $_->months && $_->months > 1 } map { $_->discount } map { $_->part_pkg->part_pkg_discount }