X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fdiscount.pm;h=13146a91b4fc1f58f7e80a4303faf3df7036e1d4;hp=e113357410cab0496d85d025362e903cee929865;hb=a36e0f8a0f69349dafaa16d1d2d57dfb6e5dbc85;hpb=f5955dde67c2015cab4a7892d64799d3adbd7968 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 =