X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FRequirementSpecStatus.pm;h=84367994a2b01ddf3c46309136478d4ae235b13b;hb=5349a1ed016ae603b39d73747eccc6792707db1c;hp=1fc6f9961f7d1a705ccc9caca5688400aeacf1bb;hpb=d17e1b9d1b761bb19d0cb79a742ea70a07028998;p=kivitendo-erp.git diff --git a/SL/DB/RequirementSpecStatus.pm b/SL/DB/RequirementSpecStatus.pm index 1fc6f9961..84367994a 100644 --- a/SL/DB/RequirementSpecStatus.pm +++ b/SL/DB/RequirementSpecStatus.pm @@ -2,20 +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; -# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. -__PACKAGE__->meta->make_manager_class; +__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; }