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