X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FCustomVariableConfig.pm;h=6c836f04fd457079a964158352a05402cb2fe438;hb=7c60c2423f6fd27a78cf89ca62821ea1e41e85f5;hp=3410a496621e1075314683c3135b26fe9b940ca9;hpb=4fd22b569d4436293e0a9d364d7356b5bfc503e5;p=kivitendo-erp.git diff --git a/SL/DB/CustomVariableConfig.pm b/SL/DB/CustomVariableConfig.pm index 3410a4966..6c836f04f 100644 --- a/SL/DB/CustomVariableConfig.pm +++ b/SL/DB/CustomVariableConfig.pm @@ -6,8 +6,21 @@ package SL::DB::CustomVariableConfig; use strict; use SL::DB::MetaSetup::CustomVariableConfig; +use SL::DB::Manager::CustomVariableConfig; +use SL::DB::Helper::ActsAsList; -# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. -__PACKAGE__->meta->make_manager_class; +__PACKAGE__->configure_acts_as_list(group_by => [qw(module)]); + +sub validate { + my ($self) = @_; + + my @errors; + push @errors, $::locale->text('The name is missing.') if !$self->name; + push @errors, $::locale->text('The description is missing.') if !$self->description; + push @errors, $::locale->text('The type is missing.') if !$self->type; + push @errors, $::locale->text('The option field is empty.') if (($self->type || '') eq 'select') && !$self->options; + + return @errors; +} 1;