X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FPriceRuleItem.pm;h=006556d4ca586bc6af02a14d30033ac6e225f3b0;hb=b775c378552e6b5bf59f98046cdf4e577cd351df;hp=3fc39dfb8ce541224f3cb2918c02cfc1505a349c;hpb=b720e272f739767ad33afffcf8c282c98f97dba1;p=kivitendo-erp.git diff --git a/SL/DB/PriceRuleItem.pm b/SL/DB/PriceRuleItem.pm index 3fc39dfb8..006556d4c 100644 --- a/SL/DB/PriceRuleItem.pm +++ b/SL/DB/PriceRuleItem.pm @@ -7,7 +7,6 @@ use strict; use SL::DB::MetaSetup::PriceRuleItem; use SL::DB::Manager::PriceRuleItem; -use Rose::DB::Object::Helpers qw(clone_and_reset); use SL::Locale::String qw(t8); __PACKAGE__->meta->initialize; @@ -109,7 +108,7 @@ sub full_description { $type eq 'customer' ? t8('Customer') . ' ' . $self->customer->displayable_name : $type eq 'vendor' ? t8('Vendor') . ' ' . $self->vendor->displayable_name : $type eq 'business' ? t8('Type of Business') . ' ' . $self->business->displayable_name - : $type eq 'partsgroup' ? t8('Group') . ' ' . $self->partsgroup->displayable_name + : $type eq 'partsgroup' ? t8('Partsgroup') . ' ' . $self->partsgroup->displayable_name : $type eq 'pricegroup' ? t8('Pricegroup') . ' ' . $self->pricegroup->displayable_name : $type eq 'part' ? t8('Part') . ' ' . $self->part->displayable_name : $type eq 'qty' ? ( @@ -132,4 +131,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;