X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/defc4fe60bea14a5cc5fb2f3f5bc8b7f1dfd2657..a2bab345aedcfbb03bdf0e0aa1f28a5c57a5d02b:/SL/DB/PriceRuleItem.pm 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;