X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fdiscount.pm;h=13146a91b4fc1f58f7e80a4303faf3df7036e1d4;hb=60c34bd328a404008313d4ab78d25152ebdb9226;hp=e113357410cab0496d85d025362e903cee929865;hpb=2b2dd969f3c18751afc583ad1e836ab8e6f73b5d;p=freeside.git diff --git a/FS/FS/discount.pm b/FS/FS/discount.pm index e11335741..13146a91b 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 =