X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FRequirementSpecStatus.pm;h=84367994a2b01ddf3c46309136478d4ae235b13b;hb=826d79929635c726f7459296fafa7e630c00e72d;hp=fb808c64cfb4a99f48c42b9dd03e36ff49cef297;hpb=baac72df4777f1d63da63867e893c302b5c0bf5a;p=kivitendo-erp.git diff --git a/SL/DB/RequirementSpecStatus.pm b/SL/DB/RequirementSpecStatus.pm index fb808c64c..84367994a 100644 --- a/SL/DB/RequirementSpecStatus.pm +++ b/SL/DB/RequirementSpecStatus.pm @@ -2,18 +2,26 @@ package SL::DB::RequirementSpecStatus; use strict; +use List::MoreUtils qw(none); + use SL::DB::MetaSetup::RequirementSpecStatus; use SL::DB::Manager::RequirementSpecStatus; use SL::DB::Helper::ActsAsList; use SL::Locale::String; +__PACKAGE__->meta->initialize; + +our @valid_names = qw(planning running done); + sub validate { my ($self) = @_; my @errors; - push @errors, t8('The name is missing.') if !$self->name; - push @errors, t8('The description is missing.') if !$self->description; + push @errors, t8('The name is missing.') if !$self->name; + push @errors, t8('The name and description are not unique.') if $self->get_first_conflicting('name', 'description'); + push @errors, t8('The name is invalid.') if none { $_ eq $self->name } @valid_names; + push @errors, t8('The description is missing.') if !$self->description; return @errors; }