From 05cc1ce102266aa0a25e085b0b39d777686210a6 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Fri, 16 Oct 2015 15:32:32 -0700 Subject: separate setup and recur discounts, #14092 --- FS/FS/discount.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'FS/FS/discount.pm') 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 = -- cgit v1.1