]> wagnertech.de Git - mfinanz.git/blobdiff - SL/DB/PriceRule.pm
PriceRule: bessere Validierung und Lokalisierung
[mfinanz.git] / SL / DB / PriceRule.pm
index 23e314ab99a23e98c676e1646dfe44e7897503f3..7dfd197037f7d38688c8177f52c75cd0f0d7ec06 100644 (file)
@@ -75,8 +75,9 @@ sub validate {
   my ($self) = @_;
 
   my @errors;
-  push @errors, $::locale->text('The name must not be empty.')           if !$self->name;
-  push @errors, $::locale->text('Price or discount must not be zero.')   if !$self->price && !$self->discount;
+  push @errors, $::locale->text('The name must not be empty.')              if !$self->name;
+  push @errors, $::locale->text('Price or discount must not be zero.')      if !$self->price && !$self->discount;
+  push @errors, $::locale->text('Pirce rules must have at least one rule.') if !@{[ $self->items ]};
 
   return @errors;
 }