X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FCustomVariableConfig.pm;h=fd247d82713094b38f027eed10663758ff18a0e6;hb=0b9a3ff04bb468d94dd33e87ee499138630f639e;hp=5823e9b7c48e4eb7f8690247d9855c2d628a8677;hpb=117fefacdfaf457a502b32bae2f0e10fd0e11414;p=kivitendo-erp.git diff --git a/SL/DB/CustomVariableConfig.pm b/SL/DB/CustomVariableConfig.pm index 5823e9b7c..fd247d827 100644 --- a/SL/DB/CustomVariableConfig.pm +++ b/SL/DB/CustomVariableConfig.pm @@ -6,9 +6,23 @@ 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__->meta->initialize; + +__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;