X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FPriceRuleItem.pm;h=8aa71dab3a1851a891f8077c361107d50e74c0bb;hb=c7241bf7c547d63999898dee7b5dd486e4d122d3;hp=131d46ae9c3d6d96f15b301fe19620f5f8feb22d;hpb=defc4fe60bea14a5cc5fb2f3f5bc8b7f1dfd2657;p=kivitendo-erp.git diff --git a/SL/DB/PriceRuleItem.pm b/SL/DB/PriceRuleItem.pm index 131d46ae9..8aa71dab3 100644 --- a/SL/DB/PriceRuleItem.pm +++ b/SL/DB/PriceRuleItem.pm @@ -111,7 +111,7 @@ sub full_description { : $type eq 'business' ? t8('Type of Business') . ' ' . $self->business->displayable_name : $type eq 'partsgroup' ? t8('Group') . ' ' . $self->partsgroup->displayable_name : $type eq 'pricegroup' ? t8('Pricegroup') . ' ' . $self->pricegroup->displayable_name - : $type eq 'part' ? t8('Part') . ' ' . $self->part->long_description + : $type eq 'part' ? t8('Part') . ' ' . $self->part->displayable_name : $type eq 'qty' ? ( $op eq 'eq' ? t8('Qty equals #1', $self->value_num_as_number) : $op eq 'lt' ? t8('Qty less than #1', $self->value_num_as_number) @@ -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;