Verwaltung von Abteilungen auf Controller umgestellt
[kivitendo-erp.git] / SL / DB / Department.pm
1 package SL::DB::Department;
2
3 use strict;
4
5 use SL::DB::MetaSetup::Department;
6 use SL::DB::Manager::Department;
7
8 use SL::DB::DptTrans;
9
10 sub validate {
11   my ($self) = @_;
12
13   my @errors;
14   push @errors, $::locale->text('The description is missing.') if !$self->description;
15
16   return @errors;
17 }
18
19 sub is_used {
20   my ($self) = @_;
21
22   return undef if !$self->id;
23   my $is_used = SL::DB::Manager::DptTrans->find_by(department_id => $self->id);
24   return !!$is_used;
25 }
26
27 1;