Zahlungsbedingungen: Flag »Fälligkeitsdatum automatisch berechnen«
[kivitendo-erp.git] / SL / DB / PriceRule.pm
index 3deac75..70b5ab4 100644 (file)
@@ -48,7 +48,7 @@ sub price_type {
   my ($self, $value) = @_;
 
   if (@_ > 1) {
-    my $number = $self->price || $self->discount;
+    my $number = $self->price || $self->discount || $self->reduction;
     if ($value == SL::DB::Manager::PriceRule::PRICE_NEW()) {
       $self->price($number);
     } elsif ($value == SL::DB::Manager::PriceRule::PRICE_REDUCED_MASTER_DATA()) {
@@ -96,7 +96,8 @@ sub validate {
   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 && !$self->reduction;
-  push @errors, $::locale->text('Pirce rules must have at least one rule.') if !@{[ $self->items ]};
+  push @errors, $::locale->text('Price rules must have at least one rule.') if !@{[ $self->items ]};
+  push @errors, $_->validate                                                for $self->items;
 
   return @errors;
 }