add customer fields option with agent, display_custnum, status and name, RT#73721
[freeside.git] / FS / FS / discount.pm
index e113357..13146a9 100644 (file)
@@ -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 =