Revision 3f59726e
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/DB/PartClassification.pm | ||
---|---|---|
7 | 7 |
use SL::DB::Manager::PartClassification; |
8 | 8 |
|
9 | 9 |
__PACKAGE__->meta->initialize; |
10 |
__PACKAGE__->before_delete('can_be_deleted'); |
|
10 | 11 |
|
11 | 12 |
# check if the description and abbreviation is present |
12 | 13 |
# |
... | ... | |
20 | 21 |
return @errors; |
21 | 22 |
} |
22 | 23 |
|
24 |
sub can_be_deleted { |
|
25 |
my ($self) = @_; |
|
23 | 26 |
|
27 |
# The first five part classifications must not be deleted. |
|
28 |
return defined($self->id) && ($self->id >= 5); |
|
29 |
} |
|
24 | 30 |
|
25 | 31 |
1; |
26 | 32 |
|
Auch abrufbar als: Unified diff
Artikel-Klassifizierung: System-Klassifizierungen (id < 5) nicht löschen können