summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2011-10-24 01:15:54 +0000
committerivan <ivan>2011-10-24 01:15:54 +0000
commit60ad366f6b218de3f229b4ccdc033b96863ea3e9 (patch)
tree906becec320d9d9755c99156a1b3f2bed13f1043 /FS
parentc7cea202843a5a5140d1347c199c0f877a8fa55f (diff)
fix discounts not appearing for one-time charge packages, RT#13654
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_pkg_discount.pm3
-rw-r--r--FS/FS/part_pkg/flat.pm6
2 files changed, 4 insertions, 5 deletions
diff --git a/FS/FS/cust_pkg_discount.pm b/FS/FS/cust_pkg_discount.pm
index d41f497..72a1e9c 100644
--- a/FS/FS/cust_pkg_discount.pm
+++ b/FS/FS/cust_pkg_discount.pm
@@ -171,6 +171,9 @@ sub check {
;
return $error if $error;
+ return "Discount does not apply to setup fees, and package has no recurring"
+ if ! $self->discount->setup && ! $self->cust_pkg->freq;
+
$self->usernum($FS::CurrentUser::CurrentUser->usernum) unless $self->usernum;
$self->SUPER::check;
diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm
index cb7e183..d59c694 100644
--- a/FS/FS/part_pkg/flat.pm
+++ b/FS/FS/part_pkg/flat.pm
@@ -220,11 +220,7 @@ sub is_prepaid { 0; } #no, we're postpaid
sub can_start_date { ! shift->option('start_1st', 1) }
-#XXX discounts only on recurring fees for now (no setup/one-time or usage)
-sub can_discount {
- my $self = shift;
- $self->freq =~ /^\d+$/ && $self->freq > 0;
-}
+sub can_discount { 1; }
sub recur_temporality {
my $self = shift;