X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FPriceRuleItem.pm;h=8aa71dab3a1851a891f8077c361107d50e74c0bb;hb=c7241bf7c547d63999898dee7b5dd486e4d122d3;hp=3fc39dfb8ce541224f3cb2918c02cfc1505a349c;hpb=b720e272f739767ad33afffcf8c282c98f97dba1;p=kivitendo-erp.git diff --git a/SL/DB/PriceRuleItem.pm b/SL/DB/PriceRuleItem.pm index 3fc39dfb8..8aa71dab3 100644 --- a/SL/DB/PriceRuleItem.pm +++ b/SL/DB/PriceRuleItem.pm @@ -132,4 +132,15 @@ sub full_description { : do { die "unknown type $type" } } +sub validate { + my ($self) = @_; + + my @errors; + push @errors, t8('Rule for part must not be empty') if $self->type eq 'part' && !$self->value_int; + push @errors, t8('Rule for customer must not be empty') if $self->type eq 'customer' && !$self->value_int; + push @errors, t8('Rule for vendor must not be empty') if $self->type eq 'vendor' && !$self->value_int; + + return @errors; +} + 1;