summaryrefslogtreecommitdiff
path: root/FS/FS/discount.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-10-16 15:32:32 -0700
committerMark Wells <mark@freeside.biz>2015-10-16 15:48:16 -0700
commit05cc1ce102266aa0a25e085b0b39d777686210a6 (patch)
treee2d9e64f6b357453e83c482a6c279d21abe8da0d /FS/FS/discount.pm
parent8f086c4f68684d696ab64ccfab797272111d3ce4 (diff)
separate setup and recur discounts, #14092
Diffstat (limited to 'FS/FS/discount.pm')
-rw-r--r--FS/FS/discount.pm12
1 files changed, 6 insertions, 6 deletions
diff --git a/FS/FS/discount.pm b/FS/FS/discount.pm
index e113357..13146a9 100644
--- a/FS/FS/discount.pm
+++ b/FS/FS/discount.pm
@@ -119,12 +119,12 @@ sub check {
if ( $self->_type eq 'Select discount type' ) {
return 'Please select a discount type';
- } elsif ( $self->_type eq 'Amount' ) {
- $self->percent('0');
- return 'Amount must be greater than 0' unless $self->amount > 0;
- } elsif ( $self->_type eq 'Percentage' ) {
- $self->amount('0.00');
- return 'Percentage must be greater than 0' unless $self->percent > 0;
+ } elsif ( $self->amount > 0 ) {
+ $self->set('percent', '0');
+ } elsif ( $self->percent > 0 ) {
+ $self->set('amount', '0.00');
+ } else {
+ return "Discount amount or percentage must be > 0";
}
my $error =