Verwaltung von Pflichtenheftstatus
[kivitendo-erp.git] / SL / DB / RequirementSpecStatus.pm
1 package SL::DB::RequirementSpecStatus;
2
3 use strict;
4
5 use List::MoreUtils qw(none);
6
7 use SL::DB::MetaSetup::RequirementSpecStatus;
8 use SL::DB::Manager::RequirementSpecStatus;
9 use SL::DB::Helper::ActsAsList;
10 use SL::Locale::String;
11
12 our @valid_names = qw(planning running done);
13
14 sub validate {
15   my ($self) = @_;
16
17   my @errors;
18
19   push @errors, t8('The name is missing.')                     if !$self->name;
20   push @errors, t8('The name and description are not unique.') if  $self->get_first_conflicting('name', 'description');
21   push @errors, t8('The name is invalid.')                     if  none { $_ eq $self->name } @valid_names;
22   push @errors, t8('The description is missing.')              if !$self->description;
23
24   return @errors;
25 }
26
27 1;