Revision 2ff2f6c9
Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt
SL/DB/Department.pm | ||
---|---|---|
1 |
# This file has been auto-generated only because it didn't exist. |
|
2 |
# Feel free to modify it at will; it will not be overwritten automatically. |
|
3 |
|
|
4 | 1 |
package SL::DB::Department; |
5 | 2 |
|
6 | 3 |
use strict; |
7 | 4 |
|
8 | 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) = @_; |
|
9 | 21 |
|
10 |
# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. |
|
11 |
__PACKAGE__->meta->make_manager_class; |
|
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 |
} |
|
12 | 26 |
|
13 | 27 |
1; |
Auch abrufbar als: Unified diff
Verwaltung von Abteilungen auf Controller umgestellt