summaryrefslogtreecommitdiff
path: root/FS/FS/discount.pm
diff options
context:
space:
mode:
authorivan <ivan>2010-02-05 02:39:31 +0000
committerivan <ivan>2010-02-05 02:39:31 +0000
commit8a0204b4a129a3c26dcca18ba401b2de26d22d2b (patch)
treeacc110c2e41d74fefa6c038c6b0d414865fb29b2 /FS/FS/discount.pm
parent4cacb3fa439b56fc7c9a742b69ec3f6ffd660433 (diff)
discounts, RT#6679
Diffstat (limited to 'FS/FS/discount.pm')
-rw-r--r--FS/FS/discount.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/FS/FS/discount.pm b/FS/FS/discount.pm
index 6771510..8afeb2e 100644
--- a/FS/FS/discount.pm
+++ b/FS/FS/discount.pm
@@ -113,6 +113,16 @@ and replace methods.
sub check {
my $self = shift;
+ 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;
+ }
+
my $error =
$self->ut_numbern('discountnum')
|| $self->ut_textn('name')